diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-07 19:11:50 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-03-07 19:11:50 +0000 |
commit | 1e639377cbad496a0b5f7d969a88fb808508f811 (patch) | |
tree | 7369e1f51e3781e6e24e15463cdd88f00bdf033c /src/cmd_whowas.cpp | |
parent | 8dc8387e8cfb253029cf11ae2df252517da5d073 (diff) |
Whowas refactor - probably wont compile yet
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@3523 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/cmd_whowas.cpp')
-rw-r--r-- | src/cmd_whowas.cpp | 40 |
1 files changed, 25 insertions, 15 deletions
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<ircd_module*> factory; extern time_t TIME; extern user_hash clientlist; extern chan_hash chanlist; -extern whowas_hash whowas; extern std::vector<userrec*> all_opers; extern std::vector<userrec*> 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]); } - |