diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-23 23:54:24 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-10-23 23:54:24 +0000 |
commit | 5b80dc83fdb6b7952e452a8eb2355005fdb5366c (patch) | |
tree | dc673bae45908b8169f91d973376d1f5ff56b833 /src | |
parent | c43805606f43b3b93e76ef9a250eb0ea367b980a (diff) |
Move some stuff from using userrec cached stuff to using stuff in the connect classes
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@8339 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r-- | src/command_parse.cpp | 8 | ||||
-rw-r--r-- | src/modules/m_operflood.cpp | 1 | ||||
-rw-r--r-- | src/modules/m_safelist.cpp | 2 | ||||
-rw-r--r-- | src/userprocess.cpp | 10 | ||||
-rw-r--r-- | src/users.cpp | 15 |
5 files changed, 15 insertions, 21 deletions
diff --git a/src/command_parse.cpp b/src/command_parse.cpp index 6db10658b..0c3f29a25 100644 --- a/src/command_parse.cpp +++ b/src/command_parse.cpp @@ -225,17 +225,17 @@ void CommandParser::DoLines(User* current, bool one_only) { if (ServerInstance->Time() > current->reset_due) { - current->reset_due = ServerInstance->Time() + current->threshold; + current->reset_due = ServerInstance->Time() + current->MyClass->GetThreshold(); current->lines_in = 0; } - if (++current->lines_in > current->flood && current->flood) + if (++current->lines_in > current->MyClass->GetFlood() && current->MyClass->GetFlood()) { ServerInstance->FloodQuitUser(current); return; } - if ((++floodlines > current->flood) && (current->flood != 0)) + if ((++floodlines > current->MyClass->GetFlood()) && (current->MyClass->GetFlood() != 0)) { ServerInstance->FloodQuitUser(current); return; @@ -319,7 +319,7 @@ bool CommandParser::ProcessCommand(User *user, std::string &cmd) } /* activity resets the ping pending timer */ - user->nping = ServerInstance->Time() + user->pingmax; + user->nping = ServerInstance->Time() + user->MyClass->GetPingTime(); if (cm->second->flags_needed) { if (!user->IsModeSet(cm->second->flags_needed)) diff --git a/src/modules/m_operflood.cpp b/src/modules/m_operflood.cpp index 4532b7d3e..02a6b85f2 100644 --- a/src/modules/m_operflood.cpp +++ b/src/modules/m_operflood.cpp @@ -37,7 +37,6 @@ public: if(!IS_LOCAL(user))
return;
- user->flood = 0;
user->ExemptFromPenalty = true;
user->WriteServ("NOTICE %s :*** You are now free from flood limits.", user->nick);
}
diff --git a/src/modules/m_safelist.cpp b/src/modules/m_safelist.cpp index a2135bd6b..0155492fc 100644 --- a/src/modules/m_safelist.cpp +++ b/src/modules/m_safelist.cpp @@ -217,7 +217,7 @@ class ModuleSafeList : public Module } ld->list_position++; } - while ((chan != NULL) && (amount_sent < (user->sendqmax / 4))); + while ((chan != NULL) && (amount_sent < (user->MyClass->GetSendqMax() / 4))); if (ld->list_ended) { user->Shrink("safelist_cache"); diff --git a/src/userprocess.cpp b/src/userprocess.cpp index 70f0e246f..a3c8bc305 100644 --- a/src/userprocess.cpp +++ b/src/userprocess.cpp @@ -104,13 +104,13 @@ void ProcessUserHandler::Call(User* cu) // Make sure they arn't flooding long lines. if (Server->Time() > current->reset_due) { - current->reset_due = Server->Time() + current->threshold; + current->reset_due = Server->Time() + current->MyClass->GetThreshold(); current->lines_in = 0; } current->lines_in++; - if (current->flood && current->lines_in > current->flood) + if (current->MyClass->GetFlood() && current->lines_in > current->MyClass->GetFlood()) Server->FloodQuitUser(current); else { @@ -210,18 +210,18 @@ void InspIRCd::DoBackgroundUserStuff() // This user didn't answer the last ping, remove them if (!curr->lastping) { - time_t time = this->Time(false) - (curr->nping - curr->pingmax); + time_t time = this->Time(false) - (curr->nping - curr->MyClass->GetPingTime()); char message[MAXBUF]; snprintf(message, MAXBUF, "Ping timeout: %ld second%s", (long)time, time > 1 ? "s" : ""); curr->muted = true; curr->lastping = 1; - curr->nping = TIME+curr->pingmax; + curr->nping = TIME + curr->MyClass->GetPingTime(); User::QuitUser(this, curr, message); continue; } curr->Write("PING :%s",this->Config->ServerName); curr->lastping = 0; - curr->nping = TIME+curr->pingmax; + curr->nping = TIME +curr->MyClass->GetPingTime(); } } } diff --git a/src/users.cpp b/src/users.cpp index a901552fd..c6ebcc848 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -179,7 +179,7 @@ User::User(InspIRCd* Instance, const std::string &uid) : ServerInstance(Instance age = ServerInstance->Time(true); Penalty = 0; lines_in = lastping = signon = idle_lastmsg = nping = registered = 0; - ChannelCount = timeout = flood = bytes_in = bytes_out = cmds_in = cmds_out = 0; + ChannelCount = timeout = bytes_in = bytes_out = cmds_in = cmds_out = 0; OverPenalty = ExemptFromPenalty = muted = exempt = haspassed = dns_done = false; fd = -1; recvq.clear(); @@ -495,10 +495,10 @@ bool User::AddBuffer(std::string a) if (a.length()) recvq.append(a); - if (recvq.length() > (unsigned)this->recvqmax) + if (recvq.length() > (unsigned)this->MyClass->GetRecvqMax()) { this->SetWriteError("RecvQ exceeded"); - ServerInstance->WriteOpers("*** User %s RecvQ of %d exceeds connect class maximum of %d",this->nick,recvq.length(),this->recvqmax); + ServerInstance->WriteOpers("*** User %s RecvQ of %d exceeds connect class maximum of %d",this->nick,recvq.length(),this->MyClass->GetRecvqMax()); return false; } @@ -567,7 +567,7 @@ void User::AddWriteBuf(const std::string &data) if (*this->GetWriteError()) return; - if (sendq.length() + data.length() > (unsigned)this->sendqmax) + if (sendq.length() + data.length() > (unsigned)this->MyClass->GetSendqMax()) { /* * Fix by brain - Set the error text BEFORE calling writeopers, because @@ -575,7 +575,7 @@ void User::AddWriteBuf(const std::string &data) * to repeatedly add the text to the sendq! */ this->SetWriteError("SendQ exceeded"); - ServerInstance->WriteOpers("*** User %s SendQ of %d exceeds connect class maximum of %d",this->nick,sendq.length() + data.length(),this->sendqmax); + ServerInstance->WriteOpers("*** User %s SendQ of %d exceeds connect class maximum of %d",this->nick,sendq.length() + data.length(),this->MyClass->GetSendqMax()); return; } @@ -912,13 +912,8 @@ void User::CheckClass() return; } - this->pingmax = a->GetPingTime(); this->nping = ServerInstance->Time() + a->GetPingTime() + ServerInstance->Config->dns_timeout; this->timeout = ServerInstance->Time() + a->GetRegTimeout(); - this->flood = a->GetFlood(); - this->threshold = a->GetThreshold(); - this->sendqmax = a->GetSendqMax(); - this->recvqmax = a->GetRecvqMax(); this->MaxChans = a->GetMaxChans(); } |