[empathy/mc5: 42/483] Add a utility to set the presence on all requested accounts



commit 5182ada04ef43baabccfcc46b1ff0ea754f572b0
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Wed Jul 8 16:19:18 2009 +0100

    Add a utility to set the presence on all requested accounts

 libempathy/empathy-account-manager.c |   29 ++++++++++++++++++++++++++++-
 libempathy/empathy-account-manager.h |    6 ++++++
 2 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/libempathy/empathy-account-manager.c b/libempathy/empathy-account-manager.c
index c31ac01..b443c2c 100644
--- a/libempathy/empathy-account-manager.c
+++ b/libempathy/empathy-account-manager.c
@@ -40,7 +40,6 @@
 #define MC5_BUS_NAME "org.freedesktop.Telepathy.MissionControl5"
 
 typedef struct {
-
   /* (owned) unique name -> (reffed) EmpathyAccount */
   GHashTable       *accounts;
   int               connected;
@@ -874,3 +873,31 @@ empathy_account_manager_remove (EmpathyAccountManager *manager,
 {
   /* FIXME */
 }
+
+
+void
+empathy_account_manager_request_global_presence (
+  EmpathyAccountManager *manager,
+  TpConnectionPresenceType type,
+  const gchar *status,
+  const gchar *message)
+{
+  /* FIXME should remember requested presence and set it on new accounts
+     as well */
+  EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
+  GHashTableIter iter;
+  gpointer value;
+
+  g_hash_table_iter_init (&iter, priv->accounts);
+  while (g_hash_table_iter_next (&iter, NULL, &value))
+    {
+      EmpathyAccount *account = EMPATHY_ACCOUNT (value);
+      gboolean ready;
+
+      g_object_get (account, "ready", &ready, NULL);
+
+      if (ready)
+        empathy_account_request_presence (account, type, status, message);
+    }
+}
+
diff --git a/libempathy/empathy-account-manager.h b/libempathy/empathy-account-manager.h
index 2d77610..5d794bd 100644
--- a/libempathy/empathy-account-manager.h
+++ b/libempathy/empathy-account-manager.h
@@ -81,6 +81,12 @@ void                    empathy_account_manager_remove (
                                  EmpathyAccountManager *manager,
                                  EmpathyAccount *account);
 
+void empathy_account_manager_request_global_presence (
+  EmpathyAccountManager *manager,
+  TpConnectionPresenceType type,
+  const gchar *status,
+  const gchar *message);
+
 G_END_DECLS
 
 #endif /* __EMPATHY_ACCOUNT_MANAGER_H__ */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]