Anope IRC Services  Version 1.8
os_raw.c
Go to the documentation of this file.
1 /* OperServ core functions
2  *
3  * (C) 2003-2014 Anope Team
4  * Contact us at team@anope.org
5  *
6  * Please read COPYING and README for further details.
7  *
8  * Based on the original code of Epona by Lara.
9  * Based on the original code of Services by Andy Church.
10  *
11  *
12  */
13 /*************************************************************************/
14 
15 #include "module.h"
16 
17 static int do_raw(User * u);
18 
25 int AnopeInit(int argc, char **argv)
26 {
27  Command *c;
28 
29  moduleAddAuthor("Anope");
30  moduleAddVersion(VERSION_STRING);
32 
33  c = createCommand("RAW", do_raw, is_services_root, OPER_HELP_RAW, -1,
34  -1, -1, -1);
36 
37  if (DisableRaw) {
38  alog("[os_raw] Unloading because DisableRaw is enabled");
39  return MOD_STOP;
40  }
41  return MOD_CONT;
42 }
43 
47 void AnopeFini(void)
48 {
49 
50 }
51 
52 
58 static int do_raw(User * u)
59 {
60  char *text = strtok(NULL, "");
61  if (!text)
62  syntax_error(s_OperServ, u, "RAW", OPER_RAW_SYNTAX);
63  else {
64  send_cmd(NULL, "%s", text);
65  if (WallOSRaw) {
66  char *kw = strtok(text, " ");
67  while (kw && *kw == ':')
68  kw = strtok(NULL, " ");
70  "\2%s\2 used RAW command for \2%s\2",
71  u->nick,
72  (kw ? kw : "\2non RFC compliant message\2"));
73  }
74  alog("%s used RAW command for %s", u->nick, text);
75  }
76  return MOD_CONT;
77 }
void AnopeFini(void)
Definition: os_raw.c:47
char nick[NICKMAX]
Definition: services.h:875
int AnopeInit(int argc, char **argv)
Definition: os_raw.c:25
E void send_cmd(const char *source, const char *fmt,...) FORMAT(printf
static int do_raw(User *u)
Definition: os_raw.c:58
MDE void moduleAddAuthor(const char *author)
Definition: modules.c:1772
E void syntax_error(char *service, User *u, const char *command, int msgnum)
Definition: language.c:295
MDE void moduleSetType(MODType type)
Definition: modules.c:818
E int is_services_root(User *u)
Definition: operserv.c:577
#define OPERSERV
Definition: modules.h:62
E char * s_OperServ
Definition: extern.h:289
#define MOD_STOP
Definition: modules.h:53
Definition: modules.h:99
E int WallOSRaw
Definition: extern.h:460
MDE void moduleAddVersion(const char *version)
Definition: modules.c:1760
Command * c
Definition: ns_recover.c:17
E void alog(const char *fmt,...) FORMAT(printf
#define MOD_CONT
Definition: modules.h:54
MDE Command * createCommand(const char *name, int(*func)(User *u), int(*has_priv)(User *u), int help_all, int help_reg, int help_oper, int help_admin, int help_root)
Definition: modules.c:987
E int DisableRaw
Definition: extern.h:447
MDE int moduleAddCommand(CommandHash *cmdTable[], Command *c, int pos)
Definition: modules.c:1082
#define MOD_UNIQUE
Definition: module.h:11
E void anope_cmd_global(char *source, const char *fmt,...)
Definition: ircd.c:506