Module: ngircd.git Branch: master Commit: 3ee98d9f72449c88861744aebdd0a2e570bc3bc5 URL: http://ngircd.barton.de/cgi-bin/gitweb.cgi?p=ngircd.git&a=commit;h=3ee98...
Author: DNS777 dns@rbose.org Date: Fri Oct 19 18:37:33 2012 +0200
Update error messages for user mode +b and channel Mode +M.
Replaced error message for channel mode +M with ERR_NEEDREGGEDNICK_MSG (used by Bahamut, inspircd, ircu & Unreal too) and using numeric 477 and the msg simliar like inspircd.
Replaced the error message ERR_CANNOTSENDTONICK_MSG for user mode +b with ERR_NONONREG_MSG and using numeric 486, similar like unrealircd.
(cherry picked from commit 55a61ab17f63a9e757b7c7598c31b98ce5a132e8 and commit 3737d9ab7da1ea0485cefc07c65dc5308bf0db02)
---
src/ngircd/channel.c | 6 +++++- src/ngircd/irc.c | 2 +- src/ngircd/messages.h | 3 ++- src/testsuite/message-test.e | 2 +- 4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/src/ngircd/channel.c b/src/ngircd/channel.c index f3c74dc..00aafe0 100644 --- a/src/ngircd/channel.c +++ b/src/ngircd/channel.c @@ -918,7 +918,11 @@ Channel_Write(CHANNEL *Chan, CLIENT *From, CLIENT *Client, const char *Command, if (!Can_Send_To_Channel(Chan, From)) { if (! SendErrors) return CONNECTED; /* no error, see RFC 2812 */ - return IRC_WriteStrClient(From, ERR_CANNOTSENDTOCHAN_MSG, + if (strchr(Channel_Modes(Chan), 'M')) + return IRC_WriteStrClient(From, ERR_NEEDREGGEDNICK_MSG, + Client_ID(From), Channel_Name(Chan)); + else + return IRC_WriteStrClient(From, ERR_CANNOTSENDTOCHAN_MSG, Client_ID(From), Channel_Name(Chan)); }
diff --git a/src/ngircd/irc.c b/src/ngircd/irc.c index 1a57bec..9d9d3f0 100644 --- a/src/ngircd/irc.c +++ b/src/ngircd/irc.c @@ -506,7 +506,7 @@ Send_Message(CLIENT * Client, REQUEST * Req, int ForceType, bool SendErrors) !(Client_Type(from) == CLIENT_SERVER) && !(Client_Type(from) == CLIENT_SERVICE)) { if (SendErrors && !IRC_WriteStrClient(from, - ERR_CANNOTSENDTONICK_MSG, + ERR_NONONREG_MSG, Client_ID(from), Client_ID(cl))) return DISCONNECTED; goto send_next_target; diff --git a/src/ngircd/messages.h b/src/ngircd/messages.h index 59e9605..a6a6d8c 100644 --- a/src/ngircd/messages.h +++ b/src/ngircd/messages.h @@ -136,6 +136,7 @@ #define ERR_BANNEDFROMCHAN_MSG "474 %s %s :Cannot join channel (+b) -- You are banned" #define ERR_BADCHANNELKEY_MSG "475 %s %s :Cannot join channel (+k) -- Wrong channel key" #define ERR_NOCHANMODES_MSG "477 %s %s :Channel doesn't support modes" +#define ERR_NEEDREGGEDNICK_MSG "477 %s %s :Cannot send to channel (+M) -- You need to be identified to a registered account to message this channel" #define ERR_LISTFULL_MSG "478 %s %s %s: Channel list is full (%d)" #define ERR_NOPRIVILEGES_MSG "481 %s :Permission denied" #define ERR_CHANOPRIVSNEEDED_MSG "482 %s %s :You are not channel operator" @@ -144,6 +145,7 @@ #define ERR_CANTKILLSERVER_MSG "483 %s :You can't kill a server!" #define ERR_RESTRICTED_MSG "484 %s :Your connection is restricted" #define ERR_NICKREGISTER_MSG "484 %s :Cannot modify user mode (+R) -- Use IRC services" +#define ERR_NONONREG_MSG "486 %s :Cannot send to user (+b) -- You must identify to a registered nick to private message %s" #define ERR_NOOPERHOST_MSG "491 %s :Not configured for your host" #define ERR_NOTONSAMECHANNEL_MSG "493 %s :You must share a common channel with %s"
@@ -151,7 +153,6 @@ #define ERR_UMODEUNKNOWNFLAG2_MSG "501 %s :Unknown mode "%c%c"" #define ERR_USERSDONTMATCH_MSG "502 %s :Can't set/get mode for other users" #define ERR_NOINVITE_MSG "518 %s :Cannot invite to %s (+V)" -#define ERR_CANNOTSENDTONICK_MSG "976 %s :Cannot send to user (+b) -- Only registered users can message %s"
#ifdef ZLIB # define RPL_STATSLINKINFOZIP_MSG "211 %s %s %d %ld %ld/%ld %ld %ld/%ld :%ld" diff --git a/src/testsuite/message-test.e b/src/testsuite/message-test.e index 4cbc066..6e63bb5 100644 --- a/src/testsuite/message-test.e +++ b/src/testsuite/message-test.e @@ -61,7 +61,7 @@ expect { send "privmsg nick :test\r" expect { timeout { exit 1 } - "976" + "486" } send "mode nick -b\r" expect {