summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-04 17:21:58 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-10-04 17:21:58 +0000
commit8d95e3d343901a5571351787a3020db1e4aea238 (patch)
treef5c7a5de1a23727d882c9d655b17581f904a0e2b /src
parent87b8062151235cfce221c6a05c2e6ab41f120cf7 (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')
-rw-r--r--src/cmd_whowas.cpp13
-rw-r--r--src/inspircd.cpp2
-rw-r--r--src/users.cpp17
3 files changed, 21 insertions, 11 deletions
diff --git a/src/cmd_whowas.cpp b/src/cmd_whowas.cpp
index fe3171fc5..399214d70 100644
--- a/src/cmd_whowas.cpp
+++ b/src/cmd_whowas.cpp
@@ -18,8 +18,6 @@
#include "users.h"
#include "commands/cmd_whowas.h"
-
-
extern "C" command_t* init_command(InspIRCd* Instance)
{
return new cmd_whowas(Instance);
@@ -29,18 +27,24 @@ CmdResult cmd_whowas::Handle (const char** parameters, int pcnt, userrec* user)
{
irc::whowas::whowas_users::iterator i = ServerInstance->whowas.find(parameters[0]);
+ ServerInstance->Log(DEBUG,"Entered cmd_whowas");
+
if (i == ServerInstance->whowas.end())
{
+ ServerInstance->Log(DEBUG,"No such nick in whowas");
user->WriteServ("406 %s %s :There was no such nickname",user->nick,parameters[0]);
+ user->WriteServ("369 %s %s :End of WHOWAS",user->nick,parameters[0]);
return CMD_FAILURE;
}
else
{
+ ServerInstance->Log(DEBUG,"Whowas set found");
irc::whowas::whowas_set* grp = i->second;
if (grp->size())
{
for (irc::whowas::whowas_set::iterator ux = grp->begin(); ux != grp->end(); ux++)
{
+ ServerInstance->Log(DEBUG,"Spool whowas entry");
irc::whowas::WhoWasGroup* u = *ux;
time_t rawtime = u->signon;
tm *timeinfo;
@@ -65,12 +69,13 @@ CmdResult cmd_whowas::Handle (const char** parameters, int pcnt, userrec* user)
}
else
{
+ ServerInstance->Log(DEBUG,"Oops, empty whowas set found");
user->WriteServ("406 %s %s :There was no such nickname",user->nick,parameters[0]);
+ user->WriteServ("369 %s %s :End of WHOWAS",user->nick,parameters[0]);
return CMD_FAILURE;
}
}
-
- user->WriteServ("369 %s %s :End of WHOWAS",user->nick,parameters[0]);
+ user->WriteServ("369 %s %s :End of WHOWAS",user->nick,parameters[0]);
return CMD_SUCCESS;
}
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 2f35c9528..e9c459394 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -664,7 +664,7 @@ void InspIRCd::DoOneIteration(bool process_module_sockets)
WriteOpers("*** \002EH?!\002 -- Time is flowing BACKWARDS in this dimension! Clock drifted backwards %d secs.",abs(OLDTIME-TIME));
if ((TIME % 3600) == 0)
{
- irc::whowas::MaintainWhoWas(TIME);
+ irc::whowas::MaintainWhoWas(this, TIME);
}
Timers->TickTimers(TIME);
this->DoBackgroundUserStuff(TIME);
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();