[Telepathy-commits] [telepathy-mission-control/master] Check if accounts can reconnect

Alberto Mardegan alberto.mardegan at nokia.com
Fri Jan 16 04:44:07 PST 2009


After disconnecting an account because its transport died, check whether the
same account can reconnect to some other transport.
---
 src/mcd-master.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/src/mcd-master.c b/src/mcd-master.c
index 3047f20..ffcd55a 100644
--- a/src/mcd-master.c
+++ b/src/mcd-master.c
@@ -128,6 +128,10 @@ typedef struct {
 
 static McdMaster *default_master = NULL;
 
+static gboolean account_conditions_satisfied (McdMasterPrivate *priv,
+                                              McdAccount *account);
+
+
 static inline void
 set_account_transport (McdAccount *account, McdTransport *transport)
 {
@@ -196,12 +200,22 @@ disconnect_account_transport (gpointer key, gpointer value, gpointer userdata)
     if (td->transport == get_account_transport (account))
     {
         McdConnection *connection;
+        McdMasterPrivate *priv;
 
 	g_debug ("%s: account %s must disconnect",
 		 G_STRFUNC, mcd_account_get_unique_name (account));
         connection = mcd_account_get_connection (account);
         mcd_connection_close (connection);
 	set_account_transport (account, NULL);
+
+        /* it may be that there is another transport to which the account can
+         * reconnect */
+        priv = MCD_MASTER_PRIV (td->master);
+        if (account_conditions_satisfied (priv, account))
+        {
+            g_debug ("conditions matched");
+            _mcd_account_request_connection (account);
+        }
     }
 }
 
-- 
1.5.6.5




More information about the Telepathy-commits mailing list