/* after registering a new channel, this module assigns a pre-defined botserv bot to the new channel and make it join */ /* the module was requested by Nentindo2005 in the #anope chatrom on 30. dezember 2008, 06:45 AM - i finished the module 07:15 AM (my first module after 2 or 3 years of pause) */ */ #include "module.h" #define AUTHOR "Jens 'DukePyrolator' Voss" #define VERSION "1.0 stable" #define BotName "ServicesBot" int join_botserv(int argc, char **argv); int AnopeInit(int argc, char **argv) { EvtHook *hook = NULL; int status; hook = createEventHook(EVENT_CHAN_REGISTERED, join_botserv); status = moduleAddEventHook(hook); moduleAddAuthor(AUTHOR); moduleAddVersion(VERSION); return MOD_CONT; } int join_botserv(int argc, char **argv) { ChannelInfo *ci; BotInfo *bi; ci = cs_findchan(argv[0]); /* find channel information */ bi = findbot(BotName); /* find bot */ if ( ci && bi ) { /* are channel and bot existent? */ ci->bi = bi; /* assign the bot to the channel */ bi->chancount++; /* increase the chancount by 1 */ bot_join(ci); /* lets the bot join the channel and set modes */ } return MOD_CONT; }