#include "modules.h"
#include "commands.h"
#include "helperfuncs.h"
-#include "cmd_whois.h"
+#include "commands/cmd_whois.h"
extern ServerConfig* Config;
extern InspIRCd* ServerInstance;
extern FactoryList factory;
extern time_t TIME;
-void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long idle, char* nick)
+const char* Spacify(char* n)
+{
+ static char x[MAXBUF];
+ strlcpy(x,n,MAXBUF);
+ for (char* y = x; *y; y++)
+ if (*y == '_')
+ *y = ' ';
+ return x;
+}
+
+void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long idle, const char* nick)
{
// bug found by phidjit - were able to whois an incomplete connection if it had sent a NICK or USER
- if (dest->registered == 7)
+ if (dest->registered == REG_ALL)
{
WriteServ(user->fd,"311 %s %s %s %s * :%s",user->nick, dest->nick, dest->ident, dest->dhost, dest->fullname);
if ((user == dest) || (*user->oper))
{
- WriteServ(user->fd,"378 %s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, inet_ntoa(dest->ip4));
+ WriteServ(user->fd,"378 %s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, dest->GetIPString());
}
std::string cl = chlist(dest,user);
if (cl.length())
}
if (*dest->oper)
{
- WriteServ(user->fd,"313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("aeiou",*dest->oper) ? "an" : "a"),dest->oper, Config->Network);
+ WriteServ(user->fd,"313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("AEIOUaeiou",*dest->oper) ? "an" : "a"),Spacify(dest->oper), Config->Network);
}
if ((!signon) && (!idle))
{
}
}
-void cmd_whois::Handle (char **parameters, int pcnt, userrec *user)
+void cmd_whois::Handle (const char** parameters, int pcnt, userrec *user)
{
userrec *dest;
- if (ServerInstance->Parser->LoopCall(this,parameters,pcnt,user,0,pcnt-1,0))
+ if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
return;
+
dest = Find(parameters[0]);
if (dest)
{