diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-05-16 16:33:16 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-05-20 23:30:11 +0200 |
commit | 7a67685bcb863b0d4199715e86697fee423596c2 (patch) | |
tree | e9d5d9de3a8ea66b785131012e2a777eaa8004e5 /src/modules/m_silence.cpp | |
parent | 06a606ea6668d6a5fa506f7de4575eff7c3c8871 (diff) |
Remove OnUserPreNotice and OnUserNotice hooks, add MessageType argument to OnUserMessage and OnUserPreMessage
All modules (except m_nonotice) that perform filtering on messages have common logic for handling PRIVMSGs and NOTICEs and most of them run the exact same code in both cases
Diffstat (limited to 'src/modules/m_silence.cpp')
-rw-r--r-- | src/modules/m_silence.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/modules/m_silence.cpp b/src/modules/m_silence.cpp index 2a11a7b8b..0e9a45720 100644 --- a/src/modules/m_silence.cpp +++ b/src/modules/m_silence.cpp @@ -309,7 +309,7 @@ class ModuleSilence : public Module ServerInstance->Modules->AddService(cmdsvssilence); ServerInstance->Modules->AddService(cmdsilence.ext); - Implementation eventlist[] = { I_OnRehash, I_On005Numeric, I_OnUserPreNotice, I_OnUserPreMessage, I_OnUserPreInvite }; + Implementation eventlist[] = { I_OnRehash, I_On005Numeric, I_OnUserPreMessage, I_OnUserPreInvite }; ServerInstance->Modules->Attach(eventlist, this, sizeof(eventlist)/sizeof(Implementation)); } @@ -343,33 +343,23 @@ class ModuleSilence : public Module } } - ModResult PreText(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list, int silence_type) + ModResult OnUserPreMessage(User* user, void* dest, int target_type, std::string& text, char status, CUList& exempt_list, MessageType msgtype) CXX11_OVERRIDE { if (target_type == TYPE_USER && IS_LOCAL(((User*)dest))) { - return MatchPattern((User*)dest, user, silence_type); + return MatchPattern((User*)dest, user, ((msgtype == MSG_PRIVMSG) ? SILENCE_PRIVATE : SILENCE_NOTICE)); } else if (target_type == TYPE_CHANNEL) { Channel* chan = (Channel*)dest; if (chan) { - this->OnBuildExemptList((silence_type == SILENCE_PRIVATE ? MSG_PRIVMSG : MSG_NOTICE), chan, user, status, exempt_list, ""); + this->OnBuildExemptList(msgtype, chan, user, status, exempt_list, ""); } } return MOD_RES_PASSTHRU; } - ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) CXX11_OVERRIDE - { - return PreText(user, dest, target_type, text, status, exempt_list, SILENCE_PRIVATE); - } - - ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list) CXX11_OVERRIDE - { - return PreText(user, dest, target_type, text, status, exempt_list, SILENCE_NOTICE); - } - ModResult OnUserPreInvite(User* source,User* dest,Channel* channel, time_t timeout) CXX11_OVERRIDE { return MatchPattern(dest, source, SILENCE_INVITE); |