[empathy: 1/19] empathy-tp-chat: ensure that we get a TpTextChannel



commit ddcc4fc3969c7eb60af1a298a8619d1bb0359a83
Author: Guillaume Desmottes <guillaume desmottes collabora co uk>
Date:   Fri Apr 15 12:21:52 2011 +0200

    empathy-tp-chat: ensure that we get a TpTextChannel

 libempathy/empathy-chatroom-manager.c |    3 +++
 libempathy/empathy-tp-chat.c          |    2 +-
 src/empathy-chat-manager.c            |    7 +++++++
 src/empathy-event-manager.c           |    2 +-
 4 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/libempathy/empathy-chatroom-manager.c b/libempathy/empathy-chatroom-manager.c
index dd7ef46..9ad75ee 100644
--- a/libempathy/empathy-chatroom-manager.c
+++ b/libempathy/empathy-chatroom-manager.c
@@ -873,6 +873,9 @@ observe_channels_cb (TpSimpleObserver *observer,
       if (tp_proxy_get_invalidated (channel) != NULL)
         continue;
 
+      if (!TP_IS_TEXT_CHANNEL (channel))
+        continue;
+
       tp_chat = empathy_tp_chat_new (account, channel);
       roomname = empathy_tp_chat_get_id (tp_chat);
       chatroom = empathy_chatroom_manager_find (self, account, roomname);
diff --git a/libempathy/empathy-tp-chat.c b/libempathy/empathy-tp-chat.c
index 1b2fe46..8c09529 100644
--- a/libempathy/empathy-tp-chat.c
+++ b/libempathy/empathy-tp-chat.c
@@ -1551,7 +1551,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 ff715fe..6c92c25 100644
--- a/src/empathy-chat-manager.c
+++ b/src/empathy-chat-manager.c
@@ -231,6 +231,13 @@ handle_channels (TpSimpleHandler *handler,
       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;
+        }
+
       handling = TRUE;
 
       tp_chat = empathy_tp_chat_new (account, channel);
diff --git a/src/empathy-event-manager.c b/src/empathy-event-manager.c
index 342d3e1..6125ec8 100644
--- a/src/empathy-event-manager.c
+++ b/src/empathy-event-manager.c
@@ -934,7 +934,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;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]