From 591c86f3654cd30b47307f4fbadb96ab04c3f6c9 Mon Sep 17 00:00:00 2001 From: brain Date: Sat, 9 Dec 2006 19:41:03 +0000 Subject: [PATCH] Enumerate InspSocketHook modules git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5893 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp index eb8e53c5a..e6245bc59 100644 --- a/src/modules/m_spanningtree.cpp +++ b/src/modules/m_spanningtree.cpp @@ -89,6 +89,11 @@ typedef nspace::hash_map, irc::St typedef std::map TreeServerList; +/** A group of modules that implement InspSocketHook + * that we can use to hook our server to server connections. + */ +typedef std::map hookmodules; + /** The Link class might as well be a struct, * but this is C++ and we don't believe in structs (!). * It holds the entire information of one @@ -4185,6 +4190,8 @@ class ModuleSpanningTree : public Module public: TimeSyncTimer *SyncTimer; + hookmodules hooks; + std::vector hooknames; ModuleSpanningTree(InspIRCd* Me) : Module::Module(Me), max_local(0), max_global(0) @@ -4201,6 +4208,26 @@ class ModuleSpanningTree : public Module } else SyncTimer = NULL; + + modulelist* ml = ServerInstance->FindInterface("InspSocketHook"); + + /* Did we find any modules? */ + if (ml) + { + /* Yes, enumerate them all to find out the hook name */ + for (modulelist::iterator m = ml->begin(); m != ml->end(); m++) + { + /* Make a request to it for its name, its implementing + * InspSocketHook so we know its safe to do this + */ + std::string name = InspSocketNameRequest(this, *m).Send(); + /* Build a map of them */ + hooks[name.c_str()] = *m; + hooknames.push_back(name); + + ServerInstance->Log(DEBUG, "Found InspSocketHook interface: '%s' -> '%08x'", name.c_str(), *m); + } + } } void ShowLinks(TreeServer* Current, userrec* user, int hops) -- 2.39.5