From 7fdb199071b8f83860e33d9548f014c54c95fbe2 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 2 Jan 2009 23:15:09 +0000 Subject: If a module is loaded after m_spanningtree that it needs, then it will now re-read its configuration file. The code is also now in the right place to pick this up on rehash too not just on load. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@10934 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/main.cpp | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) (limited to 'src/modules/m_spanningtree/main.cpp') diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index b391df971..dcd02ba9b 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -49,12 +49,12 @@ ModuleSpanningTree::ModuleSpanningTree(InspIRCd* Me) { I_OnPreCommand, I_OnGetServerDescription, I_OnUserInvite, I_OnPostLocalTopicChange, I_OnWallops, I_OnUserNotice, I_OnUserMessage, I_OnBackgroundTimer, - I_OnUserJoin, I_OnChangeLocalUserHost, I_OnChangeName, I_OnUserPart, + I_OnUserJoin, I_OnChangeLocalUserHost, I_OnChangeName, I_OnUserPart, I_OnUnloadModule, I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, - I_OnOper, I_OnAddLine, I_OnDelLine, I_ProtoSendMode, I_OnMode, + I_OnOper, I_OnAddLine, I_OnDelLine, I_ProtoSendMode, I_OnMode, I_OnLoadModule, I_OnStats, I_ProtoSendMetaData, I_OnEvent, I_OnSetAway, I_OnPostCommand }; - ServerInstance->Modules->Attach(eventlist, this, 27); + ServerInstance->Modules->Attach(eventlist, this, 29); delete ServerInstance->PI; ServerInstance->PI = new SpanningTreeProtocolInterface(this, Utils, ServerInstance); @@ -714,6 +714,30 @@ void ModuleSpanningTree::OnRehash(User* user, const std::string ¶meter) Utils->ReadConfiguration(true); } +void ModuleSpanningTree::OnLoadModule(Module* mod, const std::string &name) +{ + this->RedoConfig(mod, name); +} + +void ModuleSpanningTree::OnUnloadModule(Module* mod, const std::string &name) +{ + this->RedoConfig(mod, name); +} + +void ModuleSpanningTree::RedoConfig(Module* mod, const std::string &name) +{ + /* 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. + * + * We determine if a module supports BufferedSocket simply by sending it the Request for its BufferedSocket name, + * and if it responds non-NULL, it implements the interface. + */ + if (name == "m_sha256.so" || BufferedSocketNameRequest((Module*)this, mod).Send() != NULL) + { + Utils->ReadConfiguration(true); + } +} + // note: the protocol does not allow direct umode +o except // via NICK with 8 params. sending OPERTYPE infers +o modechange // locally. -- cgit v1.2.3