From c6cd0c450c594e7c09372c9b052d7d9ec1c94191 Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Thu, 15 May 2014 11:12:46 +0200 Subject: [PATCH] base-protocol: get_avatar_details() now return a boolean This allows Haze to indicate that it doesn't actually support avatars for some protocols. Fix https://bugs.freedesktop.org/show_bug.cgi?id=78381 --- examples/cm/echo-message-parts/protocol.c | 4 +++- telepathy-glib/base-protocol.c | 9 +++++---- telepathy-glib/base-protocol.h | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/examples/cm/echo-message-parts/protocol.c b/examples/cm/echo-message-parts/protocol.c index d18f8a4..5c1c294 100644 --- a/examples/cm/echo-message-parts/protocol.c +++ b/examples/cm/echo-message-parts/protocol.c @@ -165,7 +165,7 @@ get_connection_details (TpBaseProtocol *self G_GNUC_UNUSED, } } -static void +static gboolean get_avatar_details (TpBaseProtocol *self, GStrv *supported_mime_types, guint *min_height, @@ -199,6 +199,8 @@ get_avatar_details (TpBaseProtocol *self, if (max_bytes != NULL) *max_bytes = 37748736; + + return TRUE; } static GStrv diff --git a/telepathy-glib/base-protocol.c b/telepathy-glib/base-protocol.c index e18507d..23f50b4 100644 --- a/telepathy-glib/base-protocol.c +++ b/telepathy-glib/base-protocol.c @@ -404,6 +404,8 @@ tp_cm_param_filter_string_nonempty (const TpCMParamSpec *paramspec, * Signature of a virtual method to get the supported avatar details for the * protocol implemented by @self. * + * Returns: %TRUE if @self actually supports avatars and all the variables + * have been to set a meaningful value, %FALSE otherwise * Since: 0.13.7 */ @@ -682,8 +684,7 @@ tp_base_protocol_constructed (GObject *object) self->priv->vcard_field = g_strdup (""); } - if (cls->get_avatar_details != NULL) - { + if (cls->get_avatar_details != NULL && (cls->get_avatar_details) (self, &self->priv->avatar_specs.supported_mime_types, &self->priv->avatar_specs.min_height, @@ -692,8 +693,8 @@ tp_base_protocol_constructed (GObject *object) &self->priv->avatar_specs.rec_width, &self->priv->avatar_specs.max_height, &self->priv->avatar_specs.max_width, - &self->priv->avatar_specs.max_bytes); - + &self->priv->avatar_specs.max_bytes)) + { object_skeleton_take_svc_interface (skel, TP_TYPE_SVC_PROTOCOL_INTERFACE_AVATARS1); } diff --git a/telepathy-glib/base-protocol.h b/telepathy-glib/base-protocol.h index e77ea08..c00701d 100644 --- a/telepathy-glib/base-protocol.h +++ b/telepathy-glib/base-protocol.h @@ -127,7 +127,7 @@ typedef void (*TpBaseProtocolGetConnectionDetailsFunc) (TpBaseProtocol *self, gchar **english_name, gchar **vcard_field); -typedef void (*TpBaseProtocolGetAvatarDetailsFunc) (TpBaseProtocol *self, +typedef gboolean (*TpBaseProtocolGetAvatarDetailsFunc) (TpBaseProtocol *self, GStrv *supported_mime_types, guint *min_height, guint *min_width, -- 1.9.0