diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-11 21:24:20 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-05-11 21:24:20 +0000 |
commit | 3a60fed191af07b0e124c2704227b56f99a80f7a (patch) | |
tree | 1f174e0e3f9233482b4736ea7c9e22216196d256 | |
parent | 432b306797b5a5a345affa3933a453efef0dac1c (diff) |
Make sure we always use the correct index for the nickname (thanks djGrr)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6986 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/cmd_whois.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/cmd_whois.cpp b/src/cmd_whois.cpp index 7fab00905..7164bbb98 100644 --- a/src/cmd_whois.cpp +++ b/src/cmd_whois.cpp @@ -97,6 +97,7 @@ extern "C" command_t* init_command(InspIRCd* Instance) CmdResult cmd_whois::Handle (const char** parameters, int pcnt, userrec *user) { userrec *dest; + int userindex = 0; unsigned long idle = 0, signon = 0; if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0)) @@ -108,13 +109,9 @@ CmdResult cmd_whois::Handle (const char** parameters, int pcnt, userrec *user) * does, and use the second one, otherwise, use the only paramter. -- djGrrr */ if (pcnt > 1) - { - dest = ServerInstance->FindNick(parameters[1]); - } - else - { - dest = ServerInstance->FindNick(parameters[0]); - } + userindex = 1; + + dest = ServerInstance->FindNick(parameters[userindex]); if (dest) { @@ -132,13 +129,13 @@ CmdResult cmd_whois::Handle (const char** parameters, int pcnt, userrec *user) signon = dest->signon; } - do_whois(this->ServerInstance, user,dest,signon,idle,parameters[0]); + do_whois(this->ServerInstance, user,dest,signon,idle,parameters[userindex]); } else { /* no such nick/channel */ - user->WriteServ("401 %s %s :No such nick/channel",user->nick, *parameters[0] ? parameters[0] : "*"); - user->WriteServ("318 %s %s :End of /WHOIS list.",user->nick, *parameters[0] ? parameters[0] : "*"); + user->WriteServ("401 %s %s :No such nick/channel",user->nick, *parameters[userindex] ? parameters[userindex] : "*"); + user->WriteServ("318 %s %s :End of /WHOIS list.",user->nick, *parameters[userindex] ? parameters[userindex] : "*"); return CMD_FAILURE; } |