bs_fantasy.c

Go to the documentation of this file.
00001 /* BotServ core fantasy functions
00002  *
00003  * (C) 2003-2007 Anope Team
00004  * Contact us at info@anope.org
00005  *
00006  * Please read COPYING and README for further details.
00007  *
00008  * Based on the original code of Epona by Lara.
00009  * Based on the original code of Services by Andy Church. 
00010  * 
00011  * $Id: bs_fantasy.c 1265 2007-08-26 15:33:06Z geniusdex $
00012  *
00013  */
00014 /*************************************************************************/
00015 
00016 #include "module.h"
00017 
00018 int do_fantasy(int argc, char **argv);
00019 
00026 int AnopeInit(int argc, char **argv)
00027 {
00028     EvtHook *hook;
00029 
00030     moduleAddAuthor("Anope");
00031     moduleAddVersion("$Id: bs_fantasy.c 1265 2007-08-26 15:33:06Z geniusdex $");
00032     moduleSetType(CORE);
00033     hook = createEventHook(EVENT_BOT_FANTASY, do_fantasy);
00034     moduleAddEventHook(hook);
00035 
00036     return MOD_CONT;
00037 }
00038 
00042 void AnopeFini(void)
00043 {
00044 
00045 }
00046 
00053 int do_fantasy(int argc, char **argv)
00054 {
00055     User *u;
00056     ChannelInfo *ci;
00057     CSModeUtil *util = csmodeutils;
00058     char *target;
00059 
00060     if (argc < 3)
00061         return MOD_CONT;
00062 
00063     do {
00064         if (stricmp(argv[0], util->bsname) == 0) {
00065             /* This could have been moved to its own module
00066                however it would require more coding to handle the pass holders
00067                similar to how PROTECT is done 
00068             */
00069             if (!ircd->halfop) {
00070                 if (!stricmp(argv[0], "halfop") || !stricmp(argv[0], "dehalfop")) {
00071                     return MOD_CONT;
00072                 }
00073             }
00074             u = finduser(argv[1]);
00075             ci = cs_findchan(argv[2]);
00076             if (!u || !ci)
00077                 return MOD_CONT;
00078 
00079             target = ((argc == 4) ? argv[3] : NULL);
00080 
00081             if (!target && check_access(u, ci, util->levelself))
00082                 bot_raw_mode(u, ci, util->mode, u->nick);
00083             else if (target && check_access(u, ci, util->level))
00084                 bot_raw_mode(u, ci, util->mode, target);
00085         }
00086     } while ((++util)->name != NULL);
00087 
00088     return MOD_CONT;
00089 }

Generated on Sun Dec 30 09:26:46 2007 for Anope by  doxygen 1.5.1-20070107