]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/modules/m_spanningtree/protocolinterface.cpp
Add call to protocol interface to get useful info on the server map. Return a std...
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / protocolinterface.cpp
index f204c15edfa7a9508f024adba287d0b404355f1e..e586c7017160c7d5761d6abdbad63f08f90f510e 100644 (file)
@@ -5,6 +5,22 @@
 #include "m_spanningtree/treesocket.h"
 #include "m_spanningtree/protocolinterface.h"
 
+void SpanningTreeProtocolInterface::GetServerList(ProtoServerList &sl)
+{
+       sl.clear();
+       for (server_hash::iterator i = Utils->serverlist.begin(); i != Utils->serverlist.end(); i++)
+       {
+               ProtoServer ps;
+               ps.servername = i->second->GetName();
+               TreeServer* s = i->second->GetParent();
+               ps.parentname = s ? s->GetName() : ServerInstance->Config->ServerName;
+               ps.usercount = i->second->GetUserCount();
+               ps.opercount = i->second->GetOperCount();
+               ps.latencyms = i->second->rtt;
+               sl.push_back(ps);
+       }
+}
+
 void SpanningTreeProtocolInterface::SendEncapsulatedData(parameterlist &encap)
 {
        Utils->DoOneToMany(ServerInstance->Config->GetSID(), "ENCAP", encap);
@@ -49,9 +65,14 @@ void SpanningTreeProtocolInterface::SendMode(const std::string &target, paramete
        if (modedata.empty())
                return;
 
+       std::string outdata;
+
        /* Warning: in-place translation is only safe for type TR_NICK */
        for (size_t n = 0; n < modedata.size(); n++)
-               ServerInstance->Parser->TranslateUIDs(TR_NICK, modedata[n], modedata[n]);
+       {
+               ServerInstance->Parser->TranslateUIDs(TR_NICK, modedata[n], outdata);
+               modedata[n] = outdata;
+       }
 
        std::string uidtarget;
        ServerInstance->Parser->TranslateUIDs(TR_NICK, target, uidtarget);
@@ -74,13 +95,6 @@ void SpanningTreeProtocolInterface::SendMode(const std::string &target, paramete
        }
 }
 
-void SpanningTreeProtocolInterface::SendOperNotice(const std::string &text)
-{
-       parameterlist p;
-       p.push_back(":" + text);
-       Utils->DoOneToMany(ServerInstance->Config->GetSID(), "OPERNOTICE", p);
-}
-
 void SpanningTreeProtocolInterface::SendModeNotice(const std::string &modes, const std::string &text)
 {
        parameterlist p;