changeset 25565:68a5090f44eb

applied changes from 4b0e16d96a9ee2554770c4400445bee7ceb49d9a through e7b568313cd84adb8e24dcfd56c373fe3e331439
author Ethan Blanton <elb@pidgin.im>
date Tue, 28 Apr 2009 20:28:30 +0000
parents 490b39a1d438
children 82b3079d1f24
files ChangeLog libpurple/protocols/irc/msgs.c
diffstat 2 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Apr 28 20:27:09 2009 +0000
+++ b/ChangeLog	Tue Apr 28 20:28:30 2009 +0000
@@ -4,6 +4,9 @@
 	IRC:
 	* Correctly handle WHOIS for users who are joined to a large number of
 	  channels.
+	* Notify the user if a /nick command fails, rather than trying
+	  fallback nicks.
+	
 
 version 2.5.5 (03/01/2009):
 	libpurple:
--- a/libpurple/protocols/irc/msgs.c	Tue Apr 28 20:27:09 2009 +0000
+++ b/libpurple/protocols/irc/msgs.c	Tue Apr 28 20:28:30 2009 +0000
@@ -993,10 +993,23 @@
 void irc_msg_nickused(struct irc_conn *irc, const char *name, const char *from, char **args)
 {
 	char *newnick, *buf, *end;
+	PurpleConnection *gc = purple_account_get_connection(irc->account);
 
 	if (!args || !args[1])
 		return;
 
+	if (gc && purple_connection_get_state(gc) == PURPLE_CONNECTED) {
+		/* We only want to do the following dance if the connection
+		   has not been successfully completed.  If it has, just
+		   notify the user that their /nick command didn't go. */
+		buf = g_strdup_printf(_("The nickname \"%s\" is already being used."),
+				      irc->reqnick);
+		purple_notify_error(gc, _("Nickname in use"),
+				    _("Nickname in use"), buf);
+		g_free(buf);
+		g_free(irc->reqnick);
+	}
+
 	if (strlen(args[1]) < strlen(irc->reqnick) || irc->nickused)
 		newnick = g_strdup(args[1]);
 	else