Bug 842183 - Land in comm-central Instantbird's changes to chat/ - 5 - Bio 1690 - /whois in a private irc conversation should support being parameterless, r=aleth.
authorPatrick Cloke <clokep@gmail.com>
Fri, 18 Jan 2013 23:15:52 -0500
changeset 12002 64239df00f64df955f38291234434ee9385bc3b4
parent 12001 98e3aaec39b76511f28f43eb0f1a285192da8e1a
child 12003 aee786d836a5636e7e5d3dc0712afc43d506b280
push id8909
push userflorian@queze.net
push dateMon, 18 Feb 2013 14:55:18 +0000
treeherdercomm-central@dad38b5c0099 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersaleth
bugs842183
Bug 842183 - Land in comm-central Instantbird's changes to chat/ - 5 - Bio 1690 - /whois in a private irc conversation should support being parameterless, r=aleth.
chat/locales/en-US/irc.properties
chat/protocols/irc/ircCommands.jsm
--- a/chat/locales/en-US/irc.properties
+++ b/chat/locales/en-US/irc.properties
@@ -66,17 +66,17 @@ command.part=%S [message]: Leave the cur
 command.ping=%S [&lt;nick&gt;]: Asks how much lag a user (or the server if no user specified) has.
 command.quit=%S &lt;message&gt;: Disconnect from the server, with an optional message.
 command.quote=%S &lt;command&gt;: Send a raw command to the server.
 command.time=%S: Displays the current local time at the IRC server.
 command.topic=%S [&lt;new topic&gt;]: Set this channel's topic.
 command.umode=%S (+|-)&lt;new mode&gt;: Set or unset a user mode.
 command.version=%S &lt;nick&gt;: Request the version of a user's client.
 command.voice=%S &lt;nick1&gt;[,&lt;nick2&gt;]*: Grant channel voice status to someone. You must be a channel operator to do this.
-command.whois=%S &lt;nick&gt;: Get information on a user.
+command.whois2=%S [&lt;nick&gt;]: Get information on a user.
 
 # LOCALIZATION NOTE (message.*):
 #    These are shown as system messages in the conversation.
 #    %1$S is the nick and %2$S is the nick and host of the user who joined.
 message.join=%1$S [%2$S] entered the room.
 message.rejoined=You have rejoined the room.
 #    %1$S is the nick of who kicked you.
 #    %2$S is message.kicked.reason, if a kick message was given.
--- a/chat/protocols/irc/ircCommands.jsm
+++ b/chat/protocols/irc/ircCommands.jsm
@@ -356,19 +356,27 @@ var commands = [
   },
   {
     name: "voice",
     get helpString() _("command.voice", "voice"),
     run: function(aMsg, aConv) setMode(aMsg, aConv, "v", true)
   },
   {
     name: "whois",
-    get helpString() _("command.whois", "whois"),
+    get helpString() _("command.whois2", "whois"),
     run: function(aMsg, aConv) {
-      // Note that this will automatically run whowas is the nick is offline.
+      // Note that this will automatically run whowas if the nick is offline.
       aMsg = aMsg.trim();
-      if (!aMsg || aMsg.contains(" "))
+      // If multiple parameters are given, this is an error.
+      if (aMsg.contains(" "))
         return false;
+      // If the user does not provide a nick, but is in a private conversation,
+      // assume the user is trying to whois the person they are talking to.
+      if (!aMsg) {
+        if (aConv.isChat)
+          return false;
+        aMsg = aConv.name;
+      }
       getConv(aConv).requestBuddyInfo(aMsg);
       return true;
     }
   }
 ];