/* * only opers and ulines are allowed to create new channels * "normal" users can only join if someone other is in the channel * should only be used for closed networks * * */ #include "config.h" #include "struct.h" #include "common.h" #include "sys.h" #include "numeric.h" #include "msg.h" #include "channel.h" #include #include #include #include #include #include #include "h.h" #define DelHook(x) if (x) HookDel(x); x = NULL extern aChannel *get_channel(aClient *, char *, int); static int cb_join(aClient *sptr, aChannel *chptr, char *parv[]); Hook *HookJoin = NULL; ModuleHeader MOD_HEADER(operjoin) = { "m_onlyopersjoin", "$Id: m_onlyopersjoin.c,v 1.0 2004/11/21 21:11:00 DukePyrolator Exp $", "only opers may join/create new channels", "3.2-b8-1", NULL }; DLLFUNC int MOD_INIT(onlyopersjoin)(ModuleInfo *modinfo) { HookJoin = HookAddEx(modinfo->handle, HOOKTYPE_PRE_LOCAL_JOIN, cb_join); return MOD_SUCCESS; } DLLFUNC int MOD_LOAD(onlyopersjoin)(int module_load) { return MOD_SUCCESS; } DLLFUNC int MOD_UNLOAD(operjoin)(int module_unload) { DelHook(HookJoin); return MOD_SUCCESS; } static int cb_join(aClient *sptr, aChannel *chptr, char *parv[]) { if (chptr->users >= 1) return HOOK_CONTINUE; if (IsOper(sptr)) return HOOK_CONTINUE; if (IsULine(sptr)) return HOOK_CONTINUE; sendto_one(sptr, ":%s 477 %s %s :Sorry, only Opers may create channels.", me.name, sptr->name, chptr->chname); return HOOK_DENY; }