Anope IRC Services  Version 1.8
os_logonnews.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 void myOperServHelp(User * u);
18 static int reload_config(int argc, char **argv);
19 
26 int AnopeInit(int argc, char **argv)
27 {
28  Command *c;
29  EvtHook *hook;
30 
31  moduleAddAuthor("Anope");
32  moduleAddVersion(VERSION_STRING);
34 
40  NEWS_HELP_LOGON, -1, -1, -1, -1);
41  c->help_param1 = (char *) (long) NewsCount;
43 
45 
47  if (moduleAddEventHook(hook) != MOD_ERR_OK) {
48  alog("[\002os_logonnews\002] Can't hook to EVENT_RELOAD event");
49  return MOD_STOP;
50  }
51 
52  return MOD_CONT;
53 }
54 
58 void AnopeFini(void)
59 {
60 }
61 
62 
67 static void myOperServHelp(User * u)
68 {
69  if (is_services_admin(u)) {
70  notice_lang(s_OperServ, u, OPER_HELP_CMD_LOGONNEWS);
71  }
72 }
73 
74 
78 static int reload_config(int argc, char **argv) {
79  Command *c;
80 
81  if (argc >= 1 && !stricmp(argv[0], EVENT_START))
82  if ((c = findCommand(OPERSERV, "LOGONNEWS")))
83  c->help_param1 = (char *) (long) NewsCount;
84 
85  return MOD_CONT;
86 }
87 
88 /* EOF */
E int stricmp(const char *s1, const char *s2)
Definition: compat.c:58
#define EVENT_RELOAD
Definition: events.h:40
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
char * help_param1
Definition: modules.h:187
#define OPERSERV
Definition: modules.h:62
E char * s_OperServ
Definition: extern.h:289
#define MOD_STOP
Definition: modules.h:53
MDE void moduleAddVersion(const char *version)
Definition: modules.c:1760
E int do_logonnews(User *u)
Definition: news.c:336
MDE EvtHook * createEventHook(char *name, int(*func)(int argc, char **argv))
Definition: events.c:305
Command * c
Definition: ns_recover.c:17
E void alog(const char *fmt,...) FORMAT(printf
#define MOD_ERR_OK
Definition: modules.h:71
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 is_services_admin(User *u)
Definition: operserv.c:591
MDE Command * findCommand(CommandHash *cmdTable[], const char *name)
Definition: modules.c:1442
static int reload_config(int argc, char **argv)
Definition: os_logonnews.c:78
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 NewsCount
Definition: extern.h:361
int AnopeInit(int argc, char **argv)
Definition: os_logonnews.c:26
MDE int moduleAddCommand(CommandHash *cmdTable[], Command *c, int pos)
Definition: modules.c:1082
void AnopeFini(void)
Definition: os_logonnews.c:58
MDE int moduleAddEventHook(EvtHook *evh)
Definition: events.c:528
#define MOD_UNIQUE
Definition: module.h:11
static void myOperServHelp(User *u)
Definition: os_logonnews.c:67