aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorCosimo Cecchi <cosimoc@gnome.org>2009-07-24 01:22:30 +0800
committerCosimo Cecchi <cosimoc@gnome.org>2009-07-30 06:13:19 +0800
commit68d69476f586e377ce45af014f7e4eeb8acd3b8d (patch)
tree22fa8fea6e3d2f65f09bea576284e3e1bf2e6976 /libempathy
parentd5c41662829057e80268b6771fbe7452aa36a814 (diff)
downloadgsoc2013-empathy-68d69476f586e377ce45af014f7e4eeb8acd3b8d.tar
gsoc2013-empathy-68d69476f586e377ce45af014f7e4eeb8acd3b8d.tar.gz
gsoc2013-empathy-68d69476f586e377ce45af014f7e4eeb8acd3b8d.tar.bz2
gsoc2013-empathy-68d69476f586e377ce45af014f7e4eeb8acd3b8d.tar.lz
gsoc2013-empathy-68d69476f586e377ce45af014f7e4eeb8acd3b8d.tar.xz
gsoc2013-empathy-68d69476f586e377ce45af014f7e4eeb8acd3b8d.tar.zst
gsoc2013-empathy-68d69476f586e377ce45af014f7e4eeb8acd3b8d.zip
Respect the global presence when enabling an account
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-account-manager.c39
1 files changed, 36 insertions, 3 deletions
diff --git a/libempathy/empathy-account-manager.c b/libempathy/empathy-account-manager.c
index 7339acb9f..09bb68126 100644
--- a/libempathy/empathy-account-manager.c
+++ b/libempathy/empathy-account-manager.c
@@ -55,6 +55,13 @@ typedef struct {
TpConnectionPresenceType global_presence;
gchar *global_status;
gchar *global_status_message;
+
+ /* desired global presence, could be different
+ * from the actual global one.
+ */
+ TpConnectionPresenceType desired_presence;
+ gchar *desired_status;
+ gchar *desired_status_message;
} EmpathyAccountManagerPriv;
enum {
@@ -769,8 +776,6 @@ empathy_account_manager_request_global_presence (
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;
@@ -786,6 +791,23 @@ empathy_account_manager_request_global_presence (
if (ready)
empathy_account_request_presence (account, type, status, message);
}
+
+ /* save the requested global presence, to use it in case we create
+ * new accounts.
+ */
+ priv->desired_presence = type;
+
+ if (tp_strdiff (priv->desired_status, status))
+ {
+ g_free (priv->desired_status);
+ priv->desired_status = g_strdup (status);
+ }
+
+ if (tp_strdiff (priv->desired_status_message, message))
+ {
+ g_free (priv->desired_status_message);
+ priv->desired_status_message = g_strdup (message);
+ }
}
TpConnectionPresenceType
@@ -875,6 +897,9 @@ EmpathyAccount *
empathy_account_manager_create_account_finish (
EmpathyAccountManager *manager, GAsyncResult *result, GError **error)
{
+ EmpathyAccount *retval;
+ EmpathyAccountManagerPriv *priv = GET_PRIV (manager);
+
if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (result),
error))
return NULL;
@@ -882,7 +907,15 @@ empathy_account_manager_create_account_finish (
g_return_val_if_fail (g_simple_async_result_is_valid (result,
G_OBJECT (manager), empathy_account_manager_create_account_finish), NULL);
- return EMPATHY_ACCOUNT (g_simple_async_result_get_op_res_gpointer (
+ retval = EMPATHY_ACCOUNT (g_simple_async_result_get_op_res_gpointer (
G_SIMPLE_ASYNC_RESULT (result)));
+
+ /* if we have an account, it's ready, as we waited for it.
+ * request the global presence now.
+ */
+ empathy_account_request_presence (retval, priv->desired_presence,
+ priv->desired_status, priv->desired_status_message);
+
+ return retval;
}