summaryrefslogtreecommitdiff
path: root/telepathy-glib/contact.c
diff options
context:
space:
mode:
Diffstat (limited to 'telepathy-glib/contact.c')
-rw-r--r--telepathy-glib/contact.c36
1 files changed, 31 insertions, 5 deletions
diff --git a/telepathy-glib/contact.c b/telepathy-glib/contact.c
index abf38efec..4a77f1137 100644
--- a/telepathy-glib/contact.c
+++ b/telepathy-glib/contact.c
@@ -40,6 +40,15 @@
#include "telepathy-glib/util-internal.h"
#include "telepathy-glib/variant-util-internal.h"
+static const gchar *
+nonnull (const gchar *s)
+{
+ if (s == NULL)
+ return "(null)";
+
+ return s;
+}
+
/**
* SECTION:contact
* @title: TpContact
@@ -2805,18 +2814,28 @@ mime_file_written (GObject *source_object,
self = g_weak_ref_get (&avatar_data->contact);
- if (self != NULL)
+ if (self == NULL)
+ {
+ DEBUG ("No relevant TpContact");
+ }
+ else if (tp_strdiff (avatar_data->token, self->priv->avatar_token))
{
+ DEBUG ("Contact's avatar token has changed from %s to %s, "
+ "this avatar is no longer relevant",
+ avatar_data->token, nonnull (self->priv->avatar_token));
+ }
+ else
+ {
+ DEBUG ("Saved avatar '%s' of MIME type '%s' still used by '%s' to '%s'",
+ avatar_data->token, avatar_data->mime_type,
+ self->priv->identifier,
+ g_file_get_path (avatar_data->file));
g_clear_object (&self->priv->avatar_file);
self->priv->avatar_file = g_object_ref (avatar_data->file);
g_free (self->priv->avatar_mime_type);
self->priv->avatar_mime_type = g_strdup (avatar_data->mime_type);
- /* Update the avatar token if a newer one is given
- * (this emits notify::avatar-token if needed) */
- contact_set_avatar_token (self, avatar_data->token, FALSE);
-
/* Notify both property changes together once both files have been
* written */
g_object_notify ((GObject *) self, "avatar-mime-type");
@@ -2872,6 +2891,13 @@ contact_avatar_retrieved (TpConnection *connection,
gchar *mime_filename;
WriteAvatarData *avatar_data;
+ if (self != NULL)
+ {
+ /* Update the avatar token if a newer one is given
+ * (this emits notify::avatar-token if needed) */
+ contact_set_avatar_token (self, token, FALSE);
+ }
+
if (!build_avatar_filename (connection, token, TRUE, &filename,
&mime_filename))
return;