diff options
author | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-07 21:14:17 +0000 |
---|---|---|
committer | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-07 21:14:17 +0000 |
commit | 6b9eaeba4130acb818a63782640194c7e5bcc2fa (patch) | |
tree | b85582342008671b0f56de5acff039956fcf4eb2 /src/cmd_stats.cpp | |
parent | f9eb4c966f3c20ac5767edc19f4f8803b17e4147 (diff) |
Move all /WHOWAS related out of core and into cmd_whowas.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6249 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/cmd_stats.cpp')
-rw-r--r-- | src/cmd_stats.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/cmd_stats.cpp b/src/cmd_stats.cpp index f6f68677c..b6e44e93c 100644 --- a/src/cmd_stats.cpp +++ b/src/cmd_stats.cpp @@ -18,7 +18,7 @@ #include "modules.h" #include "xline.h" #include "commands/cmd_stats.h" - +#include "commands/cmd_whowas.h" extern "C" command_t* init_command(InspIRCd* Instance) @@ -174,19 +174,20 @@ void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_lis if (!ServerInstance->Config->WhoWasGroupSize == 0 && !ServerInstance->Config->WhoWasMaxGroups == 0) { - int whowas_size = 0; - int whowas_bytes = 0; - irc::whowas::whowas_users_fifo::iterator iter; - for (iter = ServerInstance->whowas_fifo.begin(); iter != ServerInstance->whowas_fifo.end(); iter++) + command_t* whowas_command = ServerInstance->Parser->GetHandler("WHOWAS"); + if (whowas_command) { - irc::whowas::whowas_set* n = (irc::whowas::whowas_set*)ServerInstance->whowas.find(iter->second)->second; - if (n->size()) + std::deque<classbase*> params; + Extensible whowas_stats; + params.push_back(&whowas_stats); + whowas_command->HandleInternal(WHOWAS_STATS, params); + if (whowas_stats.GetExt("stats")) { - whowas_size += n->size(); - whowas_bytes += (sizeof(irc::whowas::whowas_set) + ( sizeof(irc::whowas::WhoWasGroup) * n->size() ) ); + char* stats; + whowas_stats.GetExt("stats", stats); + results.push_back(sn+" 249 "+user->nick+" :"+ConvToStr(stats)); } } - results.push_back(sn+" 249 "+user->nick+" :Whowas(MAPSETS) "+ConvToStr(whowas_size)+" ("+ConvToStr(whowas_bytes)+" bytes)"); } results.push_back(sn+" 249 "+user->nick+" :MOTD(VECTOR) "+ConvToStr(ServerInstance->Config->MOTD.size())+", RULES(VECTOR) "+ConvToStr(ServerInstance->Config->RULES.size())); |