diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/extra/m_pgsql.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_filter.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_globalload.cpp | 34 | ||||
-rw-r--r-- | src/modules/m_password_hash.cpp | 3 | ||||
-rw-r--r-- | src/modules/m_rline.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 6 | ||||
-rw-r--r-- | src/modules/m_sqllog.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_sqloper.cpp | 5 |
9 files changed, 31 insertions, 41 deletions
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index df0ca7f42..8e37e0dea 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -930,7 +930,7 @@ class ModulePgSQL : public Module } } - virtual void OnUnloadModule(Module* mod, const std::string& name) + virtual void OnUnloadModule(Module* mod) { /* When a module unloads we have to check all the pending queries for all our connections * and set the Module* specifying where the query came from to NULL. If the query has already diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index 5beb46fc4..3f95f02c9 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -145,7 +145,7 @@ protected: virtual ModResult OnStats(char symbol, User* user, string_list &results) = 0; virtual ModResult OnPreCommand(std::string &command, std::vector<std::string> ¶meters, User *user, bool validated, const std::string &original_line); bool AppliesToMe(User* user, FilterResult* filter, int flags); - void OnLoadModule(Module* mod, const std::string& name); + void OnLoadModule(Module* mod); virtual void ReadFilters(ConfigReader &MyConf) = 0; }; @@ -456,7 +456,7 @@ void FilterBase::OnRehash(User* user) } } -void FilterBase::OnLoadModule(Module* mod, const std::string& name) +void FilterBase::OnLoadModule(Module* mod) { if (ServerInstance->Modules->ModuleHasInterface(mod, "RegularExpression")) { diff --git a/src/modules/m_globalload.cpp b/src/modules/m_globalload.cpp index 636b9f4e4..50032919a 100644 --- a/src/modules/m_globalload.cpp +++ b/src/modules/m_globalload.cpp @@ -22,7 +22,8 @@ class CommandGloadmodule : public Command public: CommandGloadmodule(Module* Creator) : Command(Creator,"GLOADMODULE", 1) { - flags_needed = 'o'; syntax = "<modulename> [servermask]"; + flags_needed = 'o'; + syntax = "<modulename> [servermask]"; TRANSLATE3(TR_TEXT, TR_TEXT, TR_END); } @@ -61,7 +62,8 @@ class CommandGunloadmodule : public Command public: CommandGunloadmodule(Module* Creator) : Command(Creator,"GUNLOADMODULE", 1) { - flags_needed = 'o'; syntax = "<modulename> [servermask]"; + flags_needed = 'o'; + syntax = "<modulename> [servermask]"; } CmdResult Handle (const std::vector<std::string> ¶meters, User *user) @@ -70,10 +72,12 @@ class CommandGunloadmodule : public Command if (InspIRCd::Match(ServerInstance->Config->ServerName.c_str(), servername)) { - if (ServerInstance->Modules->Unload(parameters[0].c_str())) + Module* m = ServerInstance->Modules->Find(parameters[0]); + if (m && ServerInstance->Modules->Unload(m)) { ServerInstance->SNO->WriteToSnoMask('a', "MODULE '%s' GLOBALLY UNLOADED BY '%s'",parameters[0].c_str(), user->nick.c_str()); - user->WriteNumeric(973, "%s %s :Module successfully unloaded.",user->nick.c_str(), parameters[0].c_str()); + ServerInstance->DumpText(user, ":%s 973 %s %s :Module successfully unloaded.", + ServerInstance->Config->ServerName.c_str(), user->nick.c_str(), parameters[0].c_str()); } else { @@ -108,20 +112,8 @@ class CommandGreloadmodule : public Command if (InspIRCd::Match(ServerInstance->Config->ServerName.c_str(), servername)) { - bool ok = true; - if (!ServerInstance->Modules->Unload(parameters[0].c_str())) - { - ok = false; - user->WriteNumeric(972, "%s %s :%s",user->nick.c_str(), parameters[0].c_str(), ServerInstance->Modules->LastError().c_str()); - } - if (!ServerInstance->Modules->Load(parameters[0].c_str())) - { - ok = false; - user->WriteNumeric(974, "%s %s :%s",user->nick.c_str(), parameters[0].c_str(), ServerInstance->Modules->LastError().c_str()); - } - ServerInstance->SNO->WriteToSnoMask('a', "MODULE '%s' GLOBALLY RELOADED BY '%s'",parameters[0].c_str(), user->nick.c_str()); - if (ok) - user->WriteNumeric(975, "%s %s :Module successfully loaded.",user->nick.c_str(), parameters[0].c_str()); + Module* m = ServerInstance->Modules->Find(parameters[0]); + ServerInstance->Modules->Reload(m, NULL); } else ServerInstance->SNO->WriteToSnoMask('a', "MODULE '%s' GLOBAL RELOAD BY '%s' (not reloaded here)",parameters[0].c_str(), user->nick.c_str()); @@ -150,13 +142,13 @@ class ModuleGlobalLoad : public Module ServerInstance->AddCommand(&cmd3); } - virtual ~ModuleGlobalLoad() + ~ModuleGlobalLoad() { } - virtual Version GetVersion() + Version GetVersion() { - return Version("Allows global loading of a module.", VF_COMMON | VF_VENDOR, API_VERSION); + return Version("Allows global loading of a module.", VF_COMMON | VF_VENDOR); } }; diff --git a/src/modules/m_password_hash.cpp b/src/modules/m_password_hash.cpp index afc6cdd79..af6256a1c 100644 --- a/src/modules/m_password_hash.cpp +++ b/src/modules/m_password_hash.cpp @@ -114,11 +114,10 @@ class ModuleOperHash : public Module } - virtual void OnLoadModule(Module* mod, const std::string& name) + virtual void OnLoadModule(Module* mod) { if (ServerInstance->Modules->ModuleHasInterface(mod, "HashRequest")) { - ServerInstance->Logs->Log("m_password-hash",DEBUG, "Post-load registering hasher: %s", name.c_str()); std::string sname = HashNameRequest(this, mod).response; hashers[sname.c_str()] = mod; names.push_back(sname); diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index a1a57199a..df5fca504 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -290,7 +290,7 @@ class ModuleRLine : public Module return MOD_RES_DENY; } - virtual void OnLoadModule(Module* mod, const std::string& name) + virtual void OnLoadModule(Module* mod) { if (ServerInstance->Modules->ModuleHasInterface(mod, "RegularExpression")) { diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 9c0997d7c..afd40e0c9 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -772,17 +772,17 @@ void ModuleSpanningTree::OnRehash(User* user) Utils->ReadConfiguration(true); } -void ModuleSpanningTree::OnLoadModule(Module* mod, const std::string &name) +void ModuleSpanningTree::OnLoadModule(Module* mod) { - this->RedoConfig(mod, name); + this->RedoConfig(mod); } -void ModuleSpanningTree::OnUnloadModule(Module* mod, const std::string &name) +void ModuleSpanningTree::OnUnloadModule(Module* mod) { - this->RedoConfig(mod, name); + this->RedoConfig(mod); } -void ModuleSpanningTree::RedoConfig(Module* mod, const std::string &name) +void ModuleSpanningTree::RedoConfig(Module* mod) { /* If m_sha256.so is loaded (we use this for HMAC) or any module implementing a BufferedSocket interface is loaded, * then we need to re-read our config again taking this into account. @@ -794,7 +794,7 @@ void ModuleSpanningTree::RedoConfig(Module* mod, const std::string &name) if (ml && std::find(ml->begin(), ml->end(), mod) != ml->end()) IsBufferSocketModule = true; - if (name == "m_sha256.so" || IsBufferSocketModule) + if (mod->ModuleSourceFile == "m_sha256.so" || IsBufferSocketModule) { Utils->ReadConfiguration(true); } diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 66b396171..be9c460d9 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -49,7 +49,7 @@ class ModuleSpanningTree : public Module CommandRSQuit* command_rsquit; SpanningTreeUtilities* Utils; - void RedoConfig(Module* mod, const std::string &name); + void RedoConfig(Module* mod); public: CacheRefreshTimer *RefreshTimer; @@ -188,8 +188,8 @@ class ModuleSpanningTree : public Module ModResult OnSetAway(User* user, const std::string &awaymsg); void ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const std::vector<std::string> &modeline, const std::vector<TranslateType> &translate); void ProtoSendMetaData(void* opaque, Extensible* target, const std::string &extname, const std::string &extdata); - void OnLoadModule(Module* mod,const std::string &name); - void OnUnloadModule(Module* mod,const std::string &name); + void OnLoadModule(Module* mod); + void OnUnloadModule(Module* mod); bool cull(); ~ModuleSpanningTree(); Version GetVersion(); diff --git a/src/modules/m_sqllog.cpp b/src/modules/m_sqllog.cpp index f1174b0ce..9b019f931 100644 --- a/src/modules/m_sqllog.cpp +++ b/src/modules/m_sqllog.cpp @@ -258,9 +258,9 @@ class ModuleSQLLog : public Module AddLogEntry(LT_DISCONNECT,user->nick,user->host,user->server); } - virtual void OnLoadModule(Module* mod, const std::string &name) + virtual void OnLoadModule(Module* mod) { - AddLogEntry(LT_LOADMODULE,name,ServerInstance->Config->ServerName.c_str(), ServerInstance->Config->ServerName.c_str()); + AddLogEntry(LT_LOADMODULE,mod->ModuleSourceFile,ServerInstance->Config->ServerName.c_str(), ServerInstance->Config->ServerName.c_str()); } virtual Version GetVersion() diff --git a/src/modules/m_sqloper.cpp b/src/modules/m_sqloper.cpp index cf5bb3da5..c4eaa6911 100644 --- a/src/modules/m_sqloper.cpp +++ b/src/modules/m_sqloper.cpp @@ -87,11 +87,10 @@ public: return false; } - virtual void OnLoadModule(Module* mod, const std::string& name) + virtual void OnLoadModule(Module* mod) { if (ServerInstance->Modules->ModuleHasInterface(mod, "HashRequest")) { - ServerInstance->Logs->Log("m_sqloper",DEBUG, "Post-load registering hasher: %s", name.c_str()); std::string sname = HashNameRequest(this, mod).response; hashers[sname.c_str()] = mod; names.push_back(sname); @@ -303,7 +302,7 @@ public: Version GetVersion() { - return Version("Allows storage of oper credentials in an SQL table", VF_VENDOR, API_VERSION); + return Version("Allows storage of oper credentials in an SQL table", VF_VENDOR); } }; |