]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Improve the messages sent when loading/unloading/reloading modules.
authorSadie Powell <sadie@witchery.services>
Mon, 19 Apr 2021 18:58:03 +0000 (19:58 +0100)
committerSadie Powell <sadie@witchery.services>
Mon, 19 Apr 2021 18:59:41 +0000 (19:59 +0100)
src/configreader.cpp
src/coremods/core_reloadmodule.cpp
src/modules.cpp
src/modules/m_globalload.cpp

index 381d28d1b37aef135ebba3ceacf2283c7d2a19bf..2d3ecc3dead9b4848ef87c01ce98c4c0d37186f8 100644 (file)
@@ -607,16 +607,16 @@ void ServerConfig::ApplyModules(User* user)
                        ServerInstance->SNO->WriteGlobalSno('a', "*** REHASH UNLOADED MODULE: %s", modname.c_str());
 
                        if (user)
-                               user->WriteNumeric(RPL_UNLOADEDMODULE, modname, InspIRCd::Format("Module %s successfully unloaded.", modname.c_str()));
+                               user->WriteNumeric(RPL_UNLOADEDMODULE, modname, InspIRCd::Format("The %s module was unloaded.", modname.c_str()));
                        else
-                               ServerInstance->SNO->WriteGlobalSno('a', "Module %s successfully unloaded.", modname.c_str());
+                               ServerInstance->SNO->WriteGlobalSno('a', "The %s module was unloaded.", modname.c_str());
                }
                else
                {
                        if (user)
-                               user->WriteNumeric(ERR_CANTUNLOADMODULE, modname, InspIRCd::Format("Failed to unload module %s: %s", modname.c_str(), ServerInstance->Modules->LastError().c_str()));
+                               user->WriteNumeric(ERR_CANTUNLOADMODULE, modname, InspIRCd::Format("Failed to unload the %s module: %s", modname.c_str(), ServerInstance->Modules->LastError().c_str()));
                        else
-                               ServerInstance->SNO->WriteGlobalSno('a', "Failed to unload module %s: %s", modname.c_str(), ServerInstance->Modules->LastError().c_str());
+                               ServerInstance->SNO->WriteGlobalSno('a', "Failed to unload the %s module: %s", modname.c_str(), ServerInstance->Modules->LastError().c_str());
                }
        }
 
@@ -630,16 +630,16 @@ void ServerConfig::ApplyModules(User* user)
                {
                        ServerInstance->SNO->WriteGlobalSno('a', "*** REHASH LOADED MODULE: %s",adding->c_str());
                        if (user)
-                               user->WriteNumeric(RPL_LOADEDMODULE, *adding, InspIRCd::Format("Module %s successfully loaded.", adding->c_str()));
+                               user->WriteNumeric(RPL_LOADEDMODULE, *adding, InspIRCd::Format("The %s module was loaded.", adding->c_str()));
                        else
-                               ServerInstance->SNO->WriteGlobalSno('a', "Module %s successfully loaded.", adding->c_str());
+                               ServerInstance->SNO->WriteGlobalSno('a', "The %s module was loaded.", adding->c_str());
                }
                else
                {
                        if (user)
-                               user->WriteNumeric(ERR_CANTLOADMODULE, *adding, InspIRCd::Format("Failed to load module %s: %s", adding->c_str(), ServerInstance->Modules->LastError().c_str()));
+                               user->WriteNumeric(ERR_CANTLOADMODULE, *adding, InspIRCd::Format("Failed to load the %s module: %s", adding->c_str(), ServerInstance->Modules->LastError().c_str()));
                        else
-                               ServerInstance->SNO->WriteGlobalSno('a', "Failed to load module %s: %s", adding->c_str(), ServerInstance->Modules->LastError().c_str());
+                               ServerInstance->SNO->WriteGlobalSno('a', "Failed to load the %s module: %s", adding->c_str(), ServerInstance->Modules->LastError().c_str());
                }
        }
 }
index ef0b139629aa556989ba94b6817651af6bff8c7b..f3299db906165db4be25f27d0b40dea56d59a1a7 100644 (file)
@@ -729,16 +729,21 @@ class ReloadAction : public ActionBase
                {
                        Module* newmod = ServerInstance->Modules->Find(name);
                        datakeeper.Restore(newmod);
+                       ServerInstance->SNO->WriteGlobalSno('a', "The %s module was reloaded.", passedname.c_str());
                }
                else
+               {
                        datakeeper.Fail();
+                       ServerInstance->SNO->WriteGlobalSno('a', "Failed to reload the %s module.", passedname.c_str());
+               }
 
-               ServerInstance->SNO->WriteGlobalSno('a', "RELOAD MODULE: %s %ssuccessfully reloaded", passedname.c_str(), result ? "" : "un");
                User* user = ServerInstance->FindUUID(uuid);
                if (user)
                {
-                       int numeric = result ? RPL_LOADEDMODULE : ERR_CANTUNLOADMODULE;
-                       user->WriteNumeric(numeric, passedname, InspIRCd::Format("Module %ssuccessfully reloaded.", (result ? "" : "un")));
+                       if (result)
+                               user->WriteNumeric(RPL_LOADEDMODULE, passedname, InspIRCd::Format("The %s module was reloaded.", passedname.c_str()));
+                       else
+                               user->WriteNumeric(ERR_CANTUNLOADMODULE, passedname, InspIRCd::Format("Failed to reload the %s module.", passedname.c_str()));
                }
 
                ServerInstance->GlobalCulls.AddItem(this);
@@ -764,7 +769,7 @@ CmdResult CommandReloadmodule::Handle(User* user, const Params& parameters)
        }
        else
        {
-               user->WriteNumeric(ERR_CANTUNLOADMODULE, parameters[0], "Could not find module by that name");
+               user->WriteNumeric(ERR_CANTUNLOADMODULE, parameters[0], "Could not find a loaded module by that name");
                return CMD_FAILURE;
        }
 }
index fb7fa55ddf514806b9844be6a4d0835634615265..6bb789753eb58f9a85c19e5e6603b7775ec2c2f5 100644 (file)
@@ -442,7 +442,7 @@ void ModuleManager::DoSafeUnload(Module* mod)
        Modules.erase(modfind);
        ServerInstance->GlobalCulls.AddItem(mod);
 
-       ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "Module %s unloaded",mod->ModuleSourceFile.c_str());
+       ServerInstance->Logs->Log("MODULE", LOG_DEFAULT, "The %s module was unloaded", mod->ModuleSourceFile.c_str());
        ServerInstance->ISupport.Build();
 }
 
index bba31ee431106f30958846c68d153c50962765cf..01e9bbc6d71242ac255a41f09b55fc0c9c3f4e40 100644 (file)
@@ -143,7 +143,7 @@ class CommandGReloadModule : public Command
                        }
                        else
                        {
-                               user->WriteRemoteNumeric(ERR_CANTUNLOADMODULE, parameters[0], "Could not find module by that name");
+                               user->WriteRemoteNumeric(ERR_CANTUNLOADMODULE, parameters[0], "Could not find a loaded module by that name");
                                return CMD_FAILURE;
                        }
                }