diff options
Diffstat (limited to 'src/modules/m_spanningtree')
-rw-r--r-- | src/modules/m_spanningtree/main.cpp | 37 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 3 |
2 files changed, 40 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index 55fe992b6..db5265344 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -39,6 +39,7 @@ ModuleSpanningTree::ModuleSpanningTree() : Away::EventListener(this) , Stats::EventListener(this) + , CTCTags::EventListener(this) , rconnect(this) , rsquit(this) , map(this) @@ -418,6 +419,42 @@ void ModuleSpanningTree::OnUserPostMessage(User* user, const MessageTarget& targ } } +void ModuleSpanningTree::OnUserPostTagMessage(User* user, const MessageTarget& target, const CTCTags::TagMessageDetails& details) +{ + if (!IS_LOCAL(user)) + return; + + switch (target.type) + { + case MessageTarget::TYPE_USER: + { + User* d = target.Get<User>(); + if (!IS_LOCAL(d)) + { + CmdBuilder params(user, "TAGMSG"); + params.push_tags(details.tags_out); + params.push_back(d->uuid); + params.Unicast(d); + } + break; + } + case MessageTarget::TYPE_CHANNEL: + { + Utils->SendChannelMessage(user->uuid, target.Get<Channel>(), "", target.status, details.tags_out, details.exemptions, "TAGMSG"); + break; + } + case MessageTarget::TYPE_SERVER: + { + const std::string* serverglob = target.Get<std::string>(); + CmdBuilder par(user, "TAGMSG"); + par.push_tags(details.tags_out); + par.push_back(*serverglob); + par.Broadcast(); + break; + } + } +} + void ModuleSpanningTree::OnBackgroundTimer(time_t curtime) { AutoConnectServers(curtime); diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 1186f072c..9a9d4733d 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -28,6 +28,7 @@ #include "modules/dns.h" #include "modules/ssl.h" #include "modules/stats.h" +#include "modules/ctctags.h" #include "servercommand.h" #include "commands.h" #include "protocolinterface.h" @@ -72,6 +73,7 @@ class ModuleSpanningTree : public Module , public Away::EventListener , public Stats::EventListener + , public CTCTags::EventListener { /** Client to server commands, registered in the core */ @@ -169,6 +171,7 @@ class ModuleSpanningTree ModResult OnPreTopicChange(User* user, Channel* chan, const std::string& topic) CXX11_OVERRIDE; void OnPostTopicChange(User* user, Channel* chan, const std::string &topic) CXX11_OVERRIDE; void OnUserPostMessage(User* user, const MessageTarget& target, const MessageDetails& details) CXX11_OVERRIDE; + void OnUserPostTagMessage(User* user, const MessageTarget& target, const CTCTags::TagMessageDetails& details) CXX11_OVERRIDE; void OnBackgroundTimer(time_t curtime) CXX11_OVERRIDE; void OnUserJoin(Membership* memb, bool sync, bool created, CUList& excepts) CXX11_OVERRIDE; void OnChangeHost(User* user, const std::string &newhost) CXX11_OVERRIDE; |