From da28fe0b8c0bec9ab111044b1004f24cbf2d742e Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 4 Jul 2012 23:11:01 +0200 Subject: m_spanningtree Introduce new function to send channel messages Use it from the protocol interface and PRIVMSG/NOTICE handlers Unite OnUserNotice and OnUserMessage code into LocalMessage() --- src/modules/m_spanningtree/utils.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/modules/m_spanningtree/utils.cpp') diff --git a/src/modules/m_spanningtree/utils.cpp b/src/modules/m_spanningtree/utils.cpp index 7941970da..344c8138f 100644 --- a/src/modules/m_spanningtree/utils.cpp +++ b/src/modules/m_spanningtree/utils.cpp @@ -421,3 +421,21 @@ Link* SpanningTreeUtilities::FindLink(const std::string& name) } return NULL; } + +void SpanningTreeUtilities::SendChannelMessage(const std::string& prefix, Channel* target, const std::string &text, char status, const CUList& exempt_list, const char* message_type) +{ + std::string raw(":"); + raw.append(prefix).append(1, ' ').append(message_type).push_back(' '); + if (status) + raw.push_back(status); + raw.append(target->name).append(" :").append(text); + + TreeServerList list; + this->GetListOfServersForChannel(target, list, status, exempt_list); + for (TreeServerList::iterator i = list.begin(); i != list.end(); ++i) + { + TreeSocket* Sock = (*i)->GetSocket(); + if (Sock) + Sock->WriteLine(raw); + } +} -- cgit v1.3.1-10-gc9f91