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