summaryrefslogtreecommitdiff
path: root/src/modules/m_globalload.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-14 22:12:55 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-14 22:12:55 +0000
commitdbf4d595433ecefeb61f1267ffa515a91c3ab548 (patch)
tree0e85976e4cd0b77a8fb54a6df54dee94265ac75c /src/modules/m_globalload.cpp
parent9c9386d71e1b317fa39cc251eb6450e14ec5929f (diff)
Fix module unmapping with culled Module objects
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11875 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_globalload.cpp')
-rw-r--r--src/modules/m_globalload.cpp34
1 files changed, 13 insertions, 21 deletions
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> &parameters, 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);
}
};