[Bug 28312] Make TpContact presence handling a bit more sensible
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Sat May 29 15:21:42 CEST 2010
https://bugs.freedesktop.org/show_bug.cgi?id=28312
--- Comment #2 from Danielle Madeley <danielle.madeley at collabora.co.uk> 2010-05-29 06:21:42 PDT ---
Quick review:
Use tp_value_array_unpack() to unpack the value array. Don't look up offsets
into the array (I know that's what the old code does, but it's nasty).
+ if (contact->priv->presence_type != type) {
+ contact->priv->presence_type = type;
+ g_object_notify ((GObject *) contact, "presence-type");
+ }
Not in Telepathy style. Telepathy style is documented in
http://telepathy.freedesktop.org/wiki/Style -- also applies to the other if
blocks.
+ 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);
Memory management is incorrect here. If you use tp_value_array_unpack() you'll
be given a const char * that you don't need to free, so you can just do:
+ g_free (contact->priv->presence_status);
+ contact->priv->presence_status = g_strdup (status);
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the telepathy-bugs
mailing list