[Telepathy-commits] [telepathy-mission-control/master] Automatic presence logic belongs to McdAccount

Alberto Mardegan alberto.mardegan at nokia.com
Tue Nov 4 23:20:51 PST 2008


Make the _mcd_account_request_connection() available to other modules in MC
(but still not exported), and use it in pnstead of explicitly request the
automatic presence (which could be unset).
---
 src/mcd-account-priv.h |    1 +
 src/mcd-account.c      |    8 ++++----
 src/mcd-master.c       |   16 +++-------------
 3 files changed, 8 insertions(+), 17 deletions(-)

diff --git a/src/mcd-account-priv.h b/src/mcd-account-priv.h
index 81e4073..bd27e41 100644
--- a/src/mcd-account-priv.h
+++ b/src/mcd-account-priv.h
@@ -50,6 +50,7 @@ gboolean _mcd_account_online_request (McdAccount *account,
                                       McdOnlineRequestCb callback,
                                       gpointer userdata,
                                       GError **imm_error);
+void _mcd_account_request_connection (McdAccount *account);
 
 #endif /* __MCD_ACCOUNT_PRIV_H__ */
 
diff --git a/src/mcd-account.c b/src/mcd-account.c
index bb5666d..b4046e6 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -2059,14 +2059,14 @@ mcd_account_check_validity (McdAccount *account)
 }
 
 /*
- * mcd_account_request_connection:
+ * _mcd_account_request_connection:
  * @account: the #McdAccount.
  *
  * Request the account to go online. If an automatic presence is specified, set
  * it.
  */
-static void
-mcd_account_request_connection (McdAccount *account)
+void
+_mcd_account_request_connection (McdAccount *account)
 {
     McdAccountPrivate *priv = account->priv;
 
@@ -2113,7 +2113,7 @@ _mcd_account_online_request (McdAccount *account,
     {
 	/* listen to the StatusChanged signal */
        	if (priv->conn_status == TP_CONNECTION_STATUS_DISCONNECTED)
-            mcd_account_request_connection (account);
+            _mcd_account_request_connection (account);
 	if (!priv->connection)
 	{
 	    g_set_error (imm_error, TP_ERRORS, TP_ERROR_NOT_AVAILABLE,
diff --git a/src/mcd-master.c b/src/mcd-master.c
index 7371b7c..03808a8 100644
--- a/src/mcd-master.c
+++ b/src/mcd-master.c
@@ -63,6 +63,7 @@
 #include "mcd-account-manager.h"
 #include "mcd-account-conditions.h"
 #include "mcd-account-compat.h"
+#include "mcd-account-priv.h"
 #include "mcd-plugin.h"
 #include "mcd-transport.h"
 #include "mcd-account-connection.h"
@@ -160,13 +161,8 @@ check_account_transport (gpointer key, gpointer value, gpointer userdata)
     if (mcd_transport_plugin_check_conditions (td->plugin, td->transport,
 					       conditions))
     {
-	TpConnectionPresenceType presence;
-	const gchar *status, *message;
-
 	g_debug ("conditions matched");
-	mcd_account_get_automatic_presence (account, &presence,
-					    &status, &message);
-	mcd_account_request_presence (account, presence, status, message);
+        _mcd_account_request_connection (account);
 	set_account_transport (account, td->transport);
     }
     g_hash_table_destroy (conditions);
@@ -290,14 +286,8 @@ mcd_master_connect_automatic_accounts (McdMaster *master)
             /* if the account conditions are satisfied, connect */
             if (account_conditions_satisfied (priv, account))
             {
-                TpConnectionPresenceType presence;
-                const gchar *status, *message;
-
                 g_debug ("conditions matched");
-                mcd_account_get_automatic_presence (account, &presence,
-                                                    &status, &message);
-                mcd_account_request_presence (account, presence, status,
-                                              message);
+                _mcd_account_request_connection (account);
             }
         }
     }
-- 
1.5.6.5




More information about the Telepathy-commits mailing list