diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_chanlog.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_httpd_stats.cpp | 4 | ||||
-rw-r--r-- | src/modules/m_permchannels.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 2 | ||||
-rw-r--r-- | src/modules/m_spanningtree/protocolinterface.cpp | 29 | ||||
-rw-r--r-- | src/modules/m_spanningtree/protocolinterface.h | 14 |
6 files changed, 16 insertions, 37 deletions
diff --git a/src/modules/m_chanlog.cpp b/src/modules/m_chanlog.cpp index a62fbf9b2..dc5750ba6 100644 --- a/src/modules/m_chanlog.cpp +++ b/src/modules/m_chanlog.cpp @@ -76,7 +76,7 @@ class ModuleChanLog : public Module if (c) { c->WriteChannelWithServ(ServerInstance->Config->ServerName, "PRIVMSG %s :%s", c->name.c_str(), snotice.c_str()); - ServerInstance->PI->SendChannelPrivmsg(c, 0, snotice); + ServerInstance->PI->SendMessage(c, 0, snotice); } } diff --git a/src/modules/m_httpd_stats.cpp b/src/modules/m_httpd_stats.cpp index df98ef3f5..022d91f1e 100644 --- a/src/modules/m_httpd_stats.cpp +++ b/src/modules/m_httpd_stats.cpp @@ -208,10 +208,10 @@ class ModuleHttpStats : public Module data << "</userlist><serverlist>"; - ProtoServerList sl; + ProtocolInterface::ServerList sl; ServerInstance->PI->GetServerList(sl); - for (ProtoServerList::iterator b = sl.begin(); b != sl.end(); ++b) + for (ProtocolInterface::ServerList::const_iterator b = sl.begin(); b != sl.end(); ++b) { data << "<server>"; data << "<servername>" << b->servername << "</servername>"; diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index b8e5ea5e8..2a3dff6ee 100644 --- a/src/modules/m_permchannels.cpp +++ b/src/modules/m_permchannels.cpp @@ -263,7 +263,7 @@ public: // Load only when there are no linked servers - we set the TS of the channels we // create to the current time, this can lead to desync because spanningtree has // no way of knowing what we do - ProtoServerList serverlist; + ProtocolInterface::ServerList serverlist; ServerInstance->PI->GetServerList(serverlist); if (serverlist.size() < 2) { diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 169a5cd90..57fe2090c 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -64,7 +64,7 @@ void ModuleSpanningTree::init() ServerInstance->Modules->AddService(commands->map); delete ServerInstance->PI; - ServerInstance->PI = new SpanningTreeProtocolInterface(Utils); + ServerInstance->PI = new SpanningTreeProtocolInterface; loopCall = false; // update our local user count diff --git a/src/modules/m_spanningtree/protocolinterface.cpp b/src/modules/m_spanningtree/protocolinterface.cpp index 0f5c40cc1..5fd598d1d 100644 --- a/src/modules/m_spanningtree/protocolinterface.cpp +++ b/src/modules/m_spanningtree/protocolinterface.cpp @@ -27,12 +27,11 @@ * For documentation on this class, see include/protocol.h. */ -void SpanningTreeProtocolInterface::GetServerList(ProtoServerList &sl) +void SpanningTreeProtocolInterface::GetServerList(ServerList& sl) { - sl.clear(); for (server_hash::iterator i = Utils->serverlist.begin(); i != Utils->serverlist.end(); i++) { - ProtoServer ps; + ServerInfo ps; ps.servername = i->second->GetName(); TreeServer* s = i->second->GetParent(); ps.parentname = s ? s->GetName() : ""; @@ -127,30 +126,18 @@ void SpanningTreeProtocolInterface::PushToClient(User* target, const std::string Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH", p, target->server); } -void SpanningTreeProtocolInterface::SendChannelPrivmsg(Channel* target, char status, const std::string &text) +void SpanningTreeProtocolInterface::SendMessage(Channel* target, char status, const std::string& text, MessageType msgtype) { + const char* cmd = (msgtype == MSG_PRIVMSG ? "PRIVMSG" : "NOTICE"); CUList exempt_list; - Utils->SendChannelMessage(ServerInstance->Config->GetSID(), target, text, status, exempt_list, "PRIVMSG"); + Utils->SendChannelMessage(ServerInstance->Config->GetSID(), target, text, status, exempt_list, cmd); } -void SpanningTreeProtocolInterface::SendChannelNotice(Channel* target, char status, const std::string &text) -{ - CUList exempt_list; - Utils->SendChannelMessage(ServerInstance->Config->GetSID(), target, text, status, exempt_list, "NOTICE"); -} - -void SpanningTreeProtocolInterface::SendUserPrivmsg(User* target, const std::string &text) -{ - parameterlist p; - p.push_back(target->uuid); - p.push_back(":" + text); - Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PRIVMSG", p, target->server); -} - -void SpanningTreeProtocolInterface::SendUserNotice(User* target, const std::string &text) +void SpanningTreeProtocolInterface::SendMessage(User* target, const std::string& text, MessageType msgtype) { + const char* cmd = (msgtype == MSG_PRIVMSG ? "PRIVMSG" : "NOTICE"); parameterlist p; p.push_back(target->uuid); p.push_back(":" + text); - Utils->DoOneToOne(ServerInstance->Config->GetSID(), "NOTICE", p, target->server); + Utils->DoOneToOne(ServerInstance->Config->GetSID(), cmd, p, target->server); } diff --git a/src/modules/m_spanningtree/protocolinterface.h b/src/modules/m_spanningtree/protocolinterface.h index 2b4c4371f..b48e45425 100644 --- a/src/modules/m_spanningtree/protocolinterface.h +++ b/src/modules/m_spanningtree/protocolinterface.h @@ -19,24 +19,16 @@ #pragma once -class SpanningTreeUtilities; -class ModuleSpanningTree; - class SpanningTreeProtocolInterface : public ProtocolInterface { - SpanningTreeUtilities* Utils; public: - SpanningTreeProtocolInterface(SpanningTreeUtilities* util) : Utils(util) { } - bool SendEncapsulatedData(const parameterlist &encap); void SendMetaData(Extensible* target, const std::string &key, const std::string &data); void SendTopic(Channel* channel, std::string &topic); void SendMode(User* source, User* usertarget, Channel* chantarget, const parameterlist& modedata, const std::vector<TranslateType>& types); void SendSNONotice(const std::string &snomask, const std::string &text); void PushToClient(User* target, const std::string &rawline); - void SendChannelPrivmsg(Channel* target, char status, const std::string &text); - void SendChannelNotice(Channel* target, char status, const std::string &text); - void SendUserPrivmsg(User* target, const std::string &text); - void SendUserNotice(User* target, const std::string &text); - void GetServerList(ProtoServerList &sl); + void SendMessage(Channel* target, char status, const std::string& text, MessageType msgtype); + void SendMessage(User* target, const std::string& text, MessageType msgtype); + void GetServerList(ServerList& sl); }; |