Fix lusers breakage introduced by latest set of optimizations

git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6219 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
brain 2007-01-03 20:58:21 +00:00
parent c218d8091f
commit 2802a62272
4 changed files with 28 additions and 1 deletions

View File

@ -171,6 +171,9 @@ class ModeHandler : public Extensible
/** Get number of items with this mode set on them
*/
virtual unsigned int GetCount();
/** Adjust usage count returned by GetCount
*/
virtual void ChangeCount(int modifier);
/**
* Get the 'value' of this modes prefix.
* determines which to display when there are multiple.

View File

@ -231,6 +231,12 @@ class userrec : public connection
char* cached_hostip;
char* cached_makehost;
char* cached_fullrealhost;
/** When we erase the user (in the destructor),
* we call this method to subtract one from all
* mode characters this user is making use of.
*/
void DecrementModes();
public:
/** Resolvers for looking up this users IP address
* This will occur if and when res_reverse completes.

View File

@ -76,6 +76,11 @@ unsigned int ModeHandler::GetCount()
return 0;
}
void ModeHandler::ChangeCount(int modifier)
{
count += modifier;
}
ModeType ModeHandler::GetModeType()
{
return m_type;

View File

@ -289,6 +289,19 @@ const char* userrec::FormatModes()
return data;
}
void userrec::DecrementModes()
{
for (int n = 0; n < 64; n++)
{
if (modes[n])
{
ModeHandler* mh = ServerInstance->Modes->FindMode(n+65, MODETYPE_USER);
if (mh)
mh->ChangeCount(-1);
}
}
}
userrec::userrec(InspIRCd* Instance) : ServerInstance(Instance)
{
ServerInstance->Log(DEBUG,"userrec::userrec(): Instance: %08x",ServerInstance);
@ -317,7 +330,7 @@ userrec::userrec(InspIRCd* Instance) : ServerInstance(Instance)
userrec::~userrec()
{
this->InvalidateCache();
this->DecrementModes();
if (ip)
{
clonemap::iterator x = ServerInstance->local_clones.find(this->GetIPString());