soc.2009.telepathy: ea2cdb65: Connect to Account's interface Removed s...

sttwister at soc.pidgin.im sttwister at soc.pidgin.im
Tue Jul 21 09:26:03 EDT 2009


-----------------------------------------------------------------
Revision: ea2cdb659b94078c0caf6e40873fcf6560836f78
Ancestor: 4aa5d6cf68a0f87515972a730c91632d8901c97a
Author: sttwister at soc.pidgin.im
Date: 2009-07-21T13:21:42
Branch: im.pidgin.soc.2009.telepathy
URL: http://d.pidgin.im/viewmtn/revision/info/ea2cdb659b94078c0caf6e40873fcf6560836f78

Modified files:
        libpurple/protocols/telepathy/telepathy_account.c

ChangeLog: 

Connect to Account's interface Removed signal and also remove account from purple

-------------- next part --------------
============================================================
--- libpurple/protocols/telepathy/telepathy_account.c	0734cfe7e7ac557b2262b7c5f65d658d7dc20c77
+++ libpurple/protocols/telepathy/telepathy_account.c	fe5599a0202c1de2e6fccf2ed2b510dc7acab81f
@@ -366,6 +366,20 @@ static void
 }
 
 static void
+account_removed_cb (TpAccount *proxy,
+                    gpointer user_data,
+                    GObject *weak_object)
+{
+	telepathy_account *account_data = user_data;
+
+	purple_debug_info("telepathy", "Account %s removed!\n",
+			purple_account_get_username(account_data->account));	
+
+	if (account_data->account)
+		purple_accounts_remove(account_data->account);
+}
+
+static void
 create_account_cb (TpAccountManager *proxy,
                    const gchar *out_Account,
                    const GError *error,
@@ -404,6 +418,16 @@ create_account_cb (TpAccountManager *pro
 		return;
 	}
 
+	tp_cli_account_connect_to_removed(tp_account,
+			account_removed_cb, account_data, NULL, NULL, &err);
+
+	if (err != NULL)
+	{
+		purple_debug_error("telepathy", "Error connecting to Removed: %s\n",
+				err->message);
+		g_error_free(err);
+	}
+
 	account_data->obj_Path = g_strdup((gchar *)out_Account);
 	account_data->tp_account = tp_account;
 }
@@ -495,7 +519,7 @@ purple_account_removed_cb (PurpleAccount
 {
 	telepathy_account *account_data;
 
-	purple_debug_info("telepathy", "Account removed!\n");
+	purple_debug_info("telepathy", "PurpleAccount removed!\n");
 
 	account_data = (telepathy_account*)purple_account_get_int(
 			account, "tp_account_data", 0);
@@ -504,9 +528,12 @@ purple_account_removed_cb (PurpleAccount
 	{
 		purple_account_set_int(account, "tp_account_data", 0);
 
-		tp_cli_account_call_remove(account_data->tp_account, -1,
-				remove_account_cb, account_data,
-				NULL, NULL);
+		if (account_data->tp_account)
+		{
+			tp_cli_account_call_remove(account_data->tp_account, -1,
+					remove_account_cb, account_data,
+					NULL, NULL);
+		}
 	}
 }
 
@@ -572,6 +599,18 @@ get_valid_accounts_cb (TpProxy *proxy,
 		tp_cli_dbus_properties_call_get_all(account, -1, TP_IFACE_ACCOUNT,
 				get_account_properties_cb, account_data, NULL, NULL);
 
+		tp_cli_account_connect_to_removed(account,
+				account_removed_cb, account_data,
+				NULL, NULL, &err);
+
+		if (err != NULL)
+		{
+			purple_debug_error("telepathy", "Error connecting to Removed: %s\n",
+					err->message);
+			g_error_free(err);
+			continue;
+		}
+
 	}
 
 	/* FIXME: Is purple_accounts_get_handle() the right one to pass as the handle?


More information about the Commits mailing list