changeset 30637:a1964c506f29

We should always display the "Authorize buddy?" mini-dialog, even if the buddy doesn't have a non-empty nickname. Fixes #12810. Also, why the hell did gotalias() return int? That should be void.
author ivan.komarov@soc.pidgin.im
date Wed, 27 Oct 2010 18:24:12 +0000
parents bebd0cf0a20f
children bbf7096ae66c
files libpurple/protocols/oscar/family_icq.c pidgin/gtkaccount.c
diffstat 2 files changed, 12 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/oscar/family_icq.c	Mon Oct 25 20:01:50 2010 +0000
+++ b/libpurple/protocols/oscar/family_icq.c	Wed Oct 27 18:24:12 2010 +0000
@@ -408,27 +408,27 @@
 	return 0;
 }
 
-static int
+static void
 gotalias(OscarData *od, struct aim_icq_info *info)
 {
 	PurpleConnection *gc = od->gc;
 	PurpleAccount *account = purple_connection_get_account(gc);
-	gchar who[16], *utf8;
 	PurpleBuddy *b;
+	gchar *utf8 = oscar_utf8_try_convert(account, od, info->nick);
 
-	if (info->nick[0] && (utf8 = oscar_utf8_try_convert(account, od, info->nick))) {
-		if (info->for_auth_request) {
-			oscar_auth_recvrequest(gc, g_strdup_printf("%u", info->uin), utf8, info->auth_request_reason);
-		} else {
+	if (info->for_auth_request) {
+		oscar_auth_recvrequest(gc, g_strdup_printf("%u", info->uin), utf8, info->auth_request_reason);
+	} else {
+		if (utf8 && *utf8) {
+			gchar who[16];
 			g_snprintf(who, sizeof(who), "%u", info->uin);
 			serv_got_alias(gc, who, utf8);
 			if ((b = purple_find_buddy(account, who))) {
 				purple_blist_node_set_string((PurpleBlistNode*)b, "servernick", utf8);
 			}
-			g_free(utf8);
 		}
+		g_free(utf8);
 	}
-	return 1;
 }
 
 /**
--- a/pidgin/gtkaccount.c	Mon Oct 25 20:01:50 2010 +0000
+++ b/pidgin/gtkaccount.c	Wed Oct 27 18:24:12 2010 +0000
@@ -2468,6 +2468,7 @@
 	GtkWidget *alert;
 	GdkPixbuf *prpl_icon;
 	struct auth_request *aa;
+	gboolean have_valid_alias = alias && *alias;
 
 	gc = purple_account_get_connection(account);
 	if (message != NULL && *message == '\0')
@@ -2475,9 +2476,9 @@
 
 	buffer = g_strdup_printf(_("%s%s%s%s wants to add you (%s) to his or her buddy list%s%s"),
 				remote_user,
-				(alias != NULL ? " ("  : ""),
-				(alias != NULL ? alias : ""),
-				(alias != NULL ? ")"   : ""),
+				(have_valid_alias ? " ("  : ""),
+				(have_valid_alias ? alias : ""),
+				(have_valid_alias ? ")"   : ""),
 				(id != NULL
 				? id
 				: (purple_connection_get_display_name(gc) != NULL