[empathy] tell the chatroom manager asap about chats



commit acc341d1178dc9806b32d7aadc4154259dadf63c
Author: Sjoerd Simons <sjoerd simons collabora co uk>
Date:   Thu Jul 8 00:01:31 2010 +0100

    tell the chatroom manager asap about chats

 src/empathy-chat-manager.c |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/src/empathy-chat-manager.c b/src/empathy-chat-manager.c
index 0e8a335..3c66e36 100644
--- a/src/empathy-chat-manager.c
+++ b/src/empathy-chat-manager.c
@@ -95,6 +95,24 @@ chat_data_free (ChatData *data)
 }
 
 static void
+tell_chatroom_manager_if_needed (TpAccount *account,
+    EmpathyTpChat *chat)
+{
+  TpHandleType type;
+
+  tp_channel_get_handle (empathy_tp_chat_get_channel (chat), &type);
+
+  if (type == TP_HANDLE_TYPE_ROOM)
+    {
+      EmpathyChatroomManager *chatroom_mgr;
+
+      chatroom_mgr = empathy_chatroom_manager_dup_singleton (NULL);
+      empathy_chatroom_manager_chat_handled (chatroom_mgr, chat, account);
+      g_object_unref (chatroom_mgr);
+    }
+}
+
+static void
 process_tp_chat (EmpathyTpChat *tp_chat,
     TpAccount *account,
     gint64 user_action_time)
@@ -102,6 +120,8 @@ process_tp_chat (EmpathyTpChat *tp_chat,
   EmpathyChat *chat = NULL;
   const gchar *id;
 
+  tell_chatroom_manager_if_needed (account, tp_chat);
+
   id = empathy_tp_chat_get_id (tp_chat);
   if (!tp_str_empty (id))
     {
@@ -119,7 +139,6 @@ process_tp_chat (EmpathyTpChat *tp_chat,
        * a GtkWidget. This reference will be taken by a container
        * (a GtkNotebook) when we'll call empathy_chat_window_present_chat */
     }
-
   empathy_chat_window_present_chat (chat, user_action_time);
 
   if (empathy_tp_chat_is_invited (tp_chat, NULL))
@@ -129,15 +148,6 @@ process_tp_chat (EmpathyTpChat *tp_chat,
       empathy_tp_chat_join (tp_chat);
     }
 
-  if (empathy_chat_is_room (chat))
-    {
-      EmpathyChatroomManager *chatroom_mgr;
-
-      chatroom_mgr = empathy_chatroom_manager_dup_singleton (NULL);
-      empathy_chatroom_manager_chat_handled (chatroom_mgr, tp_chat, account);
-      g_object_unref (chatroom_mgr);
-    }
-
   g_object_unref (tp_chat);
 }
 



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