Anope IRC Services  Version 1.8
hs_delall.c
Go to the documentation of this file.
1 /* HostServ 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_delall(User * u);
18 static void myHostServHelp(User * u);
19 
26 int AnopeInit(int argc, char **argv)
27 {
28  Command *c;
29 
30  moduleAddAuthor("Anope");
31  moduleAddVersion(VERSION_STRING);
33 
35  HOST_HELP_DELALL, -1, -1, -1, -1);
37 
39 
40  return MOD_CONT;
41 }
42 
46 void AnopeFini(void)
47 {
48 
49 }
50 
51 
52 
57 static void myHostServHelp(User * u)
58 {
59  if (is_host_remover(u)) {
60  notice_lang(s_HostServ, u, HOST_HELP_CMD_DELALL);
61  }
62 }
63 
69 static int do_delall(User * u)
70 {
71  int i;
72  char *nick = strtok(NULL, " ");
73  NickAlias *na;
74  NickCore *nc;
75  if (!nick) {
76  syntax_error(s_HostServ, u, "DELALL", HOST_DELALL_SYNTAX);
77  return MOD_CONT;
78  }
79  if ((na = findnick(nick))) {
80  if (na->status & NS_VERBOTEN) {
81  notice_lang(s_HostServ, u, NICK_X_FORBIDDEN, nick);
82  return MOD_CONT;
83  }
84  nc = na->nc;
85  for (i = 0; i < nc->aliases.count; i++) {
86  na = nc->aliases.list[i];
87  delHostCore(na->nick);
88  }
89  alog("vHosts for all nicks in group \002%s\002 deleted by oper \002%s\002", nc->display, u->nick);
90  notice_lang(s_HostServ, u, HOST_DELALL, nc->display);
91  } else {
92  notice_lang(s_HostServ, u, HOST_NOREG, nick);
93  }
94  return MOD_CONT;
95 }
char nick[NICKMAX]
Definition: services.h:875
E NickAlias * findnick(const char *nick)
Definition: db-merger.c:1857
static void myHostServHelp(User *u)
Definition: hs_delall.c:57
#define NS_VERBOTEN
Definition: services.h:1273
MDE void moduleAddAuthor(const char *author)
Definition: modules.c:1772
static int do_delall(User *u)
Definition: hs_delall.c:69
E void syntax_error(char *service, User *u, const char *command, int msgnum)
Definition: language.c:295
#define HOSTSERV
Definition: modules.h:56
E void notice_lang(char *source, User *dest, int message,...)
Definition: send.c:169
MDE void moduleSetType(MODType type)
Definition: modules.c:818
NickCore * nc
Definition: services.h:533
char * display
Definition: services.h:542
void ** list
Definition: slist.h:21
int16 count
Definition: slist.h:23
uint16 status
Definition: services.h:532
MDE void moduleAddVersion(const char *version)
Definition: modules.c:1760
Command * c
Definition: ns_recover.c:17
E void alog(const char *fmt,...) FORMAT(printf
#define MOD_CONT
Definition: modules.h:54
E void delHostCore(char *nick)
Definition: hostserv.c:345
E char * s_HostServ
Definition: extern.h:303
char * nick
Definition: services.h:526
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
SList aliases
Definition: services.h:559
void AnopeFini(void)
Definition: hs_delall.c:46
MDE int moduleAddCommand(CommandHash *cmdTable[], Command *c, int pos)
Definition: modules.c:1082
E int is_host_remover(User *u)
Definition: hostserv.c:639
MDE void moduleSetHostHelp(void(*func)(User *u))
Definition: modules.c:2138
int AnopeInit(int argc, char **argv)
Definition: hs_delall.c:26
#define MOD_UNIQUE
Definition: module.h:11