X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcoremods%2Fcore_whowas.cpp;h=d73fdf491bae833100a7ab53315a3fffe3cfbcb3;hb=8c71a2a6304f0d77aa7738e04a44f366a158cadd;hp=fee40377a382b7b7231aa96b1e56048155f68c0b;hpb=da877e4750333f02c48a667241a41412c38bfd16;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/coremods/core_whowas.cpp b/src/coremods/core_whowas.cpp index fee40377a..d73fdf491 100644 --- a/src/coremods/core_whowas.cpp +++ b/src/coremods/core_whowas.cpp @@ -51,7 +51,7 @@ CmdResult CommandWhowas::Handle (const std::vector& parameters, Use { for (WhoWas::Nick::List::const_iterator i = list.begin(); i != list.end(); ++i) { - WhoWasGroup* u = *i; + WhoWas::Entry* u = *i; user->WriteNumeric(RPL_WHOWASUSER, "%s %s %s * :%s", parameters[0].c_str(), u->ident.c_str(),u->dhost.c_str(),u->gecos.c_str()); @@ -88,7 +88,7 @@ const WhoWas::Nick* WhoWas::Manager::FindNick(const std::string& nickname) const return nick; } -std::string WhoWas::Manager::GetStats() const +WhoWas::Manager::Stats WhoWas::Manager::GetStats() const { size_t entrycount = 0; for (whowas_users::const_iterator i = whowas.begin(); i != whowas.end(); ++i) @@ -96,7 +96,10 @@ std::string WhoWas::Manager::GetStats() const WhoWas::Nick::List& list = i->second->entries; entrycount += list.size(); } - return "Whowas entries: " + ConvToStr(entrycount); + + Stats stats; + stats.entrycount = entrycount; + return stats; } void WhoWas::Manager::Add(User* user) @@ -112,7 +115,7 @@ void WhoWas::Manager::Add(User* user) { // This nick is new, create a list for it and add the first record to it WhoWas::Nick* nick = new WhoWas::Nick(ret.first->first); - nick->entries.push_back(new WhoWasGroup(user)); + nick->entries.push_back(new Entry(user)); ret.first->second = nick; // Add this nick to the fifo too @@ -131,7 +134,7 @@ void WhoWas::Manager::Add(User* user) { // We've met this nick before, add a new record to the list WhoWas::Nick::List& list = ret.first->second->entries; - list.push_back(new WhoWasGroup(user)); + list.push_back(new Entry(user)); // If there are too many records for this nick, remove the oldest (front) if (list.size() > this->GroupSize) @@ -220,8 +223,13 @@ void WhoWas::Manager::UpdateConfig(unsigned int NewGroupSize, unsigned int NewMa Prune(); } -WhoWasGroup::WhoWasGroup(User* user) : host(user->host), dhost(user->dhost), ident(user->ident), - server(user->server->GetName()), gecos(user->fullname), signon(user->signon) +WhoWas::Entry::Entry(User* user) + : host(user->host) + , dhost(user->dhost) + , ident(user->ident) + , server(user->server->GetName()) + , gecos(user->fullname) + , signon(user->signon) { } @@ -259,7 +267,7 @@ class ModuleWhoWas : public Module ModResult OnStats(char symbol, User* user, string_list &results) { if (symbol == 'z') - results.push_back("249 "+user->nick+" :"+cmd.manager.GetStats()); + results.push_back("249 "+user->nick+" :Whowas entries: "+ConvToStr(cmd.manager.GetStats().entrycount)); return MOD_RES_PASSTHRU; }