im.pidgin.pidgin: 6523df90f67ed0428e11d3ebc7bf15777986ebcf

datallah at pidgin.im datallah at pidgin.im
Wed Jan 9 17:20:56 EST 2008


-----------------------------------------------------------------
Revision: 6523df90f67ed0428e11d3ebc7bf15777986ebcf
Ancestor: bfc4df11256d088d75b0512bb0c4790967b68b19
Author: datallah at pidgin.im
Date: 2008-01-09T22:14:17
Branch: im.pidgin.pidgin

Modified files:
        libpurple/account.c pidgin/gtkaccount.c

ChangeLog: 

This makes authorization requests go away when the account is disconnected.  It will leak the protocol's user_data, but without an API change, there isn't much that can be done about that. References #4609

-------------- next part --------------
============================================================
--- libpurple/account.c	5beeb530b7c219a9e25bb43cc2cf534f54d3298a
+++ libpurple/account.c	470cb78fcf962b8b258a62c7ac6758fa94b55256
@@ -1219,7 +1219,11 @@ purple_account_request_close_info(Purple
 	if (ops != NULL && ops->close_account_request != NULL)
 		ops->close_account_request(info->ui_handle);
 
+	/* TODO: This will leak info->user_data, but there is no callback to just clean that up */
+
+	g_free(info->user);
 	g_free(info);
+
 }
 
 void
@@ -1264,9 +1268,14 @@ request_auth_cb(void *data)
 request_auth_cb(void *data)
 {
 	PurpleAccountRequestInfo *info = data;
+
+	handles = g_list_remove(handles, info);
+
 	info->auth_cb(info->userdata);
+
 	purple_signal_emit(purple_accounts_get_handle(),
 			"account-authorization-granted", info->account, info->user);
+
 	g_free(info->user);
 	g_free(info);
 }
@@ -1275,9 +1284,14 @@ request_deny_cb(void *data)
 request_deny_cb(void *data)
 {
 	PurpleAccountRequestInfo *info = data;
+
+	handles = g_list_remove(handles, info);
+
 	info->deny_cb(info->userdata);
+
 	purple_signal_emit(purple_accounts_get_handle(),
 			"account-authorization-denied", info->account, info->user);
+
 	g_free(info->user);
 	g_free(info);
 }
============================================================
--- pidgin/gtkaccount.c	71167f83a5488f9d35c3013fccd58b4553f3ef9e
+++ pidgin/gtkaccount.c	db9cd72693c548f79a3c17bf1fa5f8a3a49a8ed9
@@ -241,7 +241,7 @@ set_account_protocol_cb(GtkWidget *item,
 
 	gtk_widget_grab_focus(dialog->protocol_menu);
 
-	if (!dialog->prpl_info || !dialog->prpl_info->register_user || 
+	if (!dialog->prpl_info || !dialog->prpl_info->register_user ||
 	    g_object_get_data(G_OBJECT(item), "fake")) {
 		gtk_widget_hide(dialog->register_button);
 	} else {
@@ -2478,6 +2478,7 @@ pidgin_accounts_request_authorization(Pu
 						  _("Authorize"), authorize_and_add_cb,
 						  _("Deny"), deny_no_add_cb,
 						  NULL);
+		g_object_set_data(G_OBJECT(alert), "auth_and_add", aa);
 	} else {
 		alert = pidgin_make_mini_dialog(gc, PIDGIN_STOCK_DIALOG_QUESTION,
 						  _("Authorize buddy?"), buffer, user_data,
@@ -2489,13 +2490,20 @@ pidgin_accounts_request_authorization(Pu
 
 	g_free(buffer);
 
-	return NULL;
+	return alert;
 }
 
 static void
 pidgin_accounts_request_close(void *ui_handle)
 {
-
+	/* This is super ugly, but without API changes, this is how it works */
+	struct auth_and_add *aa = g_object_get_data(G_OBJECT(ui_handle), "auth_and_add");
+	if (aa != NULL) {
+		g_free(aa->username);
+		g_free(aa->alias);
+		g_free(aa);
+	}
+	gtk_widget_destroy(GTK_WIDGET(ui_handle));
 }
 
 static PurpleAccountUiOps ui_ops =


More information about the Commits mailing list