about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2011-08-19 11:09:40 +0200
committerAlexander Barton <alex@barton.de>2011-08-19 11:09:40 +0200
commit51d7674ee7b17553a7481b7a154145300797d6e3 (patch)
tree2342211e236e0048601f198a0b6f7f3fa492cfbd /src
parent1189200d4a1df4cf338c7d5979c2a54fc7edfc8d (diff)
downloadngircd-51d7674ee7b17553a7481b7a154145300797d6e3.tar.gz
ngircd-51d7674ee7b17553a7481b7a154145300797d6e3.zip
New 2nd message "Nickname too long" for error code 432
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/client.c9
-rw-r--r--src/ngircd/messages.h1
2 files changed, 8 insertions, 2 deletions
diff --git a/src/ngircd/client.c b/src/ngircd/client.c
index 0f151ac8..16c551f9 100644
--- a/src/ngircd/client.c
+++ b/src/ngircd/client.c
@@ -864,8 +864,13 @@ Client_CheckNick(CLIENT *Client, char *Nick)
 	assert(Nick != NULL);
 
 	if (!Client_IsValidNick(Nick)) {
-		IRC_WriteStrClient(Client, ERR_ERRONEUSNICKNAME_MSG,
-				   Client_ID(Client), Nick);
+		if (strlen(Nick ) >= Conf_MaxNickLength)
+			IRC_WriteStrClient(Client, ERR_NICKNAMETOOLONG_MSG,
+					   Client_ID(Client), Nick,
+					   Conf_MaxNickLength - 1);
+		else
+			IRC_WriteStrClient(Client, ERR_ERRONEUSNICKNAME_MSG,
+					   Client_ID(Client), Nick);
 		return false;
 	}
 
diff --git a/src/ngircd/messages.h b/src/ngircd/messages.h
index 93bef3d7..12791d23 100644
--- a/src/ngircd/messages.h
+++ b/src/ngircd/messages.h
@@ -105,6 +105,7 @@
 #define ERR_NOMOTD_MSG			"422 %s :MOTD file is missing"
 #define ERR_NONICKNAMEGIVEN_MSG		"431 %s :No nickname given"
 #define ERR_ERRONEUSNICKNAME_MSG	"432 %s %s :Erroneous nickname"
+#define ERR_NICKNAMETOOLONG_MSG		"432 %s %s :Nickname too long, max. %u characters"
 #define ERR_NICKNAMEINUSE_MSG		"433 %s %s :Nickname already in use"
 #define ERR_USERNOTINCHANNEL_MSG	"441 %s %s %s :They aren't on that channel"
 #define ERR_NOTONCHANNEL_MSG		"442 %s %s :You are not on that channel"