diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-10-04 17:21:58 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-10-04 17:21:58 +0000 |
commit | 8d95e3d343901a5571351787a3020db1e4aea238 (patch) | |
tree | f5c7a5de1a23727d882c9d655b17581f904a0e2b /src/users.cpp | |
parent | 87b8062151235cfce221c6a05c2e6ab41f120cf7 (diff) |
Whowas is now fixed.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5414 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/users.cpp')
-rw-r--r-- | src/users.cpp | 17 |
1 files changed, 11 insertions, 6 deletions
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<irc::string,char*> 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(); |