summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree/main.cpp6
-rw-r--r--src/modules/m_spanningtree/main.h1
-rw-r--r--src/modules/m_spanningtree/utils.cpp13
-rw-r--r--src/modules/m_spanningtree/utils.h5
4 files changed, 25 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index e7ff3789b..5f06cad58 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -930,6 +930,12 @@ ModResult ModuleSpanningTree::OnSetAway(User* user, const std::string &awaymsg)
return MOD_RES_PASSTHRU;
}
+void ModuleSpanningTree::OnRequest(Request& request)
+{
+ if (!strcmp(request.id, "rehash"))
+ Utils->Rehash();
+}
+
void ModuleSpanningTree::ProtoSendMode(void* opaque, TargetTypeFlags target_type, void* target, const parameterlist &modeline, const std::vector<TranslateType> &translate)
{
TreeSocket* s = (TreeSocket*)opaque;
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index eb17c4195..17adc9287 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -178,6 +178,7 @@ class ModuleSpanningTree : public Module
void OnLoadModule(Module* mod);
void OnUnloadModule(Module* mod);
ModResult OnAcceptConnection(int newsock, ListenSocket* from, irc::sockets::sockaddrs* client, irc::sockets::sockaddrs* server);
+ void OnRequest(Request& request);
CullResult cull();
~ModuleSpanningTree();
Version GetVersion();
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp
index 3bd0aa2c7..367a3b921 100644
--- a/src/modules/m_spanningtree/utils.cpp
+++ b/src/modules/m_spanningtree/utils.cpp
@@ -428,3 +428,16 @@ Link* SpanningTreeUtilities::FindLink(const std::string& name)
}
return NULL;
}
+
+void SpanningTreeUtilities::Rehash()
+{
+ server_hash temp;
+ for (server_hash::const_iterator i = serverlist.begin(); i != serverlist.end(); ++i)
+ temp.insert(std::make_pair(i->first, i->second));
+ serverlist.swap(temp);
+ temp.clear();
+
+ for (server_hash::const_iterator i = sidlist.begin(); i != sidlist.end(); ++i)
+ temp.insert(std::make_pair(i->first, i->second));
+ sidlist.swap(temp);
+}
diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h
index a0543b6bd..5559b3459 100644
--- a/src/modules/m_spanningtree/utils.h
+++ b/src/modules/m_spanningtree/utils.h
@@ -173,6 +173,11 @@ class SpanningTreeUtilities : public classbase
/** Refresh the IP cache used for allowing inbound connections
*/
void RefreshIPCache();
+
+ /** Recreate serverlist and sidlist, this is needed because of m_nationalchars changing
+ * national_case_insensitive_map which is used by the hash function
+ */
+ void Rehash();
};
#endif