# HG changeset patch # User Daniel Atallah # Date 1217011854 0 # Node ID 429cd88862fdcf69f43c85cec980537550702d74 # Parent 70d39f235848d91534a1a7922a048c2097a4772c# Parent 1b7dea5ce0cd29d8c74ae65856aad7c961253ac5 merge of '4c5a026e3419c03409089efe76548d6642ca1e2a' and 'a1515f71238597d861299c4a998b98967c1d6ef9' diff -r 70d39f235848 -r 429cd88862fd libpurple/protocols/irc/irc.c --- a/libpurple/protocols/irc/irc.c Fri Jul 25 16:03:11 2008 +0000 +++ b/libpurple/protocols/irc/irc.c Fri Jul 25 18:50:54 2008 +0000 @@ -360,7 +360,8 @@ static gboolean do_login(PurpleConnection *gc) { char *buf, *tmp = NULL; - const char *hostname; + char *hostname, *server; + const char *hosttmp; const char *username, *realname; struct irc_conn *irc = gc->proto_data; const char *pass = purple_connection_get_password(gc); @@ -374,7 +375,6 @@ g_free(buf); } - hostname = purple_get_host_name(); realname = purple_account_get_string(irc->account, "realname", ""); username = purple_account_get_string(irc->account, "username", ""); @@ -389,9 +389,29 @@ } } - buf = irc_format(irc, "vvvv:", "USER", tmp ? tmp : username, hostname, irc->server, - strlen(realname) ? realname : IRC_DEFAULT_ALIAS); + hosttmp = purple_get_host_name(); + if (*hosttmp == ':') { + /* This is either an IPv6 address, or something which + * doesn't belong here. Either way, we need to escape + * it. */ + hostname = g_strdup_printf("0%s", hosttmp); + } else { + /* Ugly, I know. */ + hostname = g_strdup(hosttmp); + } + + if (*irc->server == ':') { + /* Same as hostname, above. */ + server = g_strdup_printf("0%s", irc->server); + } else { + server = g_strdup(irc->server); + } + + buf = irc_format(irc, "vvvv:", "USER", tmp ? tmp : username, hostname, server, + strlen(realname) ? realname : IRC_DEFAULT_ALIAS); g_free(tmp); + g_free(hostname); + g_free(server); if (irc_send(irc, buf) < 0) { g_free(buf); return FALSE;