[telepathy-glib/master] fd.o#25149: TpAccount: when invalidated, signal connection disconnection

Simon McVittie simon.mcvittie at collabora.co.uk
Fri Dec 18 09:42:00 PST 2009


If the account is deleted, the connection is about to be disconnected,
but we'll no longer tell the user that after we've been invalidated, so
tell them in advance.
---
 telepathy-glib/account.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
index 348e98f..7049f23 100644
--- a/telepathy-glib/account.c
+++ b/telepathy-glib/account.c
@@ -335,6 +335,27 @@ _tp_account_invalidated_cb (TpAccount *self,
   TpAccountPrivate *priv = self->priv;
   GList *l;
 
+  /* The connection will get disconnected as a result of account deletion,
+   * but by then we will no longer be telling the API user about changes -
+   * so claim the disconnection already happened (see fd.o#25149) */
+  if (priv->connection_status != TP_CONNECTION_STATUS_DISCONNECTED)
+    {
+      priv->connection_status = TP_CONNECTION_STATUS_DISCONNECTED;
+
+      if (domain == TP_DBUS_ERRORS && code == TP_DBUS_ERROR_OBJECT_REMOVED)
+        {
+          /* presumably the user asked for it to be deleted... */
+          priv->reason = TP_CONNECTION_STATUS_REASON_REQUESTED;
+        }
+      else
+        {
+          priv->reason = TP_CONNECTION_STATUS_REASON_NONE_SPECIFIED;
+        }
+
+      g_object_notify ((GObject *) self, "connection-status");
+      g_object_notify ((GObject *) self, "connection-status-reason");
+    }
+
   /* Make all currently pending callbacks fail. */
   for (l = priv->callbacks; l != NULL; l = l->next)
     {
-- 
1.5.6.5




More information about the telepathy-commits mailing list