DLLFUNC int MOD_INIT(m_gqline)(ModuleInfo *modinfo) { myinfo = modinfo; CmdGQLine = CommandAdd(myinfo->handle, MSG_GQLINE, TOK_GQLINE, m_gqline, 3, 0); if (!CmdGQLine) { config_error("m_gqline: Failed to add command /GQLINE : %s", ModuleGetErrorStr(myinfo->handle)); return MOD_FAILED; } CmdQLine = CommandAdd(myinfo->handle, MSG_QLINE, TOK_QLINE, m_qline, 3, 0); if (!CmdQLine) { CommandDel(CmdGQLine); config_error("m_gqline: Failed to add command /QLINE : %s", ModuleGetErrorStr(myinfo->handle)); return MOD_FAILED; } return MOD_SUCCESS; }
DLLFUNC int MOD_INIT(nocodeschmode)(ModuleInfo *modinfo) { CmodeInfo ModeNC; #ifndef STATIC_LINKING ModuleSetOptions(modinfo->handle, MOD_OPT_PERM); #endif memset(&ModeNoCodes, 0, sizeof ModeNoCodes); ModeNC.paracount = 0; ModeNC.is_ok = extcmode_default_requirechop; ModeNC.flag = FLAG_NOCODES; ModeNoCodes = CmodeAdd(modinfo->handle, ModeNC, &MODE_NOCODES); #ifndef STATIC_LINKING if (ModuleGetError(modinfo->handle) != MODERR_NOERROR || !ModeNoCodes) { config_error("Error adding channel mode +%c when loading module %s: %s", ModeNC.flag,MOD_HEADER(nocodeschmode).name,ModuleGetErrorStr(modinfo->handle)); } #else if (!ModeNoCodes) { config_error("Error adding channel mode +%c when loading module %s:", ModeNC.flag,MOD_HEADER(nocodeschmode).name); } #endif HookAddPCharEx(modinfo->handle, HOOKTYPE_CHANMSG, h_nocodes_chanmsg); return MOD_SUCCESS; }
static Command *AddCommand(Module *module, char *msg, char *token, iFP func) { Command *cmd; if (CommandExists(msg)) { config_error("Command %s already exists", msg); return NULL; } if (CommandExists(token)) { config_error("Token %s already exists", token); return NULL; } cmd = CommandAdd(module, msg, token, func, MAXPARA, 0); #ifndef STATIC_LINKING if (ModuleGetError(module) != MODERR_NOERROR || !cmd) #else if (!cmd) #endif { #ifndef STATIC_LINKING config_error("Error adding command %s: %s", msg, ModuleGetErrorStr(module)); #else config_error("Error adding command %s", msg); #endif return NULL; } return cmd; }
DLLFUNC int MOD_LOAD(delaylist)(int module_load) { delaylist_override = CmdoverrideAdd(delaylist_modinfo->handle, MSG_LIST, m_delaylist); if (!delaylist_override) { sendto_realops("delaylist: Failed to allocate override: %s", ModuleGetErrorStr(delaylist_modinfo->handle)); return MOD_FAILED; } return MOD_SUCCESS; }
DLLFUNC int MOD_LOAD(m_listreg)(int module_load) { listreg_override = CmdoverrideAdd(m_listreg_modinfo->handle, MSG_LIST, listreg); if (!listreg_override) { sendto_realops("m_listreg: Failed to allocate override: %s", ModuleGetErrorStr(m_listreg_modinfo->handle)); return MOD_FAILED; } return MOD_SUCCESS; }
DLLFUNC int MOD_INIT(m_rmtkl)(ModuleInfo *modinfo) { if (!CommandAdd(modinfo->handle, "RMTKL", NULL, m_rmtkl, 3, 0) || (ModuleGetError(modinfo->handle) != MODERR_NOERROR)) { config_error("Error adding command RMTKL: %s", ModuleGetErrorStr(modinfo->handle)); return MOD_FAILED; } return MOD_SUCCESS; }
DLLFUNC int MOD_INIT(m_privdeaf)(ModuleInfo *modinfo) { UmodePrivdeaf = UmodeAdd(modinfo->handle, 'D', UMODE_GLOBAL, umode_allow_all, &UMODE_PRIVDEAF); if (!UmodePrivdeaf) { /* I use config_error() here because it's printed to stderr in case of a load * on cmd line, and to all opers in case of a /rehash. */ config_error("m_privdeaf: Could not add usermode 'D': %s", ModuleGetErrorStr(modinfo->handle)); return MOD_FAILED; } CheckMsg = HookAddPCharEx(modinfo->handle, HOOKTYPE_USERMSG, privdeaf_checkmsg); /* Ah well.. we'll just go perm for now. */ ModuleSetOptions(modinfo->handle, MOD_OPT_PERM); return MOD_SUCCESS; }