summaryrefslogtreecommitdiff
path: root/src/commands
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/commands
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/commands')
-rw-r--r--src/commands/cmd_notice.cpp12
-rw-r--r--src/commands/cmd_privmsg.cpp12
2 files changed, 12 insertions, 12 deletions
diff --git a/src/commands/cmd_notice.cpp b/src/commands/cmd_notice.cpp
index d0845a051..ec60127b7 100644
--- a/src/commands/cmd_notice.cpp
+++ b/src/commands/cmd_notice.cpp
@@ -70,7 +70,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
ModResult MOD_RESULT;
std::string temp = parameters[1];
- FIRST_MOD_RESULT(OnUserPreNotice, MOD_RESULT, (user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, exempt_list));
+ FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, exempt_list, MSG_NOTICE));
if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
const char* text = temp.c_str();
@@ -81,7 +81,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
{
user->SendAll("NOTICE", "%s", text);
}
- FOREACH_MOD(I_OnUserNotice,OnUserNotice(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, exempt_list));
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, exempt_list, MSG_NOTICE));
return CMD_SUCCESS;
}
char status = 0;
@@ -125,7 +125,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
ModResult MOD_RESULT;
std::string temp = parameters[1];
- FIRST_MOD_RESULT(OnUserPreNotice, MOD_RESULT, (user,chan,TYPE_CHANNEL,temp,status, exempt_list));
+ FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user,chan,TYPE_CHANNEL,temp,status, exempt_list, MSG_NOTICE));
if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
@@ -155,7 +155,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
chan->WriteAllExcept(user, false, status, exempt_list, "NOTICE %s :%s", chan->name.c_str(), text);
}
- FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,chan,TYPE_CHANNEL,text,status,exempt_list));
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,chan,TYPE_CHANNEL,text,status,exempt_list,MSG_NOTICE));
}
else
{
@@ -201,7 +201,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
ModResult MOD_RESULT;
std::string temp = parameters[1];
- FIRST_MOD_RESULT(OnUserPreNotice, MOD_RESULT, (user,dest,TYPE_USER,temp,0,exempt_list));
+ FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, dest, TYPE_USER, temp, 0, exempt_list, MSG_NOTICE));
if (MOD_RESULT == MOD_RES_DENY) {
return CMD_FAILURE;
}
@@ -215,7 +215,7 @@ CmdResult CommandNotice::Handle (const std::vector<std::string>& parameters, Use
user->WriteTo(dest, "NOTICE %s :%s", dest->nick.c_str(), text);
}
- FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,dest,TYPE_USER,text,0,exempt_list));
+ FOREACH_MOD(I_OnUserMessage, OnUserMessage(user, dest, TYPE_USER, text, 0, exempt_list, MSG_NOTICE));
}
else
{
diff --git a/src/commands/cmd_privmsg.cpp b/src/commands/cmd_privmsg.cpp
index 49845162c..b04e63d00 100644
--- a/src/commands/cmd_privmsg.cpp
+++ b/src/commands/cmd_privmsg.cpp
@@ -70,7 +70,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
ModResult MOD_RESULT;
std::string temp = parameters[1];
- FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, except_list));
+ FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, (void*)parameters[0].c_str(), TYPE_SERVER, temp, 0, except_list, MSG_PRIVMSG));
if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
@@ -82,7 +82,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
{
user->SendAll("PRIVMSG", "%s", text);
}
- FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list));
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, (void*)parameters[0].c_str(), TYPE_SERVER, text, 0, except_list, MSG_PRIVMSG));
return CMD_SUCCESS;
}
char status = 0;
@@ -127,7 +127,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
ModResult MOD_RESULT;
std::string temp = parameters[1];
- FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user,chan,TYPE_CHANNEL,temp,status,except_list));
+ FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, chan, TYPE_CHANNEL, temp, status, except_list, MSG_PRIVMSG));
if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
@@ -158,7 +158,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
chan->WriteAllExcept(user, false, status, except_list, "PRIVMSG %s :%s", chan->name.c_str(), text);
}
- FOREACH_MOD(I_OnUserMessage,OnUserMessage(user,chan,TYPE_CHANNEL,text,status,except_list));
+ FOREACH_MOD(I_OnUserMessage, OnUserMessage(user,chan, TYPE_CHANNEL, text, status, except_list, MSG_PRIVMSG));
}
else
{
@@ -211,7 +211,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
ModResult MOD_RESULT;
std::string temp = parameters[1];
- FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, dest, TYPE_USER, temp, 0, except_list));
+ FIRST_MOD_RESULT(OnUserPreMessage, MOD_RESULT, (user, dest, TYPE_USER, temp, 0, except_list, MSG_PRIVMSG));
if (MOD_RESULT == MOD_RES_DENY)
return CMD_FAILURE;
@@ -225,7 +225,7 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
user->WriteTo(dest, "PRIVMSG %s :%s", dest->nick.c_str(), text);
}
- FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, dest, TYPE_USER, text, 0, except_list));
+ FOREACH_MOD(I_OnUserMessage,OnUserMessage(user, dest, TYPE_USER, text, 0, except_list, MSG_PRIVMSG));
}
else
{