]> git.0d.be Git - empathy.git/commitdiff
Include SMSChannel property in empathy_chat_window_find_chat()
authorDanielle Madeley <danielle.madeley@collabora.co.uk>
Thu, 5 May 2011 06:22:23 +0000 (16:22 +1000)
committerDanielle Madeley <danielle.madeley@collabora.co.uk>
Thu, 5 May 2011 06:31:51 +0000 (16:31 +1000)
The approach in https://bugzilla.gnome.org/show_bug.cgi?id=644085 was wrong
because channel paths can change across reconnects. This would cause new chat
windows to be created when they were rerequested.

A more future-proof solution would be to keep a white/black list of comparable
properties, but I think this is overengineering the problem for the time
being. Instead we'll just include the SMSChannel property in the comparison.

src/empathy-chat-manager.c
src/empathy-chat-window.c
src/empathy-chat-window.h

index 6c92c25cb4df8ab4b8b6e0d6dad17fa31828b758..544ede69f43b1bc054e3e2fd78eed762b8e6c04d 100644 (file)
@@ -111,7 +111,8 @@ process_tp_chat (EmpathyChatManager *self,
   id = empathy_tp_chat_get_id (tp_chat);
   if (!tp_str_empty (id))
     {
-      chat = empathy_chat_window_find_chat (account, id);
+      chat = empathy_chat_window_find_chat (account, id,
+          empathy_tp_chat_is_sms_channel (tp_chat));
     }
 
   if (chat != NULL)
index 8fc5d6f3d779327a0855ed5303ac7696fa669fab..ac97601cee059d3c69b7c97740f3ce9d98253200 100644 (file)
@@ -1786,7 +1786,7 @@ chat_window_drag_data_received (GtkWidget        *widget,
                        account =
                                tp_account_manager_ensure_account (account_manager, account_id);
                        if (account != NULL)
-                               chat = empathy_chat_window_find_chat (account, contact_id);
+                               chat = empathy_chat_window_find_chat (account, contact_id, FALSE);
                }
 
                if (account == NULL) {
@@ -2354,7 +2354,8 @@ empathy_chat_window_switch_to_chat (EmpathyChatWindow *window,
 
 EmpathyChat *
 empathy_chat_window_find_chat (TpAccount   *account,
-                              const gchar *id)
+                              const gchar *id,
+                              gboolean     sms_channel)
 {
        GList *l;
 
@@ -2374,7 +2375,8 @@ empathy_chat_window_find_chat (TpAccount   *account,
                        chat = ll->data;
 
                        if (account == empathy_chat_get_account (chat) &&
-                           !tp_strdiff (id, empathy_chat_get_id (chat))) {
+                           !tp_strdiff (id, empathy_chat_get_id (chat)) &&
+                           sms_channel == empathy_chat_is_sms_channel (chat)) {
                                return chat;
                        }
                }
index 5477479ac8c7344d41aa2b8e75b8131afd4a9854..2112b6647d9bc3b02f0eab1ddb4b127d762911d5 100644 (file)
@@ -59,7 +59,8 @@ struct _EmpathyChatWindowClass {
 GType              empathy_chat_window_get_type       (void);
 
 EmpathyChat *      empathy_chat_window_find_chat      (TpAccount        *account,
-                                                      const gchar      *id);
+                                                      const gchar      *id,
+                                                      gboolean          sms_channel);
 void               empathy_chat_window_present_chat   (EmpathyChat      *chat,
                                                       gint64 timestamp);