2 #include "m_spanningtree/main.h"
3 #include "m_spanningtree/utils.h"
4 #include "m_spanningtree/protocolinterface.h"
6 void SpanningTreeProtocolInterface::SendEncapsulatedData(parameterlist &encap)
8 Utils->DoOneToMany(ServerInstance->Config->GetSID(), "ENCAP", encap);
11 void SpanningTreeProtocolInterface::SendMetaData(void* target, int type, const std::string &key, const std::string &data)
18 params.push_back(((User*)target)->uuid);
21 params.push_back(((Channel*)target)->name);
24 params.push_back(ServerInstance->Config->GetSID());
27 params.push_back(key);
28 params.push_back(":" + data);
30 Utils->DoOneToMany(ServerInstance->Config->GetSID(),"METADATA",params);
33 void SpanningTreeProtocolInterface::SendTopic(Channel* channel, std::string &topic)
37 params.push_back(channel->name);
38 params.push_back(ConvToStr(ServerInstance->Time()));
39 params.push_back(ServerInstance->Config->ServerName);
40 params.push_back(":" + topic);
42 Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FTOPIC", params);
45 void SpanningTreeProtocolInterface::SendMode(const std::string &target, parameterlist &modedata)
50 /* Warning: in-place translation is only safe for type TR_NICK */
51 for (size_t n = 0; n < modedata.size(); n++)
52 ServerInstance->Parser->TranslateUIDs(TR_NICK, modedata[n], modedata[n]);
54 std::string uidtarget;
55 ServerInstance->Parser->TranslateUIDs(TR_NICK, target, uidtarget);
56 modedata.insert(modedata.begin(), uidtarget);
58 User* a = ServerInstance->FindNick(uidtarget);
61 Utils->DoOneToMany(ServerInstance->Config->GetSID(),"MODE",modedata);
66 Channel* c = ServerInstance->FindChan(target);
69 modedata.insert(modedata.begin() + 1, ConvToStr(c->age));
70 Utils->DoOneToMany(ServerInstance->Config->GetSID(),"FMODE",modedata);
75 void SpanningTreeProtocolInterface::SendOperNotice(const std::string &text)
78 p.push_back(":" + text);
79 Utils->DoOneToMany(ServerInstance->Config->GetSID(), "OPERNOTICE", p);
82 void SpanningTreeProtocolInterface::SendModeNotice(const std::string &modes, const std::string &text)
86 p.push_back(":" + text);
87 Utils->DoOneToMany(ServerInstance->Config->GetSID(), "MODENOTICE", p);
90 void SpanningTreeProtocolInterface::SendSNONotice(const std::string &snomask, const std::string &text)
94 p.push_back(":" + text);
95 Utils->DoOneToMany(ServerInstance->Config->GetSID(), "SNONOTICE", p);
98 void SpanningTreeProtocolInterface::PushToClient(User* target, const std::string &rawline)
101 p.push_back(target->uuid);
102 p.push_back(rawline);
103 Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH", p, target->server);