X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fmodules%2Fm_spanningtree%2Fprotocolinterface.cpp;h=7aed1ddfa148f8bf66f91d709ddf47bc8bdad84e;hb=f9ef4ebc9dc4fd46cdafcc76df644b4896251dac;hp=d10f7f98143ec1c594747534eca24171f8031561;hpb=001861f5d2aca21531b0a20a46e44654a45a5522;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp index d10f7f981..7aed1ddfa 100644 --- a/src/modules/m_spanningtree/protocolinterface.cpp +++ b/src/modules/m_spanningtree/protocolinterface.cpp @@ -49,9 +49,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 +79,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; @@ -124,11 +122,37 @@ void SpanningTreeProtocolInterface::SendChannel(Channel* target, char status, co void SpanningTreeProtocolInterface::SendChannelPrivmsg(Channel* target, char status, const std::string &text) { - SendChannel(target, status, ServerInstance->Config->GetSID()+" PRIVMSG "+target->name+" :"+text); + SendChannel(target, status, ":" + ServerInstance->Config->GetSID()+" PRIVMSG "+target->name+" :"+text); } void SpanningTreeProtocolInterface::SendChannelNotice(Channel* target, char status, const std::string &text) { - SendChannel(target, status, ServerInstance->Config->GetSID()+" NOTICE "+target->name+" :"+text); + SendChannel(target, status, ":" + ServerInstance->Config->GetSID()+" NOTICE "+target->name+" :"+text); +} + +void SpanningTreeProtocolInterface::SendUserPrivmsg(User* target, const std::string &text) +{ + TreeServer* serv = Utils->FindServer(target->server); + if (serv) + { + TreeSocket* sock = serv->GetSocket(); + if (sock) + { + sock->WriteLine(":" + ServerInstance->Config->GetSID() + " PRIVMSG " + target->nick + " :"+text); + } + } +} + +void SpanningTreeProtocolInterface::SendUserNotice(User* target, const std::string &text) +{ + TreeServer* serv = Utils->FindServer(target->server); + if (serv) + { + TreeSocket* sock = serv->GetSocket(); + if (sock) + { + sock->WriteLine(":" + ServerInstance->Config->GetSID() + " NOTICE " + target->nick + " :"+text); + } + } }