From 2644f79301d3d66b0fcf6d5399520148a9860c27 Mon Sep 17 00:00:00 2001 From: "Robin Burchell w00t@inspircd.org" Date: Thu, 6 Nov 2008 21:45:10 +0000 Subject: Remove queueing on module load/unload, NOTE: don't try unload os_modunload, otherwise things probably won't go too well right now. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1564 5417fbe8-f217-4b02-8779-1006273d7864 --- src/core/os_modload.c | 32 ++++++++++++++++++++++++-------- src/core/os_modunload.c | 38 +++++++++++++++++++++++++++----------- 2 files changed, 51 insertions(+), 19 deletions(-) (limited to 'src/core') diff --git a/src/core/os_modload.c b/src/core/os_modload.c index 5e7aaebb1..4d876272f 100644 --- a/src/core/os_modload.c +++ b/src/core/os_modload.c @@ -55,15 +55,31 @@ void myOperServHelp(User * u) **/ int do_modload(User * u) { - char *name; + char *name; - name = strtok(NULL, ""); - if (!name) { - syntax_error(s_OperServ, u, "MODLOAD", OPER_MODULE_LOAD_SYNTAX); - return MOD_CONT; - } - if (!queueModuleLoad(name, u)) - notice_lang(s_OperServ, u, OPER_MODULE_LOAD_FAIL, name); + name = strtok(NULL, ""); + if (!name) + { + syntax_error(s_OperServ, u, "MODLOAD", OPER_MODULE_LOAD_SYNTAX); + return MOD_CONT; + } + + Module *m = findModule(name); + if (m) + { + notice_lang(s_OperServ, u, OPER_MODULE_LOAD_FAIL, name); + return MOD_CONT; + } + + m = createModule(name); + alog("Trying to load module [%s]", mod_operation_queue->m->name); + status = loadModule(mod_operation_queue->m, mod_operation_queue->u); + alog("Module loading status: %d (%s)", status, ModuleGetErrStr(status)); + if (status != MOD_ERR_OK) + { + notice_lang(s_OperServ, user, OPER_MODULE_LOAD_FAIL, m->name); + destroyModule(m); + } return MOD_CONT; } diff --git a/src/core/os_modunload.c b/src/core/os_modunload.c index 786e5914b..9adfbfd8d 100644 --- a/src/core/os_modunload.c +++ b/src/core/os_modunload.c @@ -54,20 +54,36 @@ void myOperServHelp(User * u) * @param u The user who issued the command * @param MOD_CONT to continue processing other modules, MOD_STOP to stop processing. **/ -int do_modunload(User * u) +int do_modunload(User *u) { - char *name; + char *name; + int status; - name = strtok(NULL, ""); - if (!name) { - syntax_error(s_OperServ, u, "MODUNLOAD", - OPER_MODULE_UNLOAD_SYNTAX); - return MOD_CONT; - } - if (!queueModuleUnload(name, u)) - notice_lang(s_OperServ, u, OPER_MODULE_REMOVE_FAIL, name); + name = strtok(NULL, ""); + if (!name) + { + syntax_error(s_OperServ, u, "MODUNLOAD", OPER_MODULE_UNLOAD_SYNTAX); + return MOD_CONT; + } + + Module *m = findModule(name); + if (!m) + { + syntax_error(s_OperServ, u, "MODUNLOAD", OPER_MODULE_UNLOAD_SYNTAX); + return MOD_CONT; + } + + alog("Trying to unload module [%s]", m->name); + + status = unloadModule(m, u); + + if (!status) + { + alog("Module unloading status: %d (%s)", status, ModuleGetErrStr(status)); + notice_lang(s_OperServ, u, OPER_MODULE_REMOVE_FAIL, name); + } - return MOD_CONT; + return MOD_CONT; } MODULE_INIT(OSModUnLoad) -- cgit