Anope IRC Services  Version 1.8
os_reload.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_reload(User * u);
18 static void myOperServHelp(User * u);
19 
26 int AnopeInit(int argc, char **argv)
27 {
28  Command *c;
29 
30  moduleAddAuthor("Anope");
31  moduleAddVersion(VERSION_STRING);
33 
35  OPER_HELP_RELOAD, -1, -1, -1, -1);
37 
39 
40  return MOD_CONT;
41 }
42 
46 void AnopeFini(void)
47 {
48 
49 }
50 
51 
56 static void myOperServHelp(User * u)
57 {
58  if (is_services_root(u)) {
59  notice_lang(s_OperServ, u, OPER_HELP_CMD_RELOAD);
60  }
61 }
62 
68 static int do_reload(User * u)
69 {
70  if (!read_config(1)) {
71  quitmsg = calloc(28 + strlen(u->nick), 1);
72  if (!quitmsg)
73  quitmsg =
74  "Error during the reload of the configuration file, but out of memory!";
75  else
76  sprintf(quitmsg,
77  "Error during the reload of the configuration file!");
78  quitting = 1;
79  }
81  notice_lang(s_OperServ, u, OPER_RELOAD);
82  return MOD_CONT;
83 }
E char * quitmsg
Definition: extern.h:792
int AnopeInit(int argc, char **argv)
Definition: os_reload.c:26
char nick[NICKMAX]
Definition: services.h:875
E void send_event(const char *name, int argc,...)
Definition: events.c:37
#define EVENT_RELOAD
Definition: events.h:40
void AnopeFini(void)
Definition: os_reload.c:46
MDE void moduleAddAuthor(const char *author)
Definition: modules.c:1772
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
static int do_reload(User *u)
Definition: os_reload.c:68
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
#define EVENT_START
Definition: events.h:14
E int read_config(int reload)
Definition: config.c:894
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
E int quitting
Definition: extern.h:790
MDE int moduleAddCommand(CommandHash *cmdTable[], Command *c, int pos)
Definition: modules.c:1082
static void myOperServHelp(User *u)
Definition: os_reload.c:56
#define MOD_UNIQUE
Definition: module.h:11