Anope IRC Services  Version 1.8
hs_del.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_del(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 
34  c = createCommand("DEL", do_del, is_host_remover, HOST_HELP_DEL, -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 myHostServHelp(User * u)
58 {
59  if (is_host_remover(u)) {
60  notice_lang(s_HostServ, u, HOST_HELP_CMD_DEL);
61  }
62 }
63 
69 static int do_del(User * u)
70 {
71  NickAlias *na;
72  char *nick = strtok(NULL, " ");
73  if (nick) {
74  if ((na = findnick(nick))) {
75  if (na->status & NS_VERBOTEN) {
76  notice_lang(s_HostServ, u, NICK_X_FORBIDDEN, nick);
77  return MOD_CONT;
78  }
79  alog("vHost for user \002%s\002 deleted by oper \002%s\002",
80  nick, u->nick);
81  delHostCore(nick);
82  notice_lang(s_HostServ, u, HOST_DEL, nick);
83  } else {
84  notice_lang(s_HostServ, u, HOST_NOREG, nick);
85  }
86  } else {
87  syntax_error(s_HostServ, u, "DEL", HOST_DEL_SYNTAX);
88  }
89  return MOD_CONT;
90 }
char nick[NICKMAX]
Definition: services.h:875
static int do_del(User *u)
Definition: hs_del.c:69
E NickAlias * findnick(const char *nick)
Definition: db-merger.c:1857
#define NS_VERBOTEN
Definition: services.h:1273
MDE void moduleAddAuthor(const char *author)
Definition: modules.c:1772
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
void AnopeFini(void)
Definition: hs_del.c:46
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
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
static void myHostServHelp(User *u)
Definition: hs_del.c:57
int AnopeInit(int argc, char **argv)
Definition: hs_del.c:26
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
#define MOD_UNIQUE
Definition: module.h:11