ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/ermyth/modules/operserv/inject.C
Revision: 1.8
Committed: Sat Sep 22 14:27:28 2007 UTC (16 years, 8 months 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

# Content
1 /**
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 * Copyright © 2003-2004 E. Will et al.
10 * Copyright © 2005-2006 Atheme Development Group
11 * Rights to this code are documented in doc/pod/license.pod.
12 *
13 * $Id: inject.C,v 1.7 2007-09-16 18:54:44 pippijn Exp $
14 */
15
16 #include "atheme.h"
17 #include <ermyth/module.h>
18 #include "uplink.h"
19
20 static char const rcsid[] = "$Id: inject.C,v 1.7 2007-09-16 18:54:44 pippijn Exp $";
21
22 REGISTER_MODULE ("operserv/inject", false, "The Ermyth Team <http://ermyth.xinutec.org>");
23
24 static void os_cmd_inject (sourceinfo_t *si, int parc, char *parv[]);
25
26 command_t const os_inject = { "INJECT", N_("Fakes data from the uplink (debugging tool)."), PRIV_ADMIN, 1, os_cmd_inject };
27
28 E cmdvec os_cmdtree;
29 E helpvec os_helptree;
30
31 bool
32 _modinit (module *m)
33 {
34 os_cmdtree << os_inject;
35 help_addentry (os_helptree, "INJECT", "help/operserv/inject", NULL);
36
37 return true;
38 }
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 command_fail (si, fault::needmoreparams, STR_INSUFFICIENT_PARAMS, "INJECT");
60 command_fail (si, fault::needmoreparams, _("Syntax: INJECT <parameters>"));
61 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 command_fail (si, fault::noprivs, _("You cannot inject an INJECT command."));
72 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 */