aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-08-21 01:04:49 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-08-21 01:04:49 +0800
commitbaa418e11bf914a99a5ce40d12c964cb394e0e63 (patch)
tree8bb31486bcb4ed8c879ffc0a6f6093705859c195 /libempathy
parentdcb2ab438c8b9d02e6eef6a53d93242836db2ae7 (diff)
downloadgsoc2013-empathy-baa418e11bf914a99a5ce40d12c964cb394e0e63.tar
gsoc2013-empathy-baa418e11bf914a99a5ce40d12c964cb394e0e63.tar.gz
gsoc2013-empathy-baa418e11bf914a99a5ce40d12c964cb394e0e63.tar.bz2
gsoc2013-empathy-baa418e11bf914a99a5ce40d12c964cb394e0e63.tar.lz
gsoc2013-empathy-baa418e11bf914a99a5ce40d12c964cb394e0e63.tar.xz
gsoc2013-empathy-baa418e11bf914a99a5ce40d12c964cb394e0e63.tar.zst
gsoc2013-empathy-baa418e11bf914a99a5ce40d12c964cb394e0e63.zip
Set the RequestedPresence when creating a new command
When we create a new account set the initial value of RequestedPresence to the global requested presence, but don't enable it by default. This will cause its requested presence to always be in sync with the rest of empathy.
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-account-settings.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/libempathy/empathy-account-settings.c b/libempathy/empathy-account-settings.c
index 4bafac2c9..6d43c4788 100644
--- a/libempathy/empathy-account-settings.c
+++ b/libempathy/empathy-account-settings.c
@@ -23,6 +23,8 @@
#include <stdlib.h>
#include <telepathy-glib/util.h>
+#include <telepathy-glib/interfaces.h>
+#include <telepathy-glib/gtypes.h>
#include "empathy-account-settings.h"
#include "empathy-account-manager.h"
@@ -942,8 +944,41 @@ empathy_account_settings_do_create_account (EmpathyAccountSettings *settings)
{
EmpathyAccountSettingsPriv *priv = GET_PRIV (settings);
GHashTable *properties;
+ TpConnectionPresenceType type;
+ gchar *status;
+ gchar *message;
- properties = g_hash_table_new (NULL, NULL);
+ properties = tp_asv_new (NULL, NULL);
+
+ type = empathy_account_manager_get_requested_global_presence
+ (priv->account_manager, &status, &message);
+
+ if (type != TP_CONNECTION_PRESENCE_TYPE_UNSET)
+ {
+ /* Create the account with the requested presence the same as the current
+ * global requested presence, but don't enable it */
+ GValueArray *presence;
+ GValue vtype = { 0, };
+ GValue vstatus = { 0, };
+ GValue vmessage = { 0, };
+
+ presence = g_value_array_new (3);
+
+ g_value_init (&vtype, G_TYPE_UINT);
+ g_value_set_uint (&vtype, type);
+ g_value_array_append (presence, &vtype);
+
+ g_value_init (&vstatus, G_TYPE_STRING);
+ g_value_take_string (&vstatus, status);
+ g_value_array_append (presence, &vstatus);
+
+ g_value_init (&vmessage, G_TYPE_STRING);
+ g_value_take_string (&vmessage, message);
+ g_value_array_append (presence, &vmessage);
+
+ tp_asv_take_boxed (properties, TP_IFACE_ACCOUNT ".RequestedPresence",
+ TP_STRUCT_TYPE_SIMPLE_PRESENCE, presence);
+ }
empathy_account_manager_create_account_async (priv->account_manager,
priv->cm_name, priv->protocol, priv->display_name,