pidgin: b4c65c27: We should always display the "Authorize ...

ivan.komarov at soc.pidgin.im ivan.komarov at soc.pidgin.im
Wed Oct 27 14:31:07 EDT 2010


----------------------------------------------------------------------
Revision: b4c65c273f2934560d9e643a124b31ac2d2328f2
Parent:   b750e3beda24d8f5daf07bb90daf2790c6b4a6c9
Author:   ivan.komarov at soc.pidgin.im
Date:     10/27/10 14:24:12
Branch:   im.pidgin.pidgin
URL: http://d.pidgin.im/viewmtn/revision/info/b4c65c273f2934560d9e643a124b31ac2d2328f2

Changelog: 

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.

Changes against parent b750e3beda24d8f5daf07bb90daf2790c6b4a6c9

  patched  libpurple/protocols/oscar/family_icq.c
  patched  pidgin/gtkaccount.c

-------------- next part --------------
============================================================
--- pidgin/gtkaccount.c	67355ddf08aa04ea8bc82450a9b0276a03937981
+++ pidgin/gtkaccount.c	c6c6f42af0d54071a143aeab36b4165866907064
@@ -2468,6 +2468,7 @@ pidgin_accounts_request_authorization(Pu
 	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 @@ pidgin_accounts_request_authorization(Pu
 
 	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
============================================================
--- libpurple/protocols/oscar/family_icq.c	6e79de6d0d602cb32962d5a6eb9884d41ecf4d2a
+++ libpurple/protocols/oscar/family_icq.c	da2f91e3871e683861698a416bb17e6f4fc7eca1
@@ -408,27 +408,27 @@ int aim_icq_sendsms(OscarData *od, const
 	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;
 }
 
 /**


More information about the Commits mailing list