summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree
diff options
context:
space:
mode:
authorattilamolnar <attilamolnar@hush.com>2013-05-16 16:33:16 +0200
committerattilamolnar <attilamolnar@hush.com>2013-05-20 23:30:11 +0200
commit7a67685bcb863b0d4199715e86697fee423596c2 (patch)
treee9d5d9de3a8ea66b785131012e2a777eaa8004e5 /src/modules/m_spanningtree
parent06a606ea6668d6a5fa506f7de4575eff7c3c8871 (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_spanningtree')
-rw-r--r--src/modules/m_spanningtree/main.cpp11
-rw-r--r--src/modules/m_spanningtree/main.h3
2 files changed, 4 insertions, 10 deletions
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index 244180b2f..4934c3d61 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -73,7 +73,7 @@ void ModuleSpanningTree::init()
Implementation eventlist[] =
{
I_OnPreCommand, I_OnGetServerDescription, I_OnUserInvite, I_OnPostTopicChange,
- I_OnWallops, I_OnUserNotice, I_OnUserMessage, I_OnBackgroundTimer, I_OnUserJoin,
+ I_OnWallops, I_OnUserMessage, I_OnBackgroundTimer, I_OnUserJoin,
I_OnChangeHost, I_OnChangeName, I_OnChangeIdent, I_OnUserPart, I_OnUnloadModule,
I_OnUserQuit, I_OnUserPostNick, I_OnUserKick, I_OnRemoteKill, I_OnRehash, I_OnPreRehash,
I_OnOper, I_OnAddLine, I_OnDelLine, I_OnMode, I_OnLoadModule, I_OnStats,
@@ -495,14 +495,9 @@ void ModuleSpanningTree::LocalMessage(User* user, void* dest, int target_type, c
}
}
-void ModuleSpanningTree::OnUserNotice(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list)
+void ModuleSpanningTree::OnUserMessage(User* user, void* dest, int target_type, const std::string& text, char status, const CUList& exempt_list, MessageType msgtype)
{
- LocalMessage(user, dest, target_type, text, status, exempt_list, "NOTICE");
-}
-
-void ModuleSpanningTree::OnUserMessage(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list)
-{
- LocalMessage(user, dest, target_type, text, status, exempt_list, "PRIVMSG");
+ LocalMessage(user, dest, target_type, text, status, exempt_list, (msgtype == MSG_PRIVMSG ? "PRIVMSG" : "NOTICE"));
}
void ModuleSpanningTree::OnBackgroundTimer(time_t curtime)
diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h
index 9ea48aaea..947eddd37 100644
--- a/src/modules/m_spanningtree/main.h
+++ b/src/modules/m_spanningtree/main.h
@@ -148,8 +148,7 @@ class ModuleSpanningTree : public Module
void OnUserInvite(User* source,User* dest,Channel* channel, time_t) CXX11_OVERRIDE;
void OnPostTopicChange(User* user, Channel* chan, const std::string &topic) CXX11_OVERRIDE;
void OnWallops(User* user, const std::string &text) CXX11_OVERRIDE;
- void OnUserNotice(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list) CXX11_OVERRIDE;
- void OnUserMessage(User* user, void* dest, int target_type, const std::string &text, char status, const CUList &exempt_list) CXX11_OVERRIDE;
+ void OnUserMessage(User* user, void* dest, int target_type, const std::string& text, char status, const CUList& exempt_list, MessageType msgtype) 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;