Bug 735335 - Participant list of IRC channels isn't finished, r=bwinton, a=bienvenu.
authorFlorian Quèze <florian@queze.net>
Mon, 02 Apr 2012 12:36:39 +0200
changeset 11139 8ab1410329379e1c14938d2139bff20b4ede0825
parent 11138 788690fde22b0f6bc6783c20ef368f77b5b0f7a6
child 11140 a32b1a8e83a1f87e8262e6883d6fabe5f05c689c
push id463
push userbugzilla@standard8.plus.com
push dateTue, 24 Apr 2012 17:34:51 +0000
treeherdercomm-beta@e53588e8f7b0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwinton, bienvenu
bugs735335
Bug 735335 - Participant list of IRC channels isn't finished, r=bwinton, a=bienvenu.
mail/components/im/content/chat-messenger-overlay.js
mail/components/im/content/chat-messenger-overlay.xul
mail/components/im/content/imbuddytooltip.xml
mail/components/im/content/imconversation.xml
--- a/mail/components/im/content/chat-messenger-overlay.js
+++ b/mail/components/im/content/chat-messenger-overlay.js
@@ -430,16 +430,48 @@ var chatHandler = {
         document.getElementById("logDisplayDeck").selectedPanel =
           document.getElementById("noPreviousConvScreen");
       }
     }
     this._hideContextPane(false);
     this.updateTitle();
   },
 
+  onNickClick: function(aEvent) {
+    // Open a private conversation only for a middle or double click.
+    if (aEvent.button != 1 && (aEvent.button != 0 || aEvent.detail != 2))
+      return;
+
+    let conv = document.getElementById("contactlistbox").selectedItem.conv;
+    let nick = aEvent.originalTarget.chatBuddy.name;
+    let name = conv.target.getNormalizedChatBuddyName(nick);
+    try {
+      conv.account.createConversation(name);
+    } catch (e) {}
+  },
+
+  onNicklistKeyPress: function(aEvent) {
+    if (aEvent.keyCode != aEvent.DOM_VK_RETURN &&
+        aEvent.keyCode != aEvent.DOM_VK_ENTER)
+      return;
+
+    let listbox = aEvent.originalTarget;
+    if (listbox.selectedCount == 0)
+      return;
+
+    let conv = document.getElementById("contactlistbox").selectedItem.conv;
+    for (let i = 0; i < listbox.selectedCount; ++i) {
+      let nick = listbox.getSelectedItem(i).chatBuddy.name;
+      let name = conv.target.getNormalizedChatBuddyName(nick);
+      try {
+        conv.account.createConversation(name);
+      } catch (e) {}
+    }
+  },
+
   _openDialog: function(aType) {
     let features = "chrome,modal,titlebar,centerscreen";
     window.openDialog("chrome://messenger/content/chat/" + aType + ".xul", "",
                       features);
   },
   addBuddy: function() {
      this._openDialog("addbuddy");
   },
--- a/mail/components/im/content/chat-messenger-overlay.xul
+++ b/mail/components/im/content/chat-messenger-overlay.xul
@@ -276,18 +276,18 @@
                 <label class="conv-nicklist-header-label"
                        id="participantLabel" control="participantCount"
                        value="&chat.participants;"/>
                 <textbox flex="1" readonly="true" class="plain" id="participantCount"/>
               </hbox>
               <listbox id="nicklist" class="conv-nicklist"
                        flex="1" seltype="multiple"
                        tooltip="buddyTooltip"
-                       onclick="onNickClick(event);"
-                       onkeypress="onNicklistKeyPress(event);"/><!-- FIXME event handler -->
+                       onclick="chatHandler.onNickClick(event);"
+                       onkeypress="chatHandler.onNicklistKeyPress(event);"/>
             </vbox>
             <splitter id="logsSplitter" class="conv-chat"/>
             <vbox flex="1" id="previousConversations">
               <label class="conv-logs-header-label"
                      id="participantLabel"
                      value="&chat.previousConversations;"/>
               <listbox flex="1" id="logList" onselect="chatHandler.onLogSelect();"/>
             </vbox>
--- a/mail/components/im/content/imbuddytooltip.xml
+++ b/mail/components/im/content/imbuddytooltip.xml
@@ -390,17 +390,17 @@
            return false;
 
          let localName = elt.localName;
          if (localName == "imconv" && elt.conv)
            return updateTooltipFromConversation(elt.conv, elt);
          if (localName == "imcontact")
            return updateTooltipFromContact(elt.contact, elt);
          if (localName == "listitem") {
-           let conv = document.getBindingParent(elt).conv;
+           let conv = document.getElementById("contactlistbox").selectedItem.conv;
            return updateTooltipFromParticipant(elt.chatBuddy, conv);
          }
 
          return false;
        ]]>
      </handler>
      <handler event="popuphiding">
        <![CDATA[
--- a/mail/components/im/content/imconversation.xml
+++ b/mail/components/im/content/imconversation.xml
@@ -1252,52 +1252,16 @@
          case "chat-update-topic":
            this.updateTopic();
            break;
          }
        ]]>
        </body>
      </method>
 
-     <method name="onNicklistKeyPress">
-      <parameter name="event"/>
-      <body>
-      <![CDATA[
-        if (event.keyCode != event.DOM_VK_RETURN &&
-            event.keyCode != event.DOM_VK_ENTER)
-          return;
-
-        let listbox = event.originalTarget;
-        if (listbox.selectedCount == 0)
-          return;
-
-        for (let i = 0; i < listbox.selectedCount; ++i) {
-          let nick = listbox.getSelectedItem(i).chatBuddy.name;
-          let name = this._conv.target.getNormalizedChatBuddyName(nick);
-          this._conv.account.createConversation(name);
-        }
-      ]]>
-      </body>
-     </method>
-
-     <method name="onNickClick">
-      <parameter name="event"/>
-      <body>
-      <![CDATA[
-        // Open a private conversation in new tab on a middle or double click.
-        if (event.button == 1 || (event.button == 0 && event.detail == 2)) {
-          var nick = event.originalTarget.chatBuddy.name;
-          let name = this._conv.target.getNormalizedChatBuddyName(nick);
-          let newConv = this._conv.account.createConversation(name);
-          Conversations.focusConversation(newConv);
-        }
-      ]]>
-      </body>
-     </method>
-
      <property name="convId">
        <getter>
          <![CDATA[
            return this._conv.id;
          ]]>
        </getter>
      </property>