diff options
author | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-05-10 13:09:26 +0100 |
---|---|---|
committer | Simon McVittie <simon.mcvittie@collabora.co.uk> | 2012-05-10 13:13:24 +0100 |
commit | b09ac85e4056cfe6c4dc27bfdcf7f6b80f7e3538 (patch) | |
tree | 90100ee40f2ac008d4043070704cba94737a88f7 /telepathy-glib/message-mixin.c | |
parent | 10bade958c71c7e2b69dac0667b224cd9ff436c6 (diff) | |
download | telepathy-glib-b09ac85e4056cfe6c4dc27bfdcf7f6b80f7e3538.tar.gz |
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@collabora.co.uk>
Reviewed-by: Xavier Claessens <xavier.claessens@collabora.co.uk>
Diffstat (limited to 'telepathy-glib/message-mixin.c')
-rw-r--r-- | 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 6562c6e58..ac4683b37 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); + } } |