diff options
| author | 2017-12-11 19:42:52 +0000 | |
|---|---|---|
| committer | 2018-01-06 14:18:21 +0000 | |
| commit | 2fcb5ff4389a9a82d253acdff02a388ddcf14653 (patch) | |
| tree | 96feee81599adb7ef02bc35293daccba7071a6de /src/modules/m_ircv3_echomessage.cpp | |
| parent | Improve the method that blockcaps uses to block messages. (diff) | |
Rework message handling.
- Move all message-related types to their own header to make moving
them to a cross-module events easier.
- Rename OnUserMessage to OnUserPostMessage.
- Rename OnText to OnUserMessage.
- Replace the dest, target_type, and status parameters with the
MessageTarget class.
- Replace the text, exempt_list, and msgtype parameters with the
MessageDetails struct.
- Add echooriginal and originaltext to the MessageDetails struct
to allow spam filtering to not be broken by cap echo-message.
Diffstat (limited to 'src/modules/m_ircv3_echomessage.cpp')
| -rw-r--r-- | src/modules/m_ircv3_echomessage.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/modules/m_ircv3_echomessage.cpp b/src/modules/m_ircv3_echomessage.cpp index 8773d7187..c2818700f 100644 --- a/src/modules/m_ircv3_echomessage.cpp +++ b/src/modules/m_ircv3_echomessage.cpp @@ -33,31 +33,31 @@ class ModuleIRCv3EchoMessage : public Module { } - void OnUserMessage(User* user, void* dest, int target_type, const std::string& text, char status, const CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE + void OnUserPostMessage(User* user, const MessageTarget& target, const MessageDetails& details) CXX11_OVERRIDE { if (!cap.get(user)) return; - std::string msg = MessageTypeStringSp[msgtype]; - if (target_type == TYPE_USER) + std::string msg = MessageTypeStringSp[details.type]; + if (target.type == MessageTarget::TYPE_USER) { - User* destuser = static_cast<User*>(dest); + User* destuser = target.Get<User>(); msg.append(destuser->nick); } - else if (target_type == TYPE_CHANNEL) + else if (target.type == MessageTarget::TYPE_CHANNEL) { - if (status) - msg.push_back(status); + if (target.status) + msg.push_back(target.status); - Channel* chan = static_cast<Channel*>(dest); + Channel* chan = target.Get<Channel>(); msg.append(chan->name); } else { - const char* servername = static_cast<const char*>(dest); - msg.append(servername); + const std::string* servername = target.Get<std::string>(); + msg.append(*servername); } - msg.append(" :").append(text); + msg.append(" :").append(details.echooriginal ? details.originaltext : details.text); user->WriteFrom(user, msg); } |
