diff options
| author | 2007-05-31 17:43:23 +0000 | |
|---|---|---|
| committer | 2007-05-31 17:43:23 +0000 | |
| commit | 7f0de14650cdfe520831e06cfba0c15e5e7d9e5d (patch) | |
| tree | 52cbe5bfc11e1bca1eb2b8a16574b94058e62085 /src/cmd_notice.cpp | |
| parent | Fix bug #310 reported by Smartys, and optimize mode.cpp a bit (was using stri... (diff) | |
| download | inspircd++-7f0de14650cdfe520831e06cfba0c15e5e7d9e5d.tar.gz inspircd++-7f0de14650cdfe520831e06cfba0c15e5e7d9e5d.tar.bz2 inspircd++-7f0de14650cdfe520831e06cfba0c15e5e7d9e5d.zip | |
Fix for issue discovered by satmd where it is possible to send an empty string via privmsg or notice to a user target, against the RFC standard. Remote servers don't like this much.
Also fix: NOTICE generates OnUserNotice event, but checks against the I_OnUserMessage hook.
Also also fix (!): Missing colons in "no text to send" message.
BOTH of these also fixes have been around since like, 1.0 alpha 1, and nobody's noticed them!
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7192 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/cmd_notice.cpp')
| -rw-r--r-- | src/cmd_notice.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/cmd_notice.cpp b/src/cmd_notice.cpp index f43b6cd20..a797fefab 100644 --- a/src/cmd_notice.cpp +++ b/src/cmd_notice.cpp @@ -48,7 +48,7 @@ CmdResult cmd_notice::Handle (const char** parameters, int pcnt, userrec *user) { user->SendAll("NOTICE", "%s", parameters[1]); } - FOREACH_MOD(I_OnUserMessage,OnUserNotice(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0,exempt_list)); + FOREACH_MOD(I_OnUserNotice,OnUserNotice(user,(void*)parameters[0],TYPE_SERVER,parameters[1],0,exempt_list)); return CMD_SUCCESS; } char status = 0; @@ -89,7 +89,7 @@ CmdResult cmd_notice::Handle (const char** parameters, int pcnt, userrec *user) if (temp.empty()) { - user->WriteServ("412 %s No text to send", user->nick); + user->WriteServ("412 %s :No text to send", user->nick); return CMD_FAILURE; } @@ -123,8 +123,13 @@ CmdResult cmd_notice::Handle (const char** parameters, int pcnt, userrec *user) dest = ServerInstance->FindNick(parameters[0]); if (dest) { + if (!*parameters[1]) + { + user->WriteServ("412 %s :No text to send", user->nick); + return CMD_FAILURE; + } + int MOD_RESULT = 0; - std::string temp = parameters[1]; FOREACH_RESULT(I_OnUserPreNotice,OnUserPreNotice(user,dest,TYPE_USER,temp,0,exempt_list)); if (MOD_RESULT) { |
