Anope IRC Services  Version 1.8
bs_fantasy_owner.c
Go to the documentation of this file.
1 /* BotServ core fantasy 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_fantasy(int argc, char **argv);
18 
25 int AnopeInit(int argc, char **argv)
26 {
27  EvtHook *hook;
28 
29  moduleAddAuthor("Anope");
31  (VERSION_STRING);
33 
35  moduleAddEventHook(hook);
36 
37  return MOD_CONT;
38 }
39 
43 void AnopeFini(void)
44 {
45 
46 }
47 
54 static int do_fantasy(int argc, char **argv)
55 {
56  User *u;
57  ChannelInfo *ci;
58 
59  if (argc < 3 || !ircd->owner)
60  return MOD_CONT;
61 
62  if (stricmp(argv[0], "deowner") == 0) {
63  u = finduser(argv[1]);
64  ci = cs_findchan(argv[2]);
65  if (!u || !ci)
66  return MOD_CONT;
67 
68  if (is_founder(u, ci))
69  bot_raw_mode(u, ci, ircd->ownerunset, u->nick);
70  } else if (stricmp(argv[0], "owner") == 0) {
71  u = finduser(argv[1]);
72  ci = cs_findchan(argv[2]);
73  if (!u || !ci)
74  return MOD_CONT;
75 
76  if (is_founder(u, ci))
77  bot_raw_mode(u, ci, ircd->ownerset, u->nick);
78  }
79 
80  return MOD_CONT;
81 }
char nick[NICKMAX]
Definition: services.h:875
char * ownerset
Definition: services.h:303
E IRCDVar * ircd
Definition: extern.h:39
E int stricmp(const char *s1, const char *s2)
Definition: compat.c:58
MDE void moduleAddAuthor(const char *author)
Definition: modules.c:1772
MDE void moduleSetType(MODType type)
Definition: modules.c:818
char * ownerunset
Definition: services.h:304
E User * finduser(const char *nick)
Definition: users.c:323
MDE void moduleAddVersion(const char *version)
Definition: modules.c:1760
MDE EvtHook * createEventHook(char *name, int(*func)(int argc, char **argv))
Definition: events.c:305
#define MOD_CONT
Definition: modules.h:54
E int is_founder(User *user, ChannelInfo *ci)
Definition: chanserv.c:2255
#define EVENT_BOT_FANTASY
Definition: events.h:24
void AnopeFini(void)
Definition: modules.h:99
E ChannelInfo * cs_findchan(const char *chan)
Definition: db-merger.c:2000
E void bot_raw_mode(User *requester, ChannelInfo *ci, char *mode, char *nick)
Definition: botserv.c:1048
int AnopeInit(int argc, char **argv)
static int do_fantasy(int argc, char **argv)
MDE int moduleAddEventHook(EvtHook *evh)
Definition: events.c:528