summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2011-04-19 10:55:52 +0100
committerJonny Lamb <jonny.lamb@collabora.co.uk>2011-04-19 10:55:52 +0100
commit34555aa5d322785704b174b4ec3ecfb0a4023b47 (patch)
tree54e6f6c27e4c46a5ba63fd3989cee600d0a6f551
parentcd6a1056f97210ff62ad0dd186934afbc1ce5a52 (diff)
status: update the DiscoveredStatuses hash table before emitting StatusChanged
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
-rw-r--r--salut/status.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/salut/status.c b/salut/status.c
index 7ecc0aa..798361d 100644
--- a/salut/status.c
+++ b/salut/status.c
@@ -163,6 +163,7 @@ update_contact_status (YtstStatus *self,
{
YtstStatusPrivate *priv = self->priv;
const gchar *old_status;
+ gboolean emit = FALSE;
GHashTable *capability_service_map;
GHashTable *service_status_map;
@@ -190,14 +191,18 @@ update_contact_status (YtstStatus *self,
old_status = g_hash_table_lookup (service_status_map, service_name);
- if (tp_strdiff (old_status, status_str))
- {
- tp_yts_svc_status_emit_status_changed (self, from, capability,
- service_name, status_str);
- }
+ /* Save this value as old_status will be freed when we call
+ * g_hash_table_insert next and the spec says we need to update the
+ * property before emitting the signal. In reality this wouldn't be
+ * a problem, but let's be nice. */
+ emit = tp_strdiff (old_status, status_str);
g_hash_table_insert (service_status_map, g_strdup (service_name),
g_strdup (status_str));
+
+ if (emit)
+ tp_yts_svc_status_emit_status_changed (self, from, capability,
+ service_name, status_str);
}
static gchar *