summaryrefslogtreecommitdiff
path: root/telepathy-glib/contact.c
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.co.uk>2012-06-08 16:28:49 +0200
committerXavier Claessens <xavier.claessens@collabora.co.uk>2012-09-11 10:35:34 +0200
commit6555f449c4b6490f08d7b2c8c523faa4c542b89d (patch)
treede9f7fcf40440551266b86239501a3dc5dbfc81f /telepathy-glib/contact.c
parent0e224c223a3a78f20c3b940129c7bba84f815f6d (diff)
downloadtelepathy-glib-6555f449c4b6490f08d7b2c8c523faa4c542b89d.tar.gz
TpContact: do not override properties with attributes we didn't request
We check wanted flags for everything but States and Groups, there is no reason for that. Besides, if we did not request those attributes, there are chances we didn't bind to change notification neither.
Diffstat (limited to 'telepathy-glib/contact.c')
-rw-r--r--telepathy-glib/contact.c61
1 files changed, 34 insertions, 27 deletions
diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c
index ea2c178a7..988be1120 100644
--- a/telepathy-glib/contact.c
+++ b/telepathy-glib/contact.c
@@ -3649,6 +3649,7 @@ tp_contact_set_attributes (TpContact *contact,
const gchar *s;
gpointer boxed;
+ /* Identifier */
s = tp_asv_get_string (asv, TP_TOKEN_CONNECTION_CONTACT_ID);
if (s == NULL)
@@ -3676,7 +3677,7 @@ tp_contact_set_attributes (TpContact *contact,
return FALSE;
}
-
+ /* Alias */
if (wanted & CONTACT_FEATURE_FLAG_ALIAS)
{
s = tp_asv_get_string (asv,
@@ -3697,6 +3698,7 @@ tp_contact_set_attributes (TpContact *contact,
}
}
+ /* Avatar */
if (wanted & CONTACT_FEATURE_FLAG_AVATAR_TOKEN)
{
s = tp_asv_get_string (asv,
@@ -3711,6 +3713,7 @@ tp_contact_set_attributes (TpContact *contact,
contact_maybe_update_avatar_data (contact);
}
+ /* Presence */
if (wanted & CONTACT_FEATURE_FLAG_PRESENCE)
{
boxed = tp_asv_get_boxed (asv,
@@ -3764,34 +3767,38 @@ tp_contact_set_attributes (TpContact *contact,
}
/* ContactList subscription states */
- {
- TpSubscriptionState subscribe;
- TpSubscriptionState publish;
- const gchar *publish_request;
- gboolean subscribe_valid = FALSE;
- gboolean publish_valid = FALSE;
-
- subscribe = tp_asv_get_uint32 (asv,
- TP_TOKEN_CONNECTION_INTERFACE_CONTACT_LIST_SUBSCRIBE,
- &subscribe_valid);
- publish = tp_asv_get_uint32 (asv,
- TP_TOKEN_CONNECTION_INTERFACE_CONTACT_LIST_PUBLISH,
- &publish_valid);
- publish_request = tp_asv_get_string (asv,
- TP_TOKEN_CONNECTION_INTERFACE_CONTACT_LIST_PUBLISH_REQUEST);
-
- if (subscribe_valid && publish_valid)
- {
- contact_set_subscription_states (contact, subscribe, publish,
- publish_request);
- }
- }
+ if (wanted & CONTACT_FEATURE_FLAG_STATES)
+ {
+ TpSubscriptionState subscribe;
+ TpSubscriptionState publish;
+ const gchar *publish_request;
+ gboolean subscribe_valid = FALSE;
+ gboolean publish_valid = FALSE;
+
+ subscribe = tp_asv_get_uint32 (asv,
+ TP_TOKEN_CONNECTION_INTERFACE_CONTACT_LIST_SUBSCRIBE,
+ &subscribe_valid);
+ publish = tp_asv_get_uint32 (asv,
+ TP_TOKEN_CONNECTION_INTERFACE_CONTACT_LIST_PUBLISH,
+ &publish_valid);
+ publish_request = tp_asv_get_string (asv,
+ TP_TOKEN_CONNECTION_INTERFACE_CONTACT_LIST_PUBLISH_REQUEST);
+
+ if (subscribe_valid && publish_valid)
+ {
+ contact_set_subscription_states (contact, subscribe, publish,
+ publish_request);
+ }
+ }
/* ContactGroups */
- boxed = tp_asv_get_boxed (asv,
- TP_TOKEN_CONNECTION_INTERFACE_CONTACT_GROUPS_GROUPS,
- G_TYPE_STRV);
- contact_maybe_set_contact_groups (contact, boxed);
+ if (wanted & CONTACT_FEATURE_FLAG_CONTACT_GROUPS)
+ {
+ boxed = tp_asv_get_boxed (asv,
+ TP_TOKEN_CONNECTION_INTERFACE_CONTACT_GROUPS_GROUPS,
+ G_TYPE_STRV);
+ contact_maybe_set_contact_groups (contact, boxed);
+ }
/* ContactBlocking */
if (wanted & CONTACT_FEATURE_FLAG_CONTACT_BLOCKING)