diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2013-09-18 11:03:14 +0200 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2013-09-18 13:01:24 +0200 |
commit | 1e173554d91bce1db263cf88d141fbbfdb5139e7 (patch) | |
tree | 9b62afed12dc40ba8deb2ecd4357365e23ddd074 | |
parent | 41a6272957a830e20a66e727263fc4446c321f5d (diff) |
write-mgr-file: write Presence properties
https://bugs.freedesktop.org/show_bug.cgi?id=69519
-rw-r--r-- | src/write-mgr-file.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/write-mgr-file.c b/src/write-mgr-file.c index d0cddaba1..8670e4323 100644 --- a/src/write-mgr-file.c +++ b/src/write-mgr-file.c @@ -277,6 +277,45 @@ write_rccs (GKeyFile *f, const gchar *section_name, GHashTable *props) g_strfreev (group_names); } +static void +write_presence (GKeyFile *f, + const gchar *section_name, + GHashTable *props) +{ + GHashTable *statuses; + GHashTableIter iter; + gpointer k, v; + + statuses = tp_asv_get_boxed (props, + TP_PROP_PROTOCOL_INTERFACE_PRESENCE_STATUSES, + TP_HASH_TYPE_SIMPLE_STATUS_SPEC_MAP); + g_return_if_fail (statuses != NULL); + + g_hash_table_iter_init (&iter, statuses); + while (g_hash_table_iter_next (&iter, &k, &v)) + { + const gchar *id = k; + GValueArray *status = v; + TpConnectionPresenceType type; + gboolean may_set_on_self, can_have_msg; + gchar *key, *value; + + key = g_strdup_printf("status-%s", id); + + tp_value_array_unpack (status, 3, &type, &may_set_on_self, &can_have_msg); + + value = g_strdup_printf ("%u%s%s", + type, + may_set_on_self ? " settable" : "", + can_have_msg ? " message" : ""); + + g_key_file_set_string (f, section_name, key, value); + + g_free (key); + g_free (value); + } +} + static gchar * mgr_file_contents (const char *busname, const char *objpath, @@ -369,6 +408,8 @@ mgr_file_contents (const char *busname, TP_PROP_PROTOCOL_INTERFACE_AVATARS_MAXIMUM_AVATAR_BYTES, NULL)); + write_presence (f, section_name, props); + WRITE_STR (TP_PROP_PROTOCOL_VCARD_FIELD, "VCardField"); WRITE_STR (TP_PROP_PROTOCOL_ENGLISH_NAME, "EnglishName"); WRITE_STR (TP_PROP_PROTOCOL_ICON, "Icon"); |