Bug 920801 - Port chat/ changes from Instantbird to comm-central - 6 - Bio 2162 - IRC's /list command should use the requestRoomInfo API, r=aleth,clokep.
authorNihanth Subramanya <nhnt11@gmail.com>
Tue, 10 Sep 2013 02:17:29 +0530
changeset 17236 a0fde7f219422e90c6c0f53bef678c15224deb61
parent 17235 aa9648134550e6db85749307076b908fe9868b42
child 17237 7f24d4cea1c92cb5a97b5b3f8b1ed7af339641a7
push id1103
push usermbanner@mozilla.com
push dateTue, 18 Mar 2014 07:44:06 +0000
treeherdercomm-beta@50c6279a0af0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaleth, clokep
bugs920801
Bug 920801 - Port chat/ changes from Instantbird to comm-central - 6 - Bio 2162 - IRC's /list command should use the requestRoomInfo API, r=aleth,clokep.
chat/protocols/irc/ircBase.jsm
chat/protocols/irc/ircCommands.jsm
--- a/chat/protocols/irc/ircBase.jsm
+++ b/chat/protocols/irc/ircBase.jsm
@@ -814,17 +814,17 @@ var ircBase = {
       // Give callbacks a batch of channels of length _channelsPerBatch.
       if (this._channelList.length % this._channelsPerBatch == 0) {
         let channelBatch = this._channelList.slice(-this._channelsPerBatch);
         for (let callback of this._roomInfoCallbacks) {
           callback.onRoomInfoAvailable(channelBatch, this, false,
                                        this._channelsPerBatch);
         }
       }
-      return serverMessage(this, aMessage);
+      return true;
     },
     "323": function(aMessage) { // RPL_LISTEND
       // :End of LIST
       this._sendRemainingRoomInfo();
       return true;
     },
 
     /*
--- a/chat/protocols/irc/ircCommands.jsm
+++ b/chat/protocols/irc/ircCommands.jsm
@@ -207,17 +207,31 @@ var commands = [
   {
     name: "kick",
     get helpString() _("command.kick", "kick"),
     run: kickCommand
   },
   {
     name: "list",
     get helpString() _("command.list", "list"),
-    run: function(aMsg, aConv) simpleCommand(aConv, "LIST")
+    run: function(aMsg, aConv) {
+      let account = getAccount(aConv);
+      let serverName = account._currentServerName;
+      let serverConv = account.getConversation(serverName);
+      account.requestRoomInfo({onRoomInfoAvailable: function(aRooms) {
+        aRooms.forEach(function(aRoom) {
+          serverConv.writeMessage(serverName,
+                                  aRoom.name +
+                                  " (" + aRoom.participantCount + ") " +
+                                  aRoom.topic,
+                                  {incoming:true, noLog: true});
+        });
+      }});
+      return true;
+    }
   },
   {
     name: "me",
     get helpString() _("command.action", "me"),
     run: actionCommand
   },
   {
     name: "memoserv",