Mercurial > pidgin
diff libpurple/protocols/irc/msgs.c @ 26627:fcd7d4c24230
Notify the user if an IRC /nick command fails, rather than trying fallbacks.
This code should not come into play on initial connect, but only on /nick
commands issued by the user. If it does, we'll have to try again.
Fixes #5181
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Sat, 18 Apr 2009 03:08:12 +0000 |
parents | b87843de7c6a |
children | bed515729afe |
line wrap: on
line diff
--- a/libpurple/protocols/irc/msgs.c Sat Apr 18 02:52:46 2009 +0000 +++ b/libpurple/protocols/irc/msgs.c Sat Apr 18 03:08:12 2009 +0000 @@ -1004,10 +1004,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