diff options
-rw-r--r-- | src/modules/m_spanningtree/utils.cpp | 13 | ||||
-rw-r--r-- | src/modules/m_spanningtree/utils.h | 5 |
2 files changed, 18 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 05b77bb62..6de47de94 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -89,6 +89,19 @@ TreeServer* SpanningTreeUtilities::FindServerID(const std::string &id) return NULL; } +TreeServer* SpanningTreeUtilities::FindRouteTarget(const std::string& target) +{ + TreeServer* const server = FindServer(target); + if (server) + return server; + + User* const user = ServerInstance->FindNick(target); + if (user) + return TreeServer::Get(user); + + return NULL; +} + SpanningTreeUtilities::SpanningTreeUtilities(ModuleSpanningTree* C) : Creator(C), TreeRoot(NULL) , PingFreq(60) // XXX: TreeServer constructor reads this and TreeRoot is created before the config is read, so init it to something (value doesn't matter) to avoid a valgrind warning in TimerManager on unload diff --git a/src/modules/m_spanningtree/utils.h b/src/modules/m_spanningtree/utils.h index 6d0d094e7..a2f7212f6 100644 --- a/src/modules/m_spanningtree/utils.h +++ b/src/modules/m_spanningtree/utils.h @@ -148,6 +148,11 @@ class SpanningTreeUtilities : public classbase */ TreeServer* FindServerID(const std::string &id); + /** Find a server based on a target string. + * @param target Target string where a command should be routed to. May be a server name, a sid, a nickname or a uuid. + */ + TreeServer* FindRouteTarget(const std::string& target); + /** Find a server by glob mask */ TreeServer* FindServerMask(const std::string &ServerName); |