diff options
author | Adam <Adam@anope.org> | 2010-10-02 21:09:11 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-10-02 21:09:11 -0400 |
commit | 90f0a7c92ac34bc70c0905c20aaf3f7e8a85f289 (patch) | |
tree | a2bf75cc912ed3803157d10761dbea2c2475ffb1 /modules/core/os_modunload.cpp | |
parent | 0d684191e99a689c80560018dd52e6d8fd5dc549 (diff) |
Added os_modreload. Also allow unloading database and encryption modules since there isn't a reason we cant allow reloading them. Soon os_modreload will allow reloading the protocol modules.
Diffstat (limited to 'modules/core/os_modunload.cpp')
-rw-r--r-- | modules/core/os_modunload.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/modules/core/os_modunload.cpp b/modules/core/os_modunload.cpp index cf00676c4..f8bbe0461 100644 --- a/modules/core/os_modunload.cpp +++ b/modules/core/os_modunload.cpp @@ -23,7 +23,6 @@ class CommandOSModUnLoad : public Command CommandReturn Execute(User *u, const std::vector<Anope::string> ¶ms) { Anope::string mname = params[0]; - int status; Module *m = FindModule(mname); if (!m) @@ -31,12 +30,29 @@ class CommandOSModUnLoad : public Command u->SendMessage(OperServ, OPER_MODULE_ISNT_LOADED, mname.c_str()); return MOD_CONT; } + + if (!m->handle) + { + u->SendMessage(OperServ, OPER_MODULE_REMOVE_FAIL, m->name.c_str()); + return MOD_CONT; + } + + if (m->GetPermanent() || m->type == PROTOCOL) + { + u->SendMessage(OperServ, OPER_MODULE_NO_UNLOAD); + return MOD_CONT; + } Log() << "Trying to unload module [" << mname << "]"; - status = ModuleManager::UnloadModule(m, u); + ModuleReturn status = ModuleManager::UnloadModule(m, u); - if (status != MOD_ERR_OK) + if (status == MOD_ERR_OK) + { + u->SendMessage(OperServ, OPER_MODULE_UNLOADED, mname.c_str()); + ircdproto->SendGlobops(OperServ, "%s unloaded module %s", u->nick.c_str(), mname.c_str()); + } + else u->SendMessage(OperServ, OPER_MODULE_REMOVE_FAIL, mname.c_str()); return MOD_CONT; |