summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/main.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2009-01-02 23:15:09 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2009-01-02 23:15:09 +0000
commit7fdb199071b8f83860e33d9548f014c54c95fbe2 (patch)
tree40970e92a2b9b335519999d0efafd2bc71b81c2d /src/modules/m_spanningtree/main.cpp
parent0aac6a2b2ac1dca4783c4deeda5fdde031c8a612 (diff)
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
Diffstat (limited to 'src/modules/m_spanningtree/main.cpp')
-rw-r--r--src/modules/m_spanningtree/main.cpp30
1 files changed, 27 insertions, 3 deletions
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 &parameter)
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.