#include "module.h" #define AUTHOR "DukePyrolator" #define VERSION "1.0" #define HELPCHANNEL "#help" int do_fantasy(int ac, char **av); int valid_ircd(void); int AnopeInit(int argc, char **argv) { EvtHook *hook; alog("[\002cs_helpjoin\002] Loading module ..."); if (!valid_ircd()) { alog("[\002cs_helpjoin\002] ERROR: IRCd not supported by this module."); alog("[\002cs_helpjoin\002] Unloading module..."); return MOD_STOP; } hook = createEventHook(EVENT_BOT_FANTASY, do_fantasy); if (moduleAddEventHook(hook) != MOD_ERR_OK) { alog("[\002cs_helpjoin\002] Can't hook to EVENT_BOT_FANTASY event"); return MOD_STOP; } hook = createEventHook(EVENT_BOT_FANTASY_NO_ACCESS, do_fantasy); if (moduleAddEventHook(hook) != MOD_ERR_OK) { alog("[\002cs_helpjoin\002] Can't hook to EVENT_BOT_FANTASY_NO_ACCESS event"); return MOD_STOP; } moduleAddAuthor(AUTHOR); moduleAddVersion(VERSION); alog("[\002cs_helpjoin\002] Module loaded successfully..."); return MOD_CONT; } void AnopeFini(void) { alog("[\002cs_helpjoin\002] Unloading module..."); } int do_fantasy(int ac, char **av) { User *u; struct c_userlist *ul; ChannelInfo *ci; Channel *c, *hc; if (ac < 3) return MOD_CONT; if (!(ci = cs_findchan(av[2]))) return MOD_CONT; if (!(u = finduser(av[1]))) return MOD_CONT; if (!(c = findchan(ci->name))) return MOD_CONT; if (!stricmp(ci->name, HELPCHANNEL)) return MOD_CONT; if (!stricmp(av[0], "help")) { if ((hc = findchan(HELPCHANNEL))) { for (ul = c->users; ul; ul = ul->next) { if (ul->user == u) return MOD_CONT; } } anope_cmd_svsjoin(s_OperServ, u->nick, HELPCHANNEL, NULL); } return MOD_CONT; } int valid_ircd(void) { if (!stricmp(IRCDModule, "unreal32")) return 1; if (!stricmp(IRCDModule, "viagra")) return 1; if (!stricmp(IRCDModule, "ptlink")) return 1; if (!stricmp(IRCDModule, "ultimate2")) return 1; if (!stricmp(IRCDModule, "ultimate3")) return 1; if (!stricmp(IRCDModule, "plexus3")) return 1; if (!stricmp(IRCDModule, "inspircd11")) return 1; if (!stricmp(IRCDModule, "inspircd12")) return 1; if (!stricmp(IRCDModule, "inspircd20")) return 1; return 0; }