Bug 774658 - Online contacts appear offline when opening chat tab to new window. r=florian, a=Standard8.
authorMike Conley <mconley@mozilla.com>
Tue, 17 Jul 2012 16:55:14 -0400
changeset 12444 16639b7a4bd8bfc06243734d18328b337578d4d1
parent 12443 794f909e43f8379d53f837b4ef06aed6212dbac8
child 12445 ab8e59c6ea7dc949e76306a31862beb06441bd64
push id602
push usermconley@mozilla.com
push dateTue, 17 Jul 2012 20:58:05 +0000
treeherdercomm-beta@ab8e59c6ea7d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian, Standard8
bugs774658
Bug 774658 - Online contacts appear offline when opening chat tab to new window. r=florian, a=Standard8.
mail/components/im/content/chat-messenger-overlay.js
--- a/mail/components/im/content/chat-messenger-overlay.js
+++ b/mail/components/im/content/chat-messenger-overlay.js
@@ -903,23 +903,29 @@ var chatHandler = {
         document.getElementById("chatTabPanel")
                 .getNotificationWithValue(value);
       if (notification)
         notification.close();
       return;
     }
   },
   initContactList: function() {
-    let group = document.getElementById("offlinecontactsGroup");
+    let onGroup = document.getElementById("onlinecontactsGroup");
+    let offGroup = document.getElementById("offlinecontactsGroup");
+
     imServices.tags.getTags().forEach(function (aTag) {
       aTag.getContacts().forEach(function(aContact) {
+        let group = aContact.online ? onGroup : offGroup;
         group.addContact(aContact);
       });
     });
-    group._updateGroupLabel();
+
+    onGroup._updateGroupLabel();
+    offGroup._updateGroupLabel();
+
     imServices.obs.addObserver(this, "new-text", false);
     imServices.obs.addObserver(this, "new-ui-conversation", false);
     imServices.obs.addObserver(this, "ui-conversation-closed", false);
     imServices.obs.addObserver(this, "contact-signed-on", false);
     imServices.obs.addObserver(this, "contact-signed-off", false);
     imServices.obs.addObserver(this, "contact-added", false);
     imServices.obs.addObserver(this, "contact-removed", false);
     imServices.obs.addObserver(this, "contact-no-longer-dummy", false);