/soc/2013/ankitkv/gobjectification: 0f0d6ae2fb77: Allow disconne...

Ankit Vani a at nevitus.org
Tue Oct 1 10:09:26 EDT 2013


Changeset: 0f0d6ae2fb7740cbfb3626ecfb79646d0377f5a4
Author:	 Ankit Vani <a at nevitus.org>
Date:	 2013-10-01 19:34 +0530
Branch:	 soc.2013.gobjectification
URL: https://hg.pidgin.im/soc/2013/ankitkv/gobjectification/rev/0f0d6ae2fb77

Description:

Allow disconnection on purple_account_set_enabled() when gc->wants_to_die is TRUE

diffstat:

 libpurple/account.c |  14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)

diffs (43 lines):

diff --git a/libpurple/account.c b/libpurple/account.c
--- a/libpurple/account.c
+++ b/libpurple/account.c
@@ -865,10 +865,10 @@ purple_account_set_enabled(PurpleAccount
 {
 	PurpleConnection *gc;
 	PurpleAccountPrivate *priv;
-	gboolean was_enabled = FALSE;
+	gboolean was_enabled = FALSE, wants_to_die = FALSE;
 
 	g_return_if_fail(PURPLE_IS_ACCOUNT(account));
-	g_return_if_fail(ui      != NULL);
+	g_return_if_fail(ui != NULL);
 
 	was_enabled = purple_account_get_enabled(account, ui);
 
@@ -881,11 +881,11 @@ purple_account_set_enabled(PurpleAccount
 		purple_signal_emit(purple_accounts_get_handle(), "account-enabled", account);
 
 	if ((gc != NULL) && (_purple_connection_wants_to_die(gc)))
-		return;
+		wants_to_die = TRUE;
 
 	priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
 
-	if (value && purple_presence_is_online(priv->presence))
+	if (!wants_to_die && value && purple_presence_is_online(priv->presence))
 		purple_account_connect(account);
 	else if (!value && !purple_account_is_disconnected(account))
 		purple_account_disconnect(account);
@@ -2947,11 +2947,7 @@ purple_account_constructed(GObject *obje
 static void
 purple_account_dispose(GObject *object)
 {
-	PurpleAccount *account = PURPLE_ACCOUNT(object);
-	PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(account);
-
-	if (!purple_account_is_disconnected(account))
-		purple_account_disconnect(account);
+	PurpleAccountPrivate *priv = PURPLE_ACCOUNT_GET_PRIVATE(object);
 
 	if (priv->presence) {
 		g_object_unref(priv->presence);



More information about the Commits mailing list