]> git.0d.be Git - empathy.git/commitdiff
tell the chatroom manager asap about chats
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>
Wed, 7 Jul 2010 23:01:31 +0000 (00:01 +0100)
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>
Fri, 9 Jul 2010 10:16:19 +0000 (11:16 +0100)
src/empathy-chat-manager.c

index 0e8a335c2e5970c60b46a88e698f05e9817d2751..3c66e36e514a5f54d07cc6207d6aa6f04f7f0401 100644 (file)
@@ -94,6 +94,24 @@ chat_data_free (ChatData *data)
   g_slice_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,
@@ -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);
 }