Anope IRC Services  Version 1.8
ns_help.c
Go to the documentation of this file.
1 /* NickServ 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_help(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("HELP", do_help, NULL, -1, -1, -1, -1, -1);
35 
36  return MOD_CONT;
37 }
38 
42 void AnopeFini(void)
43 {
44 
45 }
46 
52 static int do_help(User * u)
53 {
54  char *cmd = strtok(NULL, "");
55 
56  if (!cmd) {
57  notice_help(s_NickServ, u, NICK_HELP);
58  moduleDisplayHelp(1, u);
59  if (is_services_admin(u)) {
60  notice_help(s_NickServ, u, NICK_SERVADMIN_HELP);
61  }
62  if (NSExpire >= 86400)
63  notice_help(s_NickServ, u, NICK_HELP_EXPIRES,
64  NSExpire / 86400);
65  notice_help(s_NickServ, u, NICK_HELP_FOOTER);
66  } else if (stricmp(cmd, "SET LANGUAGE") == 0) {
67  int i;
68  notice_help(s_NickServ, u, NICK_HELP_SET_LANGUAGE);
69  for (i = 0; i < NUM_LANGS && langlist[i] >= 0; i++)
70  notice_user(s_NickServ, u, " %2d) %s", i + 1,
71  langnames[langlist[i]]);
72  } else {
74  }
75  return MOD_CONT;
76 }
77 
78 /* EOF */
int AnopeInit(int argc, char **argv)
Definition: ns_help.c:25
MDE void mod_help_cmd(char *service, User *u, CommandHash *cmdTable[], const char *cmd)
Definition: commands.c:266
E int stricmp(const char *s1, const char *s2)
Definition: compat.c:58
E int NSExpire
Definition: extern.h:381
void AnopeFini(void)
Definition: ns_help.c:42
E void E void E void E void notice_user(char *source, User *u, const char *fmt,...) FORMAT(printf
E int langlist[NUM_LANGS]
Definition: extern.h:728
MDE void moduleAddAuthor(const char *author)
Definition: modules.c:1772
MDE void moduleSetType(MODType type)
Definition: modules.c:818
MDE void moduleAddVersion(const char *version)
Definition: modules.c:1760
MDE void moduleDisplayHelp(int service, User *u)
Definition: modules.c:2162
Command * c
Definition: ns_recover.c:17
E void notice_help(char *source, User *dest, int message,...)
Definition: send.c:220
#define MOD_CONT
Definition: modules.h:54
E int is_services_admin(User *u)
Definition: operserv.c:591
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 char * langnames[NUM_LANGS]
Definition: extern.h:727
static int do_help(User *u)
Definition: ns_help.c:52
E char * s_NickServ
Definition: extern.h:284
MDE int moduleAddCommand(CommandHash *cmdTable[], Command *c, int pos)
Definition: modules.c:1082
#define NICKSERV
Definition: modules.h:59
#define MOD_UNIQUE
Definition: module.h:11