1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
7 * <brain@chatspike.net>
8 * <Craig@chatspike.net>
10 * Written by Craig Edwards, Craig McLure, and others.
11 * This program is free but copyrighted software; see
12 * the file COPYING for details.
14 * ---------------------------------------------------
17 #include "inspircd_config.h"
18 #include "configreader.h"
21 #include "helperfuncs.h"
22 #include "commands/cmd_whowas.h"
24 extern ServerConfig* Config;
25 extern whowas_users whowas;
27 void cmd_whowas::Handle (const char** parameters, int pcnt, userrec* user)
29 whowas_users::iterator i = whowas.find(parameters[0]);
31 if (i == whowas.end())
33 WriteServ(user->fd,"406 %s %s :There was no such nickname",user->nick,parameters[0]);
37 whowas_set* grp = i->second;
40 for (whowas_set::iterator ux = grp->begin(); ux != grp->end(); ux++)
43 time_t rawtime = u->signon;
47 timeinfo = localtime(&rawtime);
49 /* XXX - 'b' could be only 25 chars long and then strlcpy() would terminate it for us too? */
50 strlcpy(b,asctime(timeinfo),MAXBUF);
53 WriteServ(user->fd,"314 %s %s %s %s * :%s",user->nick,parameters[0],u->ident,u->dhost,u->gecos);
56 WriteServ(user->fd,"379 %s %s :was connecting from *@%s", user->nick, parameters[0], u->host);
58 if(*Config->HideWhoisServer && !(*user->oper))
59 WriteServ(user->fd,"312 %s %s %s :%s",user->nick,parameters[0], Config->HideWhoisServer, b);
61 WriteServ(user->fd,"312 %s %s %s :%s",user->nick,parameters[0], u->server, b);
66 WriteServ(user->fd,"406 %s %s :There was no such nickname",user->nick,parameters[0]);
70 WriteServ(user->fd,"369 %s %s :End of WHOWAS",user->nick,parameters[0]);