ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/ermyth/modules/operserv/inject.C
Revision: 1.8
Committed: Sat Sep 22 14:27:28 2007 UTC (19 years ago) by pippijn
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.7: +3 -3 lines
Log Message:
split up ermyth into ermyth-modules, libermyth (currently just ermyth-util) and ermyth-core

File Contents

# User Rev Content
1 pippijn 1.7 /**
2     * inject.C: This file contains functionality which implements the OperServ INJECT command.
3     *
4     * Copyright © 2007 Pippijn van Steenhoven / The Ermyth Team
5     * Rights to this code are as documented in COPYING.
6     *
7     *
8     * Portions of this file were derived from sources bearing the following license:
9 pippijn 1.5 * Copyright © 2003-2004 E. Will et al.
10     * Copyright © 2005-2006 Atheme Development Group
11 pippijn 1.2 * Rights to this code are documented in doc/pod/license.pod.
12 pippijn 1.1 *
13 pippijn 1.8 * $Id: inject.C,v 1.7 2007-09-16 18:54:44 pippijn Exp $
14 pippijn 1.1 */
15    
16     #include "atheme.h"
17 pippijn 1.5 #include <ermyth/module.h>
18 pippijn 1.1 #include "uplink.h"
19    
20 pippijn 1.8 static char const rcsid[] = "$Id: inject.C,v 1.7 2007-09-16 18:54:44 pippijn Exp $";
21 pippijn 1.1
22 pippijn 1.8 REGISTER_MODULE ("operserv/inject", false, "The Ermyth Team <http://ermyth.xinutec.org>");
23 pippijn 1.1
24     static void os_cmd_inject (sourceinfo_t *si, int parc, char *parv[]);
25    
26 pippijn 1.5 command_t const os_inject = { "INJECT", N_("Fakes data from the uplink (debugging tool)."), PRIV_ADMIN, 1, os_cmd_inject };
27 pippijn 1.1
28 pippijn 1.5 E cmdvec os_cmdtree;
29     E helpvec os_helptree;
30 pippijn 1.1
31 pippijn 1.5 bool
32     _modinit (module *m)
33 pippijn 1.1 {
34     os_cmdtree << os_inject;
35 pippijn 1.4 help_addentry (os_helptree, "INJECT", "help/operserv/inject", NULL);
36 pippijn 1.5
37     return true;
38 pippijn 1.1 }
39    
40     void
41     _moddeinit ()
42     {
43     os_cmdtree >> os_inject;
44     help_delentry (os_helptree, "INJECT");
45     }
46    
47     static void
48     os_cmd_inject (sourceinfo_t *si, int parc, char *parv[])
49     {
50     char *inject;
51     static bool injecting = false;
52     inject = parv[0];
53    
54     if (!config_options.raw)
55     return;
56    
57     if (!inject)
58     {
59 pippijn 1.6 command_fail (si, fault::needmoreparams, STR_INSUFFICIENT_PARAMS, "INJECT");
60     command_fail (si, fault::needmoreparams, _("Syntax: INJECT <parameters>"));
61 pippijn 1.1 return;
62     }
63    
64     logcommand (si, CMDLOG_ADMIN, "INJECT %s", inject);
65    
66     /* looks like someone INJECT'd an INJECT command.
67     * this is probably a bad thing.
68     */
69     if (injecting == true)
70     {
71 pippijn 1.6 command_fail (si, fault::noprivs, _("You cannot inject an INJECT command."));
72 pippijn 1.1 return;
73     }
74    
75     injecting = true;
76     irc_parse (inject);
77     injecting = false;
78     }
79    
80     /* vim:cinoptions=>s,e0,n0,f0,{0,}0,^0,=s,ps,t0,c3,+s,(2s,us,)20,*30,gs,hs
81     * vim:ts=8
82     * vim:sw=8
83     * vim:noexpandtab
84     */