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_deaf.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_deaf.cpp')
| -rw-r--r-- | src/modules/m_deaf.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/modules/m_deaf.cpp b/src/modules/m_deaf.cpp index 7cad49d76..e58d130a5 100644 --- a/src/modules/m_deaf.cpp +++ b/src/modules/m_deaf.cpp @@ -60,14 +60,14 @@ class ModuleDeaf : public Module deaf_bypasschars_uline = tag->getString("bypasscharsuline"); } - ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE + ModResult OnUserPreMessage(User* user, const MessageTarget& target, MessageDetails& details) CXX11_OVERRIDE { - if (target_type != TYPE_CHANNEL) + if (target.type != MessageTarget::TYPE_CHANNEL) return MOD_RES_PASSTHRU; - Channel* chan = static_cast<Channel*>(dest); - bool is_bypasschar = (deaf_bypasschars.find(text[0]) != std::string::npos); - bool is_bypasschar_uline = (deaf_bypasschars_uline.find(text[0]) != std::string::npos); + Channel* chan = target.Get<Channel>(); + bool is_bypasschar = (deaf_bypasschars.find(details.text[0]) != std::string::npos); + bool is_bypasschar_uline = (deaf_bypasschars_uline.find(details.text[0]) != std::string::npos); /* * If we have no bypasschars_uline in config, and this is a bypasschar (regular) @@ -95,7 +95,7 @@ class ModuleDeaf : public Module continue; /* deliver message */ /* don't deliver message! */ - exempt_list.insert(i->first); + details.exemptions.insert(i->first); } return MOD_RES_PASSTHRU; |
