diff libpurple/protocols/irc/msgs.c @ 25565:68a5090f44eb

applied changes from 4b0e16d96a9ee2554770c4400445bee7ceb49d9a through e7b568313cd84adb8e24dcfd56c373fe3e331439
author Ethan Blanton <elb@pidgin.im>
date Tue, 28 Apr 2009 20:28:30 +0000
parents 24aa97dd601f
children 82b3079d1f24
line wrap: on
line diff
--- 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