telepathy-mission-control: McdAccount: factor out code to reconnect

Xavier Claessens xclaesse at kemper.freedesktop.org
Wed Sep 5 03:57:33 PDT 2012


Module: telepathy-mission-control
Branch: master
Commit: 81c21ac1e2755dd63ecca892d0dbc65f9c4aa8c6
URL:    http://cgit.freedesktop.org/telepathy/telepathy-mission-control/commit/?id=81c21ac1e2755dd63ecca892d0dbc65f9c4aa8c6

Author: Xavier Claessens <xavier.claessens at collabora.co.uk>
Date:   Wed Sep  5 12:10:12 2012 +0200

McdAccount: factor out code to reconnect

---

 src/mcd-account-priv.h |    4 ++++
 src/mcd-account.c      |   23 +++++++++++++++--------
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/src/mcd-account-priv.h b/src/mcd-account-priv.h
index d856eed..0c8a4d6 100644
--- a/src/mcd-account-priv.h
+++ b/src/mcd-account-priv.h
@@ -179,4 +179,8 @@ gboolean _mcd_account_is_hidden (McdAccount *account);
 
 G_GNUC_INTERNAL gboolean _mcd_account_needs_dispatch (McdAccount *account);
 
+G_GNUC_INTERNAL void _mcd_account_reconnect (McdAccount *self,
+    gboolean user_initiated);
+
+
 #endif /* __MCD_ACCOUNT_PRIV_H__ */
diff --git a/src/mcd-account.c b/src/mcd-account.c
index c07ba67..b763796 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -2706,6 +2706,20 @@ account_update_parameters (TpSvcAccount *self, GHashTable *set,
                                  account_update_parameters_cb, context);
 }
 
+void
+_mcd_account_reconnect (McdAccount *self,
+    gboolean user_initiated)
+{
+    /* FIXME: this isn't quite right. If we've just called RequestConnection
+     * (possibly with out of date parameters) but we haven't got a Connection
+     * back from the CM yet, the old parameters will still be used, I think
+     * (I can't quite make out what actually happens). */
+    if (self->priv->connection)
+        mcd_connection_close (self->priv->connection);
+
+    _mcd_account_connection_begin (self, user_initiated);
+}
+
 static void
 account_reconnect (TpSvcAccount *service,
                    DBusGMethodInvocation *context)
@@ -2729,15 +2743,8 @@ account_reconnect (TpSvcAccount *service,
         return;
     }
 
-    /* FIXME: this isn't quite right. If we've just called RequestConnection
-     * (possibly with out of date parameters) but we haven't got a Connection
-     * back from the CM yet, the old parameters will still be used, I think
-     * (I can't quite make out what actually happens). */
-    if (priv->connection)
-        mcd_connection_close (priv->connection);
-
     /* Reconnect() counts as user-initiated */
-    _mcd_account_connection_begin (self, TRUE);
+    _mcd_account_reconnect (self, TRUE);
 
     /* FIXME: we shouldn't really return from this method until the
      * reconnection has actually happened, but that would require less tangled



More information about the telepathy-commits mailing list