From b7013f41997500ed888fb3b40f3c11a5502079cd Mon Sep 17 00:00:00 2001 From: Guillaume Desmottes Date: Fri, 15 Apr 2011 12:21:52 +0200 Subject: empathy-tp-chat: ensure that we get a TpTextChannel --- libempathy/empathy-tp-chat.c | 2 +- src/empathy-chat-manager.c | 10 ++++++++++ src/empathy-event-manager.c | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c index da3ac663a..6b6dfebe5 100644 --- a/libempathy/empathy-tp-chat.c +++ b/libempathy/empathy-tp-chat.c @@ -1618,7 +1618,7 @@ empathy_tp_chat_new (TpAccount *account, TpChannel *channel) { g_return_val_if_fail (TP_IS_ACCOUNT (account), NULL); - g_return_val_if_fail (TP_IS_CHANNEL (channel), NULL); + g_return_val_if_fail (TP_IS_TEXT_CHANNEL (channel), NULL); return g_object_new (EMPATHY_TYPE_TP_CHAT, "account", account, diff --git a/src/empathy-chat-manager.c b/src/empathy-chat-manager.c index 4ff6b7d30..8455001f5 100644 --- a/src/empathy-chat-manager.c +++ b/src/empathy-chat-manager.c @@ -216,6 +216,16 @@ handle_channels (TpSimpleHandler *handler, TpChannel *channel = l->data; EmpathyTpChat *tp_chat; + if (tp_proxy_get_invalidated (channel) != NULL) + continue; + + if (!TP_IS_TEXT_CHANNEL (channel)) + { + DEBUG ("Channel %s doesn't implement Messages; can't handle it", + tp_proxy_get_object_path (channel)); + continue; + } + tp_chat = empathy_tp_chat_new (account, channel); if (empathy_tp_chat_is_ready (tp_chat)) diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c index 041d22a18..e2ce0725f 100644 --- a/src/empathy-event-manager.c +++ b/src/empathy-event-manager.c @@ -1037,7 +1037,7 @@ approve_channels (TpSimpleApprover *approver, channel_type = tp_channel_get_channel_type_id (channel); - if (channel_type == TP_IFACE_QUARK_CHANNEL_TYPE_TEXT) + if (TP_IS_TEXT_CHANNEL (channel)) { EmpathyTpChat *tp_chat; -- cgit v1.2.3