Anope IRC Services  Version 1.8
os_modload.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_modload(User * u);
18 static void myOperServHelp(User * u);
19 
26 int AnopeInit(int argc, char **argv)
27 {
28  Command *c;
29 
30  moduleAddAuthor("Anope");
32  (VERSION_STRING);
34 
35  c = createCommand("MODLOAD", do_modload, is_services_root, -1, -1, -1,
36  -1, OPER_HELP_MODLOAD);
38 
40 
41  return MOD_CONT;
42 }
43 
47 void AnopeFini(void)
48 {
49 
50 }
51 
52 
57 static void myOperServHelp(User * u)
58 {
59  if (is_services_root(u)) {
60  notice_lang(s_OperServ, u, OPER_HELP_CMD_MODLOAD);
61  }
62 }
63 
69 static int do_modload(User * u)
70 {
71  char *name;
72 
73  name = strtok(NULL, "");
74  if (!name) {
75  syntax_error(s_OperServ, u, "MODLOAD", OPER_MODULE_LOAD_SYNTAX);
76  return MOD_CONT;
77  }
78  if (!queueModuleLoad(name, u))
79  notice_lang(s_OperServ, u, OPER_MODULE_LOAD_FAIL, name);
80 
81  return MOD_CONT;
82 }
int AnopeInit(int argc, char **argv)
Definition: os_modload.c:26
void AnopeFini(void)
Definition: os_modload.c:47
MDE int queueModuleLoad(char *name, User *u)
Definition: modules.c:2801
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
E void notice_lang(char *source, User *dest, int message,...)
Definition: send.c:169
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
static void myOperServHelp(User *u)
Definition: os_modload.c:57
MDE void moduleAddVersion(const char *version)
Definition: modules.c:1760
Command * c
Definition: ns_recover.c:17
MDE void moduleSetOperHelp(void(*func)(User *u))
Definition: modules.c:2126
#define MOD_CONT
Definition: modules.h:54
static int do_modload(User *u)
Definition: os_modload.c:69
Definition: modules.h:99
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
MDE int moduleAddCommand(CommandHash *cmdTable[], Command *c, int pos)
Definition: modules.c:1082
#define MOD_UNIQUE
Definition: module.h:11