From 8d95e3d343901a5571351787a3020db1e4aea238 Mon Sep 17 00:00:00 2001 From: brain Date: Wed, 4 Oct 2006 17:21:58 +0000 Subject: Whowas is now fixed. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5414 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/users.cpp | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/users.cpp') diff --git a/src/users.cpp b/src/users.cpp index e80a476f3..51692958c 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -24,7 +24,6 @@ #include "xline.h" #include "cull_list.h" -irc::whowas::whowas_users whowas; static unsigned long already_sent[MAX_DESCRIPTORS] = {0}; typedef std::map opertype_t; @@ -809,9 +808,9 @@ namespace irc } /* every hour, run this function which removes all entries over 3 days */ - void MaintainWhoWas(time_t t) + void MaintainWhoWas(InspIRCd* ServerInstance, time_t t) { - for (whowas_users::iterator iter = ::whowas.begin(); iter != ::whowas.end(); iter++) + for (whowas_users::iterator iter = ServerInstance->whowas.begin(); iter != ServerInstance->whowas.end(); iter++) { whowas_set* n = (whowas_set*)iter->second; if (n->size()) @@ -831,21 +830,27 @@ namespace irc /* adds or updates an entry in the whowas list */ void userrec::AddToWhoWas() { - irc::whowas::whowas_users::iterator iter = whowas.find(this->nick); + irc::whowas::whowas_users::iterator iter = ServerInstance->whowas.find(this->nick); - if (iter == whowas.end()) + ServerInstance->Log(DEBUG,"Add to whowas lists"); + + if (iter == ServerInstance->whowas.end()) { + ServerInstance->Log(DEBUG,"Adding new whowas set for %s",this->nick); irc::whowas::whowas_set* n = new irc::whowas::whowas_set; irc::whowas::WhoWasGroup *a = new irc::whowas::WhoWasGroup(this); n->push_back(a); - whowas[this->nick] = n; + ServerInstance->whowas[this->nick] = n; } else { irc::whowas::whowas_set* group = (irc::whowas::whowas_set*)iter->second; + ServerInstance->Log(DEBUG,"Using existing whowas group for %s",this->nick); + if (group->size() > 10) { + ServerInstance->Log(DEBUG,"Trimming existing group to ten entries for %s",this->nick); irc::whowas::WhoWasGroup *a = (irc::whowas::WhoWasGroup*)*(group->begin()); DELETE(a); group->pop_front(); -- cgit v1.2.3