mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
extern time_t TIME -> InspIRCd::Time()
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4873 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
488932d457
commit
76ebc88ccd
@ -40,7 +40,7 @@ class classbase
|
||||
/** Constructor,
|
||||
* Sets the object's time
|
||||
*/
|
||||
classbase() { age = TIME; }
|
||||
classbase();
|
||||
~classbase() { }
|
||||
};
|
||||
|
||||
|
@ -109,6 +109,9 @@ class InspIRCd : public classbase
|
||||
|
||||
featurelist Features;
|
||||
|
||||
time_t TIME;
|
||||
time_t OLDTIME;
|
||||
|
||||
public:
|
||||
time_t startup_time;
|
||||
ModeParser* ModeGrok;
|
||||
@ -125,10 +128,13 @@ class InspIRCd : public classbase
|
||||
std::vector<userrec*> all_opers;
|
||||
DNS* Res;
|
||||
TimerManager* Timers;
|
||||
command_table cmdlist;
|
||||
|
||||
ModuleList modules;
|
||||
FactoryList factory;
|
||||
|
||||
time_t Time();
|
||||
|
||||
int GetModuleCount();
|
||||
|
||||
Module* FindModule(const std::string &name);
|
||||
|
@ -27,8 +27,6 @@
|
||||
const int bitfields[] = {1,2,4,8,16,32,64,128};
|
||||
const int inverted_bitfields[] = {~1,~2,~4,~8,~16,~32,~64,~128};
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
bool Extensible::Shrink(const std::string &key)
|
||||
{
|
||||
/* map::size_type map::erase( const key_type& key );
|
||||
|
@ -38,8 +38,6 @@ using namespace std;
|
||||
#include "helperfuncs.h"
|
||||
#include "typedefs.h"
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
chanrec::chanrec(InspIRCd* Instance) : ServerInstance(Instance)
|
||||
{
|
||||
*name = *topic = *setby = *key = 0;
|
||||
@ -238,7 +236,7 @@ chanrec* chanrec::JoinUser(InspIRCd* Instance, userrec *user, const char* cn, bo
|
||||
|
||||
strlcpy(Ptr->name, cname,CHANMAX);
|
||||
Ptr->modes[CM_TOPICLOCK] = Ptr->modes[CM_NOEXTERNAL] = 1;
|
||||
Ptr->created = TIME;
|
||||
Ptr->created = Instance->Time();
|
||||
*Ptr->topic = 0;
|
||||
strlcpy(Ptr->setby, user->nick,NICKMAX-1);
|
||||
Ptr->topicset = 0;
|
||||
|
@ -31,9 +31,6 @@
|
||||
#include "helperfuncs.h"
|
||||
#include "commands/cmd_kline.h"
|
||||
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
void cmd_kline::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
{
|
||||
if (pcnt >= 3)
|
||||
|
@ -28,9 +28,6 @@
|
||||
#include "hashcomp.h"
|
||||
#include "commands/cmd_nick.h"
|
||||
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
void cmd_nick::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
{
|
||||
char oldnick[NICKMAX];
|
||||
|
@ -28,15 +28,12 @@
|
||||
#include "hashcomp.h"
|
||||
#include "commands/cmd_notice.h"
|
||||
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
void cmd_notice::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
{
|
||||
userrec *dest;
|
||||
chanrec *chan;
|
||||
|
||||
user->idle_lastmsg = TIME;
|
||||
user->idle_lastmsg = ServerInstance->Time();
|
||||
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
|
||||
return;
|
||||
|
@ -36,9 +36,6 @@
|
||||
#include "command_parse.h"
|
||||
#include "commands/cmd_oper.h"
|
||||
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
bool OneOfMatches(const char* host, const char* ip, const char* hostlist)
|
||||
{
|
||||
std::stringstream hl(hostlist);
|
||||
|
@ -25,15 +25,12 @@
|
||||
#include "helperfuncs.h"
|
||||
#include "commands/cmd_privmsg.h"
|
||||
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
void cmd_privmsg::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
{
|
||||
userrec *dest;
|
||||
chanrec *chan;
|
||||
|
||||
user->idle_lastmsg = TIME;
|
||||
user->idle_lastmsg = ServerInstance->Time();
|
||||
|
||||
if (ServerInstance->Parser->LoopCall(user, this, parameters, pcnt, 0))
|
||||
return;
|
||||
|
@ -34,9 +34,6 @@
|
||||
#include "socketengine.h"
|
||||
#include "commands/cmd_quit.h"
|
||||
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
void cmd_quit::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
{
|
||||
user_hash::iterator iter = ServerInstance->clientlist.find(user->nick);
|
||||
|
@ -41,10 +41,6 @@
|
||||
#include "command_parse.h"
|
||||
#include "commands/cmd_stats.h"
|
||||
|
||||
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
void cmd_stats::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
{
|
||||
string_list values;
|
||||
@ -110,7 +106,7 @@ void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_lis
|
||||
{
|
||||
if (*i->second->oper)
|
||||
{
|
||||
results.push_back(sn+" 249 "+user->nick+" :"+i->second->nick+" ("+i->second->ident+"@"+i->second->dhost+") Idle: "+ConvToStr(TIME - i->second->idle_lastmsg));
|
||||
results.push_back(sn+" 249 "+user->nick+" :"+i->second->nick+" ("+i->second->ident+"@"+i->second->dhost+") Idle: "+ConvToStr(ServerInstance->Time() - i->second->idle_lastmsg));
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
@ -213,7 +209,7 @@ void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_lis
|
||||
userrec* i = *n;
|
||||
if (ServerInstance->IsNick(i->nick))
|
||||
{
|
||||
results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->dhost+"] "+ConvToStr(i->sendq.length())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(TIME - i->age));
|
||||
results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->dhost+"] "+ConvToStr(i->sendq.length())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(ServerInstance->Time() - i->age));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -227,7 +223,7 @@ void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_lis
|
||||
userrec* i = *n;
|
||||
if (ServerInstance->IsNick(i->nick))
|
||||
{
|
||||
results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->GetIPString()+"] "+ConvToStr(i->sendq.length())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(TIME - i->age));
|
||||
results.push_back(sn+" 211 "+user->nick+" "+i->nick+"["+i->ident+"@"+i->GetIPString()+"] "+ConvToStr(i->sendq.length())+" "+ConvToStr(i->cmds_out)+" "+ConvToStr(i->bytes_out)+" "+ConvToStr(i->cmds_in)+" "+ConvToStr(i->bytes_in)+" "+ConvToStr(ServerInstance->Time() - i->age));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -236,7 +232,7 @@ void DoStats(InspIRCd* ServerInstance, char statschar, userrec* user, string_lis
|
||||
if (statschar == 'u')
|
||||
{
|
||||
time_t current_time = 0;
|
||||
current_time = TIME;
|
||||
current_time = ServerInstance->Time();
|
||||
time_t server_uptime = current_time - ServerInstance->startup_time;
|
||||
struct tm* stime;
|
||||
stime = gmtime(&server_uptime);
|
||||
|
@ -21,14 +21,12 @@
|
||||
#include "helperfuncs.h"
|
||||
#include "commands/cmd_time.h"
|
||||
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
void cmd_time::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
{
|
||||
struct tm* timeinfo;
|
||||
time_t local = ServerInstance->Time();
|
||||
|
||||
timeinfo = localtime(&TIME);
|
||||
timeinfo = localtime(&local);
|
||||
|
||||
char tms[26];
|
||||
snprintf(tms,26,"%s",asctime(timeinfo));
|
||||
|
@ -22,9 +22,6 @@
|
||||
#include "commands/cmd_topic.h"
|
||||
#include "helperfuncs.h"
|
||||
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
{
|
||||
chanrec* Ptr;
|
||||
@ -86,7 +83,7 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
|
||||
|
||||
strlcpy(Ptr->topic,topic,MAXTOPIC-1);
|
||||
strlcpy(Ptr->setby,user->nick,NICKMAX-1);
|
||||
Ptr->topicset = TIME;
|
||||
Ptr->topicset = ServerInstance->Time();
|
||||
Ptr->WriteChannel(user, "TOPIC %s :%s", Ptr->name, Ptr->topic);
|
||||
if (IS_LOCAL(user))
|
||||
{
|
||||
|
@ -22,10 +22,6 @@
|
||||
#include "helperfuncs.h"
|
||||
#include "commands/cmd_whois.h"
|
||||
|
||||
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
const char* Spacify(char* n)
|
||||
{
|
||||
static char x[MAXBUF];
|
||||
@ -81,7 +77,7 @@ void do_whois(InspIRCd* ServerInstance, userrec* user, userrec* dest,unsigned lo
|
||||
if (!strcasecmp(user->server,dest->server))
|
||||
{
|
||||
// idle time and signon line can only be sent if youre on the same server (according to RFC)
|
||||
user->WriteServ("317 %s %s %d %d :seconds idle, signon time",user->nick, dest->nick, abs((dest->idle_lastmsg)-TIME), dest->signon);
|
||||
user->WriteServ("317 %s %s %d %d :seconds idle, signon time",user->nick, dest->nick, abs((dest->idle_lastmsg)-ServerInstance->Time()), dest->signon);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -48,8 +48,6 @@
|
||||
|
||||
#define nspace __gnu_cxx
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
/* Special commands which may occur without registration of the user */
|
||||
cmd_user* command_user;
|
||||
cmd_nick* command_nick;
|
||||
@ -202,7 +200,7 @@ void CommandParser::ProcessCommand(userrec *user, std::string &cmd)
|
||||
if (user)
|
||||
{
|
||||
/* activity resets the ping pending timer */
|
||||
user->nping = TIME + user->pingmax;
|
||||
user->nping = ServerInstance->Time() + user->pingmax;
|
||||
if (cm->second->flags_needed)
|
||||
{
|
||||
if (!user->IsModeSet(cm->second->flags_needed))
|
||||
|
@ -51,8 +51,6 @@
|
||||
|
||||
extern InspIRCd* ServerInstance;
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
const long duration_m = 60;
|
||||
const long duration_h = duration_m * 60;
|
||||
const long duration_d = duration_h * 24;
|
||||
|
@ -26,8 +26,6 @@
|
||||
#include "userprocess.h"
|
||||
#include "xline.h"
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
std::vector<std::string> old_module_names, new_module_names, added_modules, removed_modules;
|
||||
|
||||
ServerConfig::ServerConfig(InspIRCd* Instance) : ServerInstance(Instance)
|
||||
|
@ -43,8 +43,6 @@
|
||||
#include "typedefs.h"
|
||||
#include "inspircd.h"
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
static char TIMESTR[26];
|
||||
static time_t LAST = 0;
|
||||
|
||||
@ -75,13 +73,14 @@ void InspIRCd::Log(int level, const std::string &text)
|
||||
if ((level < ServerInstance->Config->LogLevel) && !ServerInstance->Config->forcedebug)
|
||||
return;
|
||||
|
||||
if (TIME != LAST)
|
||||
if (ServerInstance->Time() != LAST)
|
||||
{
|
||||
struct tm *timeinfo = localtime(&TIME);
|
||||
time_t local = ServerInstance->Time();
|
||||
struct tm *timeinfo = localtime(&local);
|
||||
|
||||
strlcpy(TIMESTR,asctime(timeinfo),26);
|
||||
TIMESTR[24] = ':';
|
||||
LAST = TIME;
|
||||
LAST = ServerInstance->Time();
|
||||
}
|
||||
|
||||
if (ServerInstance->Config->log_file && ServerInstance->Config->writelog)
|
||||
|
@ -76,8 +76,6 @@ int iterations = 0;
|
||||
insp_sockaddr client, server;
|
||||
socklen_t length;
|
||||
|
||||
time_t TIME = time(NULL), OLDTIME = time(NULL);
|
||||
|
||||
char lowermap[255];
|
||||
|
||||
void InspIRCd::AddServerName(const std::string &servername)
|
||||
@ -219,8 +217,8 @@ InspIRCd::InspIRCd(int argc, char** argv) : ModCount(-1)
|
||||
this->Config = new ServerConfig(this);
|
||||
this->Start();
|
||||
this->module_sockets.clear();
|
||||
this->startup_time = time(NULL);
|
||||
srand(time(NULL));
|
||||
this->TIME = this->OLDTIME = this->startup_time = time(NULL);
|
||||
srand(this->TIME);
|
||||
log(DEBUG,"*** InspIRCd starting up!");
|
||||
if (!ServerConfig::FileExists(CONFIG_FILE))
|
||||
{
|
||||
@ -1039,3 +1037,16 @@ int InspIRCd::GetModuleCount()
|
||||
return this->ModCount;
|
||||
}
|
||||
|
||||
time_t InspIRCd::Time()
|
||||
{
|
||||
return TIME;
|
||||
}
|
||||
|
||||
classbase::classbase()
|
||||
{
|
||||
/* This is in here only to make use of ServerInstance
|
||||
* without using an ugly extern
|
||||
*/
|
||||
this->age = ServerInstance->Time();
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,6 @@ using irc::sockets::OpenTCPSocket;
|
||||
using irc::sockets::insp_inaddr;
|
||||
using irc::sockets::insp_sockaddr;
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
InspSocket::InspSocket(InspIRCd* SI)
|
||||
{
|
||||
this->state = I_DISCONNECTED;
|
||||
|
@ -65,8 +65,6 @@ using namespace std;
|
||||
/* +n (notice mask - our implementation of snomasks) */
|
||||
#include "modes/umode_n.h"
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
ModeHandler::ModeHandler(InspIRCd* Instance, char modeletter, int parameters_on, int parameters_off, bool listmode, ModeType type, bool operonly)
|
||||
: ServerInstance(Instance), mode(modeletter), n_params_on(parameters_on), n_params_off(parameters_off), list(listmode), m_type(type), oper(operonly)
|
||||
{
|
||||
|
@ -13,8 +13,6 @@
|
||||
#include "hashcomp.h"
|
||||
#include "modes/cmode_b.h"
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
ModeChannelBan::ModeChannelBan(InspIRCd* Instance) : ModeHandler(Instance, 'b', 1, 1, true, MODETYPE_CHANNEL, false)
|
||||
{
|
||||
}
|
||||
@ -91,7 +89,7 @@ std::string& ModeChannelBan::AddBan(userrec *user,std::string &dest,chanrec *cha
|
||||
}
|
||||
}
|
||||
|
||||
b.set_time = TIME;
|
||||
b.set_time = ServerInstance->Time();
|
||||
strlcpy(b.data,dest.c_str(),MAXBUF);
|
||||
if (*user->nick)
|
||||
{
|
||||
|
@ -14,8 +14,6 @@
|
||||
#include "hashcomp.h"
|
||||
#include "modes/cmode_h.h"
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
ModeChannelHalfOp::ModeChannelHalfOp(InspIRCd* Instance) : ModeHandler(Instance, 'h', 1, 1, true, MODETYPE_CHANNEL, false)
|
||||
{
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
#include "hashcomp.h"
|
||||
#include "modes/cmode_o.h"
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
ModeChannelOp::ModeChannelOp(InspIRCd* Instance) : ModeHandler(Instance, 'o', 1, 1, true, MODETYPE_CHANNEL, false)
|
||||
{
|
||||
}
|
||||
|
@ -14,8 +14,6 @@
|
||||
#include "hashcomp.h"
|
||||
#include "modes/cmode_v.h"
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
ModeChannelVoice::ModeChannelVoice(InspIRCd* Instance) : ModeHandler(Instance, 'v', 1, 1, true, MODETYPE_CHANNEL, false)
|
||||
{
|
||||
}
|
||||
|
@ -45,11 +45,6 @@
|
||||
#include "dns.h"
|
||||
#include "inspircd.h"
|
||||
|
||||
extern time_t TIME;
|
||||
extern command_table cmdlist;
|
||||
|
||||
class Server;
|
||||
|
||||
// version is a simple class for holding a modules version number
|
||||
|
||||
Version::Version(int major, int minor, int revision, int build, int flags)
|
||||
|
@ -44,8 +44,6 @@
|
||||
* I can access the socket engine :\
|
||||
*/
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
/* Forward declare, so we can have the typedef neatly at the top */
|
||||
class SQLConn;
|
||||
/* Also needs forward declaration, as it's used inside SQLconn */
|
||||
|
@ -29,9 +29,6 @@
|
||||
|
||||
/* $ModDesc: Attempt to block /amsg, at least some of the irritating mIRC scripts. */
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
|
||||
enum BlockAction { IBLOCK_KILL, IBLOCK_KILLOPERS, IBLOCK_NOTICE, IBLOCK_NOTICEOPERS, IBLOCK_SILENT };
|
||||
|
||||
class BlockedMessage : public classbase
|
||||
|
@ -30,8 +30,6 @@
|
||||
|
||||
/* $ModDesc: Gives /cban, aka C:lines. Think Q:lines, for channels. */
|
||||
|
||||
|
||||
|
||||
class CBan : public classbase
|
||||
{
|
||||
public:
|
||||
@ -50,12 +48,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
std::string EncodeCBan(const CBan &ban);
|
||||
CBan DecodeCBan(const std::string &data);
|
||||
bool CBanComp(const CBan &ban1, const CBan &ban2);
|
||||
void ExpireBans();
|
||||
|
||||
extern time_t TIME;
|
||||
typedef std::vector<CBan> cbanlist;
|
||||
|
||||
/* cbans is declared here, as our type is right above. Don't try move it. */
|
||||
@ -75,8 +69,6 @@ class cmd_cban : public command_t
|
||||
{
|
||||
/* syntax: CBAN #channel time :reason goes here */
|
||||
/* 'time' is a human-readable timestring, like 2d3h2s. */
|
||||
|
||||
ExpireBans();
|
||||
|
||||
if(pcnt == 1)
|
||||
{
|
||||
@ -85,7 +77,7 @@ class cmd_cban : public command_t
|
||||
{
|
||||
if (parameters[0] == iter->chname)
|
||||
{
|
||||
unsigned long remaining = (iter->set_on + iter->length) - TIME;
|
||||
unsigned long remaining = (iter->set_on + iter->length) - ServerInstance->Time();
|
||||
user->WriteServ( "386 %s %s :Removed CBAN with %lu seconds left before expiry (%s)", user->nick, iter->chname.c_str(), remaining, iter->reason.c_str());
|
||||
cbans.erase(iter);
|
||||
break;
|
||||
@ -103,7 +95,7 @@ class cmd_cban : public command_t
|
||||
long length = duration(parameters[1]);
|
||||
std::string reason = (pcnt > 2) ? parameters[2] : "No reason supplied";
|
||||
|
||||
cbans.push_back(CBan(parameters[0], user->nick, TIME, length, reason));
|
||||
cbans.push_back(CBan(parameters[0], user->nick, ServerInstance->Time(), length, reason));
|
||||
|
||||
std::sort(cbans.begin(), cbans.end(), CBanComp);
|
||||
|
||||
@ -157,7 +149,7 @@ class ModuleCBan : public Module
|
||||
{
|
||||
for(cbanlist::iterator iter = cbans.begin(); iter != cbans.end(); iter++)
|
||||
{
|
||||
unsigned long remaining = (iter->set_on + iter->length) - TIME;
|
||||
unsigned long remaining = (iter->set_on + iter->length) - ServerInstance->Time();
|
||||
results.push_back(std::string(ServerInstance->Config->ServerName)+" 210 "+user->nick+" "+iter->chname.c_str()+" "+iter->set_by+" "+ConvToStr(iter->set_on)+" "+ConvToStr(iter->length)+" "+ConvToStr(remaining)+" :"+iter->reason);
|
||||
}
|
||||
}
|
||||
@ -242,10 +234,10 @@ class ModuleCBan : public Module
|
||||
/* 0 == permanent, don't mess with them! -- w00t */
|
||||
if (iter->length != 0)
|
||||
{
|
||||
if (iter->set_on + iter->length <= TIME)
|
||||
if (iter->set_on + iter->length <= ServerInstance->Time())
|
||||
{
|
||||
log(DEBUG, "m_cban.so: Ban on %s expired, removing...", iter->chname.c_str());
|
||||
ServerInstance->WriteOpers("*** %li second CBAN on %s (%s) set %u seconds ago expired", iter->length, iter->chname.c_str(), iter->reason.c_str(), TIME - iter->set_on);
|
||||
ServerInstance->WriteOpers("*** %li second CBAN on %s (%s) set %u seconds ago expired", iter->length, iter->chname.c_str(), iter->reason.c_str(), ServerInstance->Time() - iter->set_on);
|
||||
cbans.erase(iter);
|
||||
go_again = true;
|
||||
}
|
||||
|
@ -26,9 +26,6 @@ using namespace std;
|
||||
/* $ModDesc: Connection throttle */
|
||||
|
||||
int conns = 0, throttled = 0;
|
||||
extern time_t TIME;
|
||||
|
||||
|
||||
|
||||
class ModuleConnFlood : public Module
|
||||
{
|
||||
|
@ -32,7 +32,6 @@ class ModuleHttp;
|
||||
|
||||
|
||||
static ModuleHttp* HttpModule;
|
||||
extern time_t TIME;
|
||||
static bool claimed;
|
||||
|
||||
enum HttpState
|
||||
|
@ -24,10 +24,6 @@ using namespace std;
|
||||
#include "configreader.h"
|
||||
#include "inspircd.h"
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
|
||||
|
||||
class ListData : public classbase
|
||||
{
|
||||
public:
|
||||
|
@ -23,12 +23,8 @@ using namespace std;
|
||||
#include <vector>
|
||||
#include "inspircd.h"
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
/* $ModDesc: A module overriding /list, and making it safe - stop those sendq problems. */
|
||||
|
||||
|
||||
|
||||
class ModuleSecureList : public Module
|
||||
{
|
||||
private:
|
||||
|
@ -23,8 +23,6 @@
|
||||
#include "socketengine.h"
|
||||
#include "wildcard.h"
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
using namespace std;
|
||||
using namespace irc::sockets;
|
||||
|
||||
|
@ -54,8 +54,6 @@ using namespace std;
|
||||
extern struct sockaddr_in client,server;
|
||||
extern socklen_t length;
|
||||
|
||||
extern time_t TIME;
|
||||
extern time_t OLDTIME;
|
||||
char data[65536];
|
||||
|
||||
void InspIRCd::ProcessUser(userrec* cu)
|
||||
|
@ -31,8 +31,6 @@
|
||||
#include "xline.h"
|
||||
#include "cull_list.h"
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
irc::whowas::whowas_users whowas;
|
||||
static unsigned long already_sent[MAX_DESCRIPTORS] = {0};
|
||||
|
||||
@ -255,7 +253,7 @@ userrec::userrec(InspIRCd* Instance) : ServerInstance(Instance)
|
||||
// the PROPER way to do it, AVOID bzero at *ALL* costs
|
||||
*password = *nick = *ident = *host = *dhost = *fullname = *awaymsg = *oper = 0;
|
||||
server = (char*)Instance->FindServerNamePtr(Instance->Config->ServerName);
|
||||
reset_due = TIME;
|
||||
reset_due = ServerInstance->Time();
|
||||
lines_in = fd = lastping = signon = idle_lastmsg = nping = registered = 0;
|
||||
timeout = flood = bytes_in = bytes_out = cmds_in = cmds_out = 0;
|
||||
haspassed = dns_done = false;
|
||||
@ -742,14 +740,14 @@ namespace irc
|
||||
}
|
||||
|
||||
/* every hour, run this function which removes all entries over 3 days */
|
||||
void MaintainWhoWas(time_t TIME)
|
||||
void MaintainWhoWas(time_t t)
|
||||
{
|
||||
for (whowas_users::iterator iter = ::whowas.begin(); iter != ::whowas.end(); iter++)
|
||||
{
|
||||
whowas_set* n = (whowas_set*)iter->second;
|
||||
if (n->size())
|
||||
{
|
||||
while ((n->begin() != n->end()) && ((*n->begin())->signon < TIME - 259200)) // 3 days
|
||||
while ((n->begin() != n->end()) && ((*n->begin())->signon < t - 259200)) // 3 days
|
||||
{
|
||||
WhoWasGroup *a = *(n->begin());
|
||||
DELETE(a);
|
||||
@ -826,7 +824,7 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
|
||||
strcpy(_new->ident, "unknown");
|
||||
|
||||
_new->registered = REG_NONE;
|
||||
_new->signon = TIME + Instance->Config->dns_timeout;
|
||||
_new->signon = Instance->Time() + Instance->Config->dns_timeout;
|
||||
_new->lastping = 1;
|
||||
|
||||
log(DEBUG,"Setting socket addresses");
|
||||
@ -859,8 +857,8 @@ void userrec::AddClient(InspIRCd* Instance, int socket, int port, bool iscached,
|
||||
}
|
||||
}
|
||||
|
||||
_new->nping = TIME + _new->pingmax + Instance->Config->dns_timeout;
|
||||
_new->timeout = TIME+class_regtimeout;
|
||||
_new->nping = Instance->Time() + _new->pingmax + Instance->Config->dns_timeout;
|
||||
_new->timeout = Instance->Time() + class_regtimeout;
|
||||
_new->flood = class_flood;
|
||||
_new->threshold = class_threshold;
|
||||
_new->sendqmax = class_sqmax;
|
||||
@ -962,7 +960,7 @@ long userrec::LocalCloneCount()
|
||||
void userrec::FullConnect(CullList* Goners)
|
||||
{
|
||||
ServerInstance->stats->statsConnects++;
|
||||
this->idle_lastmsg = TIME;
|
||||
this->idle_lastmsg = ServerInstance->Time();
|
||||
|
||||
ConnectClass a = this->GetClass();
|
||||
|
||||
|
@ -58,10 +58,6 @@ extern InspIRCd* ServerInstance;
|
||||
* -- Brain
|
||||
*/
|
||||
|
||||
|
||||
|
||||
extern time_t TIME;
|
||||
|
||||
/* Lists for temporary lines with an expiry time */
|
||||
|
||||
std::vector<KLine> klines;
|
||||
@ -153,7 +149,7 @@ bool add_gline(long duration, const char* source,const char* reason,const char*
|
||||
strlcpy(item.reason,reason,MAXBUF);
|
||||
strlcpy(item.source,source,255);
|
||||
item.n_matches = 0;
|
||||
item.set_time = TIME;
|
||||
item.set_time = ServerInstance->Time();
|
||||
|
||||
if (duration)
|
||||
{
|
||||
@ -179,7 +175,7 @@ bool add_eline(long duration, const char* source, const char* reason, const char
|
||||
strlcpy(item.reason,reason,MAXBUF);
|
||||
strlcpy(item.source,source,255);
|
||||
item.n_matches = 0;
|
||||
item.set_time = TIME;
|
||||
item.set_time = ServerInstance->Time();
|
||||
if (duration)
|
||||
{
|
||||
elines.push_back(item);
|
||||
@ -204,7 +200,7 @@ bool add_qline(long duration, const char* source, const char* reason, const char
|
||||
strlcpy(item.source,source,255);
|
||||
item.n_matches = 0;
|
||||
item.is_global = false;
|
||||
item.set_time = TIME;
|
||||
item.set_time = ServerInstance->Time();
|
||||
if (duration)
|
||||
{
|
||||
qlines.push_back(item);
|
||||
@ -235,7 +231,7 @@ bool add_zline(long duration, const char* source, const char* reason, const char
|
||||
strlcpy(item.source,source,255);
|
||||
item.n_matches = 0;
|
||||
item.is_global = false;
|
||||
item.set_time = TIME;
|
||||
item.set_time = ServerInstance->Time();
|
||||
if (duration)
|
||||
{
|
||||
zlines.push_back(item);
|
||||
@ -259,7 +255,7 @@ bool add_kline(long duration, const char* source, const char* reason, const char
|
||||
strlcpy(item.reason,reason,MAXBUF);
|
||||
strlcpy(item.source,source,255);
|
||||
item.n_matches = 0;
|
||||
item.set_time = TIME;
|
||||
item.set_time = ServerInstance->Time();
|
||||
if (duration)
|
||||
{
|
||||
klines.push_back(item);
|
||||
@ -602,7 +598,7 @@ bool QSortComparison ( const QLine one, const QLine two )
|
||||
|
||||
void expire_lines()
|
||||
{
|
||||
time_t current = TIME;
|
||||
time_t current = ServerInstance->Time();
|
||||
|
||||
/* Because we now store all our XLines in sorted order using (i->duration + i->set_time) as a key, this
|
||||
* means that to expire the XLines we just need to do a while, picking off the top few until there are
|
||||
|
Loading…
x
Reference in New Issue
Block a user