X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Fprotocolinterface.cpp;h=e586c7017160c7d5761d6abdbad63f08f90f510e;hb=99a1ea0892b575c6d66d9f4c0aab5042c261ce4a;hp=f204c15edfa7a9508f024adba287d0b404355f1e;hpb=f02df696d5f51498657142e4ecb65a99ab7424ad;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp index f204c15ed..e586c7017 100644 --- a/src/modules/m_spanningtree/protocolinterface.cpp +++ b/src/modules/m_spanningtree/protocolinterface.cpp @@ -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;