From b07868e77c0527642ed72bce84bf5895bf921e87 Mon Sep 17 00:00:00 2001 From: brain Date: Fri, 4 Apr 2008 12:49:42 +0000 Subject: The rest of the server protocol interface and fix a warning in m_rline git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@9299 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/extra/m_rline.cpp | 6 ++-- src/modules/m_spanningtree/protocolinterface.cpp | 43 +++++++++++++++++++++++- src/modules/m_spanningtree/protocolinterface.h | 2 +- 3 files changed, 46 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/modules/extra/m_rline.cpp b/src/modules/extra/m_rline.cpp index 545757f59..88e40811b 100644 --- a/src/modules/extra/m_rline.cpp +++ b/src/modules/extra/m_rline.cpp @@ -224,12 +224,12 @@ class ModuleRLine : public Module virtual void OnUserConnect(User* user) { // Apply lines on user connect - XLine *r = ServerInstance->XLines->MatchesLine("R", user); + XLine *rl = ServerInstance->XLines->MatchesLine("R", user); - if (r) + if (rl) { // Bang. :P - r->Apply(user); + rl->Apply(user); } } }; diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp index cf774d603..bbdca2305 100644 --- a/src/modules/m_spanningtree/protocolinterface.cpp +++ b/src/modules/m_spanningtree/protocolinterface.cpp @@ -42,23 +42,64 @@ void SpanningTreeProtocolInterface::SendTopic(Channel* channel, std::string &top Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FTOPIC", params); } -void SpanningTreeProtocolInterface::SendMode(const std::string &origin, const std::string &target, parameterlist &modedata) +void SpanningTreeProtocolInterface::SendMode(const std::string &target, parameterlist &modedata) { + if (modedata.empty()) + return; + + /* 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]); + + std::string uidtarget; + ServerInstance->Parser->TranslateUIDs(TR_NICK, target, uidtarget); + modedata.insert(modedata.begin(), uidtarget); + + User* a = ServerInstance->FindNick(uidtarget); + if (a) + { + Utils->DoOneToMany(ServerInstance->Config->GetSID(),"MODE",modedata); + return; + } + else + { + Channel* c = ServerInstance->FindChan(target); + if (c) + { + modedata.insert(modedata.begin() + 1, ConvToStr(c->age)); + Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FMODE",modedata); + } + } } 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; + p.push_back(modes); + p.push_back(":" + text); + Utils->DoOneToMany(ServerInstance->Config->GetSID(), "MODENOTICE", p); } void SpanningTreeProtocolInterface::SendSNONotice(const std::string &snomask, const std::string &text) { + parameterlist p; + p.push_back(snomask); + p.push_back(":" + text); + Utils->DoOneToMany(ServerInstance->Config->GetSID(), "SNONOTICE", p); } void SpanningTreeProtocolInterface::PushToClient(User* target, const std::string &rawline) { + parameterlist p; + p.push_back(target->uuid); + p.push_back(rawline); + Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH", p, target->server); } diff --git a/src/modules/m_spanningtree/protocolinterface.h b/src/modules/m_spanningtree/protocolinterface.h index 568f33463..754e1bf6f 100644 --- a/src/modules/m_spanningtree/protocolinterface.h +++ b/src/modules/m_spanningtree/protocolinterface.h @@ -16,7 +16,7 @@ class SpanningTreeProtocolInterface : public ProtocolInterface virtual void SendEncapsulatedData(parameterlist &encap); virtual void SendMetaData(void* target, int type, const std::string &key, const std::string &data); virtual void SendTopic(Channel* channel, std::string &topic); - virtual void SendMode(const std::string &origin, const std::string &target, parameterlist &modedata); + virtual void SendMode(const std::string &target, parameterlist &modedata); virtual void SendOperNotice(const std::string &text); virtual void SendModeNotice(const std::string &modes, const std::string &text); virtual void SendSNONotice(const std::string &snomask, const std::string &text); -- cgit v1.2.3