Anope IRC Services  Version 1.8
os_jupe.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 int do_jupe(User * u);
18 static void myOperServHelp(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("JUPE", do_jupe, is_services_admin, OPER_HELP_JUPE,
35  -1, -1, -1, -1);
37 
39 
40  return MOD_CONT;
41 }
42 
46 void AnopeFini(void)
47 {
48 
49 }
50 
51 
56 static void myOperServHelp(User * u)
57 {
58  if (is_services_admin(u)) {
59  notice_lang(s_OperServ, u, OPER_HELP_CMD_JUPE);
60  }
61 }
62 
68 static int do_jupe(User * u)
69 {
70  char *jserver = strtok(NULL, " ");
71  char *reason = strtok(NULL, "");
72 
73  if (!jserver) {
74  syntax_error(s_OperServ, u, "JUPE", OPER_JUPE_SYNTAX);
75  } else {
76  Server *server = findserver(servlist, jserver);
77  if (!isValidHost(jserver, 3)) {
78  notice_lang(s_OperServ, u, OPER_JUPE_HOST_ERROR);
79  } else if (server && ((server->flags & SERVER_ISME) || (server->flags & SERVER_ISUPLINK))) {
80  notice_lang(s_OperServ, u, OPER_JUPE_INVALID_SERVER);
81  } else {
82  anope_cmd_jupe(jserver, u->nick, reason);
83 
84  if (WallOSJupe)
85  anope_cmd_global(s_OperServ, "\2%s\2 used JUPE on \2%s\2",
86  u->nick, jserver);
87  }
88  }
89  return MOD_CONT;
90 }
static int do_jupe(User *u)
Definition: os_jupe.c:68
E int isValidHost(const char *host, int type)
Definition: misc.c:614
int AnopeInit(int argc, char **argv)
Definition: os_jupe.c:26
#define SERVER_ISUPLINK
Definition: services.h:867
char nick[NICKMAX]
Definition: services.h:875
static void myOperServHelp(User *u)
Definition: os_jupe.c:56
void AnopeFini(void)
Definition: os_jupe.c:46
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
E void notice_lang(char *source, User *dest, int message,...)
Definition: send.c:169
MDE void moduleSetType(MODType type)
Definition: modules.c:818
E int WallOSJupe
Definition: extern.h:459
#define OPERSERV
Definition: modules.h:62
E char * s_OperServ
Definition: extern.h:289
MDE void moduleAddVersion(const char *version)
Definition: modules.c:1760
Command * c
Definition: ns_recover.c:17
uint16 flags
Definition: services.h:857
MDE void moduleSetOperHelp(void(*func)(User *u))
Definition: modules.c:2126
#define MOD_CONT
Definition: modules.h:54
E Server * findserver(Server *s, const char *name)
Definition: servers.c:261
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 Server * servlist
Definition: extern.h:1051
#define SERVER_ISME
Definition: services.h:865
MDE int moduleAddCommand(CommandHash *cmdTable[], Command *c, int pos)
Definition: modules.c:1082
E void anope_cmd_jupe(char *jserver, char *who, char *reason)
Definition: ircd.c:656
#define MOD_UNIQUE
Definition: module.h:11
E void anope_cmd_global(char *source, const char *fmt,...)
Definition: ircd.c:506