From 1e639377cbad496a0b5f7d969a88fb808508f811 Mon Sep 17 00:00:00 2001 From: brain Date: Tue, 7 Mar 2006 19:11:50 +0000 Subject: Whowas refactor - probably wont compile yet git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3523 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/cmd_whowas.cpp | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'src/cmd_whowas.cpp') diff --git a/src/cmd_whowas.cpp b/src/cmd_whowas.cpp index 19898bdea..b2b3dcc58 100644 --- a/src/cmd_whowas.cpp +++ b/src/cmd_whowas.cpp @@ -57,35 +57,45 @@ extern std::vector factory; extern time_t TIME; extern user_hash clientlist; extern chan_hash chanlist; -extern whowas_hash whowas; extern std::vector all_opers; extern std::vector local_users; extern userrec* fd_ref_table[MAX_DESCRIPTORS]; +extern whowas_users whowas; + void cmd_whowas::Handle (char **parameters, int pcnt, userrec* user) { - whowas_hash::iterator i = whowas.find(parameters[0]); + whowas_users::iterator i = whowas.find(parameters[0]); if (i == whowas.end()) { WriteServ(user->fd,"406 %s %s :There was no such nickname",user->nick,parameters[0]); - WriteServ(user->fd,"369 %s %s :End of WHOWAS",user->nick,parameters[0]); } else { - time_t rawtime = i->second->signon; - tm *timeinfo; - char b[MAXBUF]; - - timeinfo = localtime(&rawtime); - strlcpy(b,asctime(timeinfo),MAXBUF); - b[24] = 0; + whowas_group* grp = (whowas_group*)i; + if (grp->size()) + { + for (whowas_group::iterator u = grp->begin(); u != grp->end(); u++) + { + time_t rawtime = u->signon; + tm *timeinfo; + char b[MAXBUF]; + + timeinfo = localtime(&rawtime); + strlcpy(b,asctime(timeinfo),MAXBUF); + b[24] = 0; - WriteServ(user->fd,"314 %s %s %s %s * :%s",user->nick,i->second->nick,i->second->ident,i->second->dhost,i->second->fullname); - WriteServ(user->fd,"312 %s %s %s :%s",user->nick,i->second->nick, *Config->HideWhoisServer ? Config->HideWhoisServer : i->second->server,b); - WriteServ(user->fd,"369 %s %s :End of WHOWAS",user->nick,parameters[0]); + WriteServ(user->fd,"314 %s %s %s %s * :%s",user->nick,parameters[0],u->ident,u->dhost,u->gecos); + WriteServ(user->fd,"312 %s %s %s :%s",user->nick,parameters[0], *Config->HideWhoisServer ? Config->HideWhoisServer : u->server,b); + WriteServ(user->fd,"369 %s %s :End of WHOWAS",user->nick,parameters[0]); + } + } + else + { + WriteServ(user->fd,"406 %s %s :There was no such nickname",user->nick,parameters[0]); + } } - + WriteServ(user->fd,"369 %s %s :End of WHOWAS",user->nick,parameters[0]); } - -- cgit v1.2.3