Anope IRC Services  Version 1.8
ns_update.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_nickupdate(User * u);
18 static void myNickServHelp(User * u);
19 
26 int AnopeInit(int argc, char **argv)
27 {
28  Command *c;
29 
30  moduleAddAuthor("Anope");
31  moduleAddVersion(VERSION_STRING);
33 
34  c = createCommand("UPDATE", do_nickupdate, NULL, NICK_HELP_UPDATE, -1,
35  -1, -1, -1);
37 
39 
40  return MOD_CONT;
41 }
42 
46 void AnopeFini(void)
47 {
48 
49 }
50 
51 
52 
57 static void myNickServHelp(User * u)
58 {
59  notice_lang(s_NickServ, u, NICK_HELP_CMD_UPDATE);
60 }
61 
67 static int do_nickupdate(User * u)
68 {
69  NickAlias *na;
70 
71  if (!nick_identified(u)) {
72  notice_lang(s_NickServ, u, NICK_IDENTIFY_REQUIRED, s_NickServ);
73  } else {
74  na = u->na;
75  do_setmodes(u);
76  check_memos(u);
77  if (na->last_realname)
78  free(na->last_realname);
79  na->last_realname = sstrdup(u->realname);
80  na->status |= NS_IDENTIFIED;
81  na->last_seen = time(NULL);
82  if (ircd->vhost) {
83  do_on_id(u);
84  }
85  notice_lang(s_NickServ, u, NICK_UPDATE_SUCCESS, s_NickServ);
86  }
87  return MOD_CONT;
88 }
E IRCDVar * ircd
Definition: extern.h:39
E int nick_identified(User *u)
Definition: nickserv.c:1111
int vhost
Definition: services.h:301
E void check_memos(User *u)
Definition: memoserv.c:86
int AnopeInit(int argc, char **argv)
Definition: ns_update.c:26
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 char * sstrdup(const char *s)
Definition: memory.c:105
E int do_setmodes(User *u)
Definition: nickserv.c:1940
uint16 status
Definition: services.h:532
E int do_on_id(User *u)
Definition: hostserv.c:582
MDE void moduleAddVersion(const char *version)
Definition: modules.c:1760
Command * c
Definition: ns_recover.c:17
#define MOD_CONT
Definition: modules.h:54
void AnopeFini(void)
Definition: ns_update.c:46
char * last_realname
Definition: services.h:528
MDE void moduleSetNickHelp(void(*func)(User *u))
Definition: modules.c:2078
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
#define NS_IDENTIFIED
Definition: services.h:1275
static void myNickServHelp(User *u)
Definition: ns_update.c:57
time_t last_seen
Definition: services.h:531
E char * s_NickServ
Definition: extern.h:284
MDE int moduleAddCommand(CommandHash *cmdTable[], Command *c, int pos)
Definition: modules.c:1082
static int do_nickupdate(User *u)
Definition: ns_update.c:67
#define NICKSERV
Definition: modules.h:59
char * realname
Definition: services.h:883
NickAlias * na
Definition: services.h:892
#define MOD_UNIQUE
Definition: module.h:11