Anope IRC Services  Version 1.8
os_modunload.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_modunload(User * u);
18 
19 static void myOperServHelp(User * u);
20 
27 int AnopeInit(int argc, char **argv)
28 {
29  Command *c;
30 
31  moduleAddAuthor("Anope");
33  (VERSION_STRING);
35 
36  c = createCommand("MODUNLOAD", do_modunload, is_services_root, -1, -1,
37  -1, -1, OPER_HELP_MODUNLOAD);
39 
41 
42  return MOD_CONT;
43 }
44 
48 void AnopeFini(void)
49 {
50 
51 }
52 
53 
58 static void myOperServHelp(User * u)
59 {
60  if (is_services_root(u)) {
61  notice_lang(s_OperServ, u, OPER_HELP_CMD_MODUNLOAD);
62  }
63 }
64 
70 static int do_modunload(User * u)
71 {
72  char *name;
73 
74  name = strtok(NULL, "");
75  if (!name) {
76  syntax_error(s_OperServ, u, "MODUNLOAD",
77  OPER_MODULE_UNLOAD_SYNTAX);
78  return MOD_CONT;
79  }
80  if (!queueModuleUnload(name, u))
81  notice_lang(s_OperServ, u, OPER_MODULE_REMOVE_FAIL, name);
82 
83  return MOD_CONT;
84 }
MDE int queueModuleUnload(char *name, User *u)
Definition: modules.c:2822
static int do_modunload(User *u)
Definition: os_modunload.c:70
static void myOperServHelp(User *u)
Definition: os_modunload.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
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
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
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
void AnopeFini(void)
Definition: os_modunload.c:48
int AnopeInit(int argc, char **argv)
Definition: os_modunload.c:27
MDE int moduleAddCommand(CommandHash *cmdTable[], Command *c, int pos)
Definition: modules.c:1082
#define MOD_UNIQUE
Definition: module.h:11