diff options
author | Morten Mjelva <morten.mjelva@gmail.com> | 2010-05-29 14:52:21 +0200 |
---|---|---|
committer | Morten Mjelva <morten.mjelva@gmail.com> | 2010-05-29 14:52:21 +0200 |
commit | 2bf07a3687bbbc26b23567b8d8cec99890d91d4b (patch) | |
tree | 8306d6cbfddac6d7659f0abaf8e59230938f97f3 | |
parent | f25b43e59c9e3b554a007375535e1363bd648b33 (diff) |
Changing the way presence fields are updatedjs-examples
-rw-r--r-- | telepathy-glib/contact.c | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c index e882dd43..81afba75 100644 --- a/telepathy-glib/contact.c +++ b/telepathy-glib/contact.c @@ -1640,17 +1640,28 @@ contact_maybe_set_simple_presence (TpContact *contact, return; contact->priv->has_features |= CONTACT_FEATURE_FLAG_PRESENCE; - contact->priv->presence_type = g_value_get_uint (presence->values + 0); - g_free (contact->priv->presence_status); - contact->priv->presence_status = g_value_dup_string ( - presence->values + 1); - g_free (contact->priv->presence_message); - contact->priv->presence_message = g_value_dup_string ( - presence->values + 2); - - g_object_notify ((GObject *) contact, "presence-type"); - g_object_notify ((GObject *) contact, "presence-status"); - g_object_notify ((GObject *) contact, "presence-message"); + + guint type = g_value_get_uint (presence->values + 0); + if (contact->priv->presence_type != type) { + contact->priv->presence_type = type; + g_object_notify ((GObject *) contact, "presence-type"); + } + + gchar *status = g_value_dup_string (presence->values+1); + if (tp_strdiff(contact->priv->presence_status, status)) { + g_free (contact->priv->presence_status); + contact->priv->presence_status = status; + g_object_notify ((GObject *) contact, "presence-status"); + } + g_free(status); + + gchar *message = g_value_dup_string (presence->values + 2); + if (tp_strdiff(contact->priv->presence_message, message)) { + g_free (contact->priv->presence_message); + contact->priv->presence_message = message; + g_object_notify ((GObject *) contact, "presence-message"); + } + g_free(message); } static void |