X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_reloadmodule.cpp;h=6836cb55cf7bb01391bee6664f6f4281339b58f3;hb=b3449b8763139602efc568f46631299476d5979f;hp=ea5d40abdc72d8c6841c06f90db9af98cd71b597;hpb=77730fd5f09f8fc193205654c8bba84d34365670;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_reloadmodule.cpp b/src/coremods/core_reloadmodule.cpp index ea5d40abd..6836cb55c 100644 --- a/src/coremods/core_reloadmodule.cpp +++ b/src/coremods/core_reloadmodule.cpp @@ -1,9 +1,12 @@ /* * InspIRCd -- Internet Relay Chat Daemon * - * Copyright (C) 2015 Attila Molnar + * Copyright (C) 2017-2019, 2021 Sadie Powell + * Copyright (C) 2014-2016, 2018 Attila Molnar + * Copyright (C) 2012 Robby * Copyright (C) 2009 Daniel De Graaf - * Copyright (C) 2007 Robin Burchell + * Copyright (C) 2007, 2010 Craig Edwards + * Copyright (C) 2007 Dennis Friis * * This file is part of InspIRCd. InspIRCd is free software: you can * redistribute it and/or modify it under the terms of the GNU General Public @@ -379,7 +382,7 @@ void DataKeeper::SaveExtensions(Extensible* extensible, std::vectorserialize(FORMAT_INTERNAL, extensible, it->second); + std::string value = item->ToInternal(extensible, it->second); // If the serialized value is empty the extension won't be saved and restored if (!value.empty()) extdata.push_back(InstanceData(index, value)); @@ -597,7 +600,7 @@ void DataKeeper::RestoreExtensions(const std::vector& list, Extens for (std::vector::const_iterator i = list.begin(); i != list.end(); ++i) { const InstanceData& id = *i; - handledexts[id.index].extitem->unserialize(FORMAT_INTERNAL, extensible, id.serialized); + handledexts[id.index].extitem->FromInternal(extensible, id.serialized); } } @@ -717,11 +720,9 @@ class ReloadAction : public ActionBase ReloadModule::DataKeeper datakeeper; datakeeper.Save(mod); - DLLManager* dll = mod->ModuleDLLManager; std::string name = mod->ModuleSourceFile; ServerInstance->Modules->DoSafeUnload(mod); ServerInstance->GlobalCulls.Apply(); - delete dll; bool result = ServerInstance->Modules->Load(name); if (result) @@ -735,7 +736,10 @@ class ReloadAction : public ActionBase ServerInstance->SNO->WriteGlobalSno('a', "RELOAD MODULE: %s %ssuccessfully reloaded", passedname.c_str(), result ? "" : "un"); User* user = ServerInstance->FindUUID(uuid); if (user) - user->WriteNumeric(RPL_LOADEDMODULE, passedname, InspIRCd::Format("Module %ssuccessfully reloaded.", (result ? "" : "un"))); + { + int numeric = result ? RPL_LOADEDMODULE : ERR_CANTUNLOADMODULE; + user->WriteNumeric(numeric, passedname, InspIRCd::Format("Module %ssuccessfully reloaded.", (result ? "" : "un"))); + } ServerInstance->GlobalCulls.AddItem(this); } @@ -746,7 +750,7 @@ CmdResult CommandReloadmodule::Handle(User* user, const Params& parameters) Module* m = ServerInstance->Modules->Find(parameters[0]); if (m == creator) { - user->WriteNumeric(RPL_LOADEDMODULE, parameters[0], "You cannot reload core_reloadmodule (unload and load it)"); + user->WriteNumeric(ERR_CANTUNLOADMODULE, parameters[0], "You cannot reload core_reloadmodule (unload and load it)"); return CMD_FAILURE; } @@ -760,7 +764,7 @@ CmdResult CommandReloadmodule::Handle(User* user, const Params& parameters) } else { - user->WriteNumeric(RPL_LOADEDMODULE, parameters[0], "Could not find module by that name"); + user->WriteNumeric(ERR_CANTUNLOADMODULE, parameters[0], "Could not find module by that name"); return CMD_FAILURE; } }