summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
authorBerke Viktor <bviktor@hexchat.org>2013-05-18 22:09:44 +0200
committerBerke Viktor <bviktor@hexchat.org>2013-05-18 22:09:44 +0200
commit9d717ffee9d3ebb88c08312a3c8bd20f24c1dd8e (patch)
treefea8613b1c703934570b7461bf2c57243ec28026 /src/common
parentbac96d1fa8fb5c6ffd8715a25400e7759c153a21 (diff)
Fix text event for erroneous nicks
Diffstat (limited to 'src/common')
-rw-r--r--src/common/inbound.c22
-rw-r--r--src/common/inbound.h2
-rw-r--r--src/common/proto-irc.c15
-rw-r--r--src/common/textevents.in10
4 files changed, 40 insertions, 9 deletions
diff --git a/src/common/inbound.c b/src/common/inbound.c
index 3025ebf7..06cabd45 100644
--- a/src/common/inbound.c
+++ b/src/common/inbound.c
@@ -1145,7 +1145,7 @@ check_autojoin_channels (server *serv)
 }
 
 void
-inbound_next_nick (session *sess, char *nick)
+inbound_next_nick (session *sess, char *nick, int error)
 {
 	char *newnick;
 	server *serv = sess->server;
@@ -1160,14 +1160,30 @@ inbound_next_nick (session *sess, char *nick)
 		net = serv->network;
 		/* use network specific "Second choice"? */
 		if (net && !(net->flags & FLAG_USE_GLOBAL) && net->nick2)
+		{
 			newnick = net->nick2;
+		}
 		serv->p_change_nick (serv, newnick);
-		EMIT_SIGNAL (XP_TE_NICKCLASH, sess, nick, newnick, NULL, NULL, 0);
+		if (error)
+		{
+			EMIT_SIGNAL (XP_TE_NICKERROR, sess, nick, newnick, NULL, NULL, 0);
+		}
+		else
+		{
+			EMIT_SIGNAL (XP_TE_NICKCLASH, sess, nick, newnick, NULL, NULL, 0);
+		}
 		break;
 
 	case 3:
 		serv->p_change_nick (serv, prefs.hex_irc_nick3);
-		EMIT_SIGNAL (XP_TE_NICKCLASH, sess, nick, prefs.hex_irc_nick3, NULL, NULL, 0);
+		if (error)
+		{
+			EMIT_SIGNAL (XP_TE_NICKERROR, sess, nick, prefs.hex_irc_nick3, NULL, NULL, 0);
+		}
+		else
+		{
+			EMIT_SIGNAL (XP_TE_NICKCLASH, sess, nick, prefs.hex_irc_nick3, NULL, NULL, 0);
+		}
 		break;
 
 	default:
diff --git a/src/common/inbound.h b/src/common/inbound.h
index e90ef8c3..32368cc1 100644
--- a/src/common/inbound.h
+++ b/src/common/inbound.h
@@ -20,7 +20,7 @@
 #ifndef HEXCHAT_INBOUND_H
 #define HEXCHAT_INBOUND_H
 
-void inbound_next_nick (session *sess, char *nick);
+void inbound_next_nick (session *sess, char *nick, int error);
 void inbound_uback (server *serv);
 void inbound_uaway (server *serv);
 void inbound_account (server *serv, char *nick, char *account);
diff --git a/src/common/proto-irc.c b/src/common/proto-irc.c
index 53916484..d3a17f55 100644
--- a/src/common/proto-irc.c
+++ b/src/common/proto-irc.c
@@ -835,17 +835,26 @@ process_numeric (session * sess, int n,
 		inbound_login_end (sess, text);
 		break;
 
-	case 433:	/* nickname in use */
 	case 432:	/* erroneous nickname */
 		if (serv->end_of_motd)
+		{
+			goto def;
+		}
+		inbound_next_nick (sess,  word[4], 1);
+		break;
+
+	case 433:	/* nickname in use */
+		if (serv->end_of_motd)
+		{
 			goto def;
-		inbound_next_nick (sess,  word[4]);
+		}
+		inbound_next_nick (sess,  word[4], 0);
 		break;
 
 	case 437:
 		if (serv->end_of_motd || is_channel (serv, word[4]))
 			goto def;
-		inbound_next_nick (sess, word[4]);
+		inbound_next_nick (sess, word[4], 0);
 		break;
 
 	case 471:
diff --git a/src/common/textevents.in b/src/common/textevents.in
index 3b0b676a..c86af2bc 100644
--- a/src/common/textevents.in
+++ b/src/common/textevents.in
@@ -529,13 +529,19 @@ pevt_generic_none_help
 Nick Clash
 XP_TE_NICKCLASH
 pevt_nickclash_help
-%C23*%O$t%C28$1%C already in use. Retrying with %C18$2%O...
+%C23*%O$t%C28$1%C is already in use. Retrying with %C18$2%O...
+2
+
+Nick Erroneous
+XP_TE_NICKERROR
+pevt_nickclash_help
+%C23*%O$t%C28$1%C is erroneous. Retrying with %C18$2%O...
 2
 
 Nick Failed
 XP_TE_NICKFAIL
 pevt_generic_none_help
-%C20*%O$tNickname already in use. Use /NICK to try another.
+%C20*%O$tNickname is erroneous or already in use. Use /NICK to try another.
 0
 
 No DCC