[next] telepathy-glib: tp_message_mixin_init_dbus_properties: only conditionally implement ChatState
Xavier Claessens
xclaesse at kemper.freedesktop.org
Thu May 10 06:44:15 PDT 2012
Module: telepathy-glib
Branch: next
Commit: b09ac85e4056cfe6c4dc27bfdcf7f6b80f7e3538
URL: http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=b09ac85e4056cfe6c4dc27bfdcf7f6b80f7e3538
Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date: Thu May 10 13:09:26 2012 +0100
tp_message_mixin_init_dbus_properties: only conditionally implement ChatState
Also check that Text and Messages are implemented.
This fixes a regression in 0.19.0 where applying MessageMixin to a channel
without ChatState, like those in telepathy-rakia, would cause a critical
warning.
Signed-off-by: Simon McVittie <simon.mcvittie at collabora.co.uk>
Reviewed-by: Xavier Claessens <xavier.claessens at collabora.co.uk>
---
telepathy-glib/message-mixin.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/telepathy-glib/message-mixin.c b/telepathy-glib/message-mixin.c
index 6562c6e..ac4683b 100644
--- a/telepathy-glib/message-mixin.c
+++ b/telepathy-glib/message-mixin.c
@@ -1303,14 +1303,22 @@ tp_message_mixin_init_dbus_properties (GObjectClass *cls)
{ "ChatStates", NULL, NULL },
{ NULL }
};
+ GType type = G_OBJECT_CLASS_TYPE (cls);
+
+ g_return_if_fail (g_type_is_a (type, TP_TYPE_SVC_CHANNEL_TYPE_TEXT));
+ g_return_if_fail (g_type_is_a (type,
+ TP_TYPE_SVC_CHANNEL_INTERFACE_MESSAGES));
tp_dbus_properties_mixin_implement_interface (cls,
TP_IFACE_QUARK_CHANNEL_INTERFACE_MESSAGES,
tp_message_mixin_get_dbus_property, NULL, props);
- tp_dbus_properties_mixin_implement_interface (cls,
- TP_IFACE_QUARK_CHANNEL_INTERFACE_CHAT_STATE,
- tp_message_mixin_get_dbus_property, NULL, chat_state_props);
+ if (g_type_is_a (type, TP_TYPE_SVC_CHANNEL_INTERFACE_CHAT_STATE))
+ {
+ tp_dbus_properties_mixin_implement_interface (cls,
+ TP_IFACE_QUARK_CHANNEL_INTERFACE_CHAT_STATE,
+ tp_message_mixin_get_dbus_property, NULL, chat_state_props);
+ }
}
More information about the telepathy-commits
mailing list