1
0
mirror of https://github.com/anope/anope.git synced 2026-07-07 21:43:13 +02:00

Added Anope::CurTime to keep us from calling time() everywhere

This commit is contained in:
Adam
2010-09-10 20:31:31 -04:00
parent 9eb7562bee
commit f00e76d30a
64 changed files with 224 additions and 240 deletions
+1 -1
View File
@@ -48,7 +48,7 @@ class CommandBSAct : public Command
message.erase(i, 1);
ircdproto->SendAction(ci->bi, ci->name, "%s", message.c_str());
ci->bi->lastmsg = time(NULL);
ci->bi->lastmsg = Anope::CurTime;
// XXX Need to be able to find if someone is overriding this.
Log(LOG_COMMAND, u, this, ci) << message;
+1 -1
View File
@@ -54,7 +54,7 @@ class CommandBSSay : public Command
}
ircdproto->SendPrivmsg(ci->bi, ci->name, "%s", text.c_str());
ci->bi->lastmsg = time(NULL);
ci->bi->lastmsg = Anope::CurTime;
// XXX need a way to find if someone is overriding this
Log(LOG_COMMAND, u, this, ci) << text;
+1 -1
View File
@@ -36,7 +36,7 @@ class CommandCSTopic : public Command
{
ci->last_topic = topic;
ci->last_topic_setter = u->nick;
ci->last_topic_time = time(NULL);
ci->last_topic_time = Anope::CurTime;
c->topic = topic;
c->topic_setter = u->nick;
+1 -1
View File
@@ -520,7 +520,7 @@ class DBPlain : public Module
if (!IsFile(DatabaseFile))
return;
time_t now = time(NULL);
time_t now = Anope::CurTime;
tm *tm = localtime(&now);
if (tm->tm_mday != LastDay)
+1 -1
View File
@@ -72,7 +72,7 @@ class CommandHSSet : public Command
return MOD_CONT;
}
tmp_time = time(NULL);
tmp_time = Anope::CurTime;
if ((na = findnick(nick)))
{
+1 -1
View File
@@ -84,7 +84,7 @@ class CommandHSSetAll : public Command
return MOD_CONT;
}
tmp_time = time(NULL);
tmp_time = Anope::CurTime;
Log(LOG_ADMIN, u, this) << "to set the vhost for all nicks in group " << na->nc->display << " to " << (!vIdent.empty() ? vIdent + "@" : "") << hostmask;
+4 -4
View File
@@ -57,8 +57,8 @@ class CommandNSGroup : public Command
na = findnick(u->nick);
if (!(target = findnick(nick)))
notice_lang(Config->s_NickServ, u, NICK_X_NOT_REGISTERED, nick.c_str());
else if (time(NULL) < u->lastnickreg + Config->NSRegDelay)
notice_lang(Config->s_NickServ, u, NICK_GROUP_PLEASE_WAIT, (Config->NSRegDelay + u->lastnickreg) - time(NULL));
else if (Anope::CurTime < u->lastnickreg + Config->NSRegDelay)
notice_lang(Config->s_NickServ, u, NICK_GROUP_PLEASE_WAIT, (Config->NSRegDelay + u->lastnickreg) - Anope::CurTime);
else if (u->Account() && u->Account()->HasFlag(NI_SUSPENDED))
{
//Alog() << Config->s_NickServ << ": " << u->GetMask() << " tried to use GROUP from SUSPENDED nick " << target->nick;
@@ -113,7 +113,7 @@ class CommandNSGroup : public Command
Anope::string last_usermask = u->GetIdent() + "@" + u->GetDisplayedHost();
na->last_usermask = last_usermask;
na->last_realname = u->realname;
na->time_registered = na->last_seen = time(NULL);
na->time_registered = na->last_seen = Anope::CurTime;
u->Login(na->nc);
FOREACH_MOD(I_OnNickGroup, OnNickGroup(u, target));
@@ -122,7 +122,7 @@ class CommandNSGroup : public Command
Log(LOG_COMMAND, u, this) << "makes " << u->nick << " join group of " << target->nick << " (" << target->nc->display << ") (email: " << (!target->nc->email.empty() ? target->nc->email : "none") << ")";
notice_lang(Config->s_NickServ, u, NICK_GROUP_JOINED, target->nick.c_str());
u->lastnickreg = time(NULL);
u->lastnickreg = Anope::CurTime;
check_memos(u);
}
+1 -1
View File
@@ -63,7 +63,7 @@ class CommandNSIdentify : public Command
Log(LOG_COMMAND, "nickserv/identify") << "to log out of account " << u->Account()->display;
na->last_realname = u->realname;
na->last_seen = time(NULL);
na->last_seen = Anope::CurTime;
u->Login(na->nc);
ircdproto->SendAccountLogin(u, u->Account());
+8 -8
View File
@@ -50,7 +50,7 @@ class CommandNSConfirm : public Command
na->nc->AddAccess(create_mask(u));
}
na->time_registered = na->last_seen = time(NULL);
na->time_registered = na->last_seen = Anope::CurTime;
na->nc->language = Config->NSDefLanguage;
if (!nr->email.empty())
na->nc->email = nr->email;
@@ -71,7 +71,7 @@ class CommandNSConfirm : public Command
if (enc_decrypt(na->nc->pass, tmp_pass) == 1)
notice_lang(Config->s_NickServ, u, NICK_PASSWORD_IS, tmp_pass.c_str());
u->lastnickreg = time(NULL);
u->lastnickreg = Anope::CurTime;
}
else
{
@@ -201,7 +201,7 @@ class CommandNSRegister : public CommandNSConfirm
return MOD_CONT;
}
if (!is_oper(u) && Config->NickRegDelay && time(NULL) - u->my_signon < Config->NickRegDelay)
if (!is_oper(u) && Config->NickRegDelay && Anope::CurTime - u->my_signon < Config->NickRegDelay)
{
notice_lang(Config->s_NickServ, u, NICK_REG_DELAY, Config->NickRegDelay);
return MOD_CONT;
@@ -244,8 +244,8 @@ class CommandNSRegister : public CommandNSConfirm
if (Config->NSForceEmail && email.empty())
this->OnSyntaxError(u, "");
else if (time(NULL) < u->lastnickreg + Config->NSRegDelay)
notice_lang(Config->s_NickServ, u, NICK_REG_PLEASE_WAIT, (u->lastnickreg + Config->NSRegDelay) - time(NULL));
else if (Anope::CurTime < u->lastnickreg + Config->NSRegDelay)
notice_lang(Config->s_NickServ, u, NICK_REG_PLEASE_WAIT, (u->lastnickreg + Config->NSRegDelay) - Anope::CurTime);
else if ((na = findnick(u->nick)))
{
/* i.e. there's already such a nick regged */
@@ -273,7 +273,7 @@ class CommandNSRegister : public CommandNSConfirm
enc_encrypt(pass, nr->password);
if (!email.empty())
nr->email = email;
nr->requested = time(NULL);
nr->requested = Anope::CurTime;
FOREACH_MOD(I_OnMakeNickRequest, OnMakeNickRequest(nr));
if (Config->NSEmailReg)
{
@@ -335,14 +335,14 @@ class CommandNSResend : public Command
{
if ((nr = findrequestnick(u->nick)))
{
if (time(NULL) < nr->lastmail + Config->NSResendDelay)
if (Anope::CurTime < nr->lastmail + Config->NSResendDelay)
{
notice_lang(Config->s_NickServ, u, MAIL_LATER);
return MOD_CONT;
}
if (!SendRegmail(u, nr))
{
nr->lastmail = time(NULL);
nr->lastmail = Anope::CurTime;
notice_lang(Config->s_NickServ, u, NICK_REG_RESENT, nr->email.c_str());
Log(LOG_COMMAND, u, this) << "resend registration verification code for " << nr->nick;
}
+3 -3
View File
@@ -90,7 +90,7 @@ class NSResetPass : public Module
Anope::string c;
if (na && na->nc->GetExtRegular("ns_resetpass_code", c) && na->nc->GetExtRegular("ns_resetpass_time", t))
{
if (t < time(NULL) - 3600)
if (t < Anope::CurTime - 3600)
{
na->nc->Shrink("ns_resetpass_code");
na->nc->Shrink("ns_resetpass_time");
@@ -106,7 +106,7 @@ class NSResetPass : public Module
u->UpdateHost();
na->last_realname = u->realname;
na->last_seen = time(NULL);
na->last_seen = Anope::CurTime;
u->Login(na->nc);
ircdproto->SendAccountLogin(u, u->Account());
ircdproto->SetAutoIdentificationToken(u);
@@ -162,7 +162,7 @@ static bool SendResetEmail(User *u, NickAlias *na)
na->nc->Shrink("ns_resetpass_time");
na->nc->Extend("ns_resetpass_code", new ExtensibleItemRegular<Anope::string>(passcode));
na->nc->Extend("ns_resetpass_time", new ExtensibleItemRegular<time_t>(time(NULL)));
na->nc->Extend("ns_resetpass_time", new ExtensibleItemRegular<time_t>(Anope::CurTime));
return Mail(u, na->nc, Config->s_NickServ, subject, message);
}
+1 -1
View File
@@ -31,7 +31,7 @@ class CommandNSUpdate : public Command
check_memos(u);
na->last_realname = u->realname;
na->last_seen = time(NULL);
na->last_seen = Anope::CurTime;
if (ircd->vhost)
do_on_id(u);
notice_lang(Config->s_NickServ, u, NICK_UPDATE_SUCCESS, Config->s_NickServ.c_str());
+2 -2
View File
@@ -155,7 +155,7 @@ class CommandOSAKill : public Command
return MOD_CONT;
}
else if (expires > 0)
expires += time(NULL);
expires += Anope::CurTime;
if (params.size() <= last_param)
{
@@ -183,7 +183,7 @@ class CommandOSAKill : public Command
buf = "does not expire";
else
{
int wall_expiry = expires - time(NULL);
time_t wall_expiry = expires - Anope::CurTime;
Anope::string s;
if (wall_expiry >= 86400)
+1 -1
View File
@@ -44,7 +44,7 @@ class CommandOSChanKill : public Command
return MOD_CONT;
}
else if (expires > 0)
expires += time(NULL);
expires += Anope::CurTime;
if (params.size() <= last_param)
{
+2 -2
View File
@@ -158,7 +158,7 @@ class OSDefcon : public Module
if (CheckDefCon(DEFCON_AKILL_NEW_CLIENTS))
{
Log(OperServ, "operserv/defcon") << "DEFCON: adding akill for *@" << u->host;
XLine *x = SGLine->Add(NULL, NULL, "*@" + u->host, time(NULL) + Config->DefConAKILL, !Config->DefConAkillReason.empty() ? Config->DefConAkillReason : "DEFCON AKILL");
XLine *x = SGLine->Add(NULL, NULL, "*@" + u->host, Anope::CurTime + Config->DefConAKILL, !Config->DefConAkillReason.empty() ? Config->DefConAkillReason : "DEFCON AKILL");
if (x)
x->By = Config->s_OperServ;
}
@@ -289,7 +289,7 @@ class OSDefcon : public Module
++session->hits;
if (Config->MaxSessionKill && session->hits >= Config->MaxSessionKill)
{
SGLine->Add(NULL, NULL, "*@" + u->host, time(NULL) + Config->SessionAutoKillExpiry, "Session limit exceeded");
SGLine->Add(NULL, NULL, "*@" + u->host, Anope::CurTime + Config->SessionAutoKillExpiry, "Session limit exceeded");
ircdproto->SendGlobops(OperServ, "Added a temporary AKILL for \2*@%s\2 due to excessive connections", u->host.c_str());
}
}
+1 -3
View File
@@ -164,11 +164,9 @@ class OSIgnore : public Module
void OnDatabaseWrite(void (*Write)(const Anope::string &))
{
time_t now = time(NULL);
for (std::list<IgnoreData *>::iterator ign = ignore.begin(), ign_end = ignore.end(); ign != ign_end; )
{
if ((*ign)->time && (*ign)->time <= now)
if ((*ign)->time && (*ign)->time <= Anope::CurTime)
{
Log(LOG_DEBUG) << "[os_ignore] Expiring ignore entry " << (*ign)->mask;
delete *ign;
+1 -1
View File
@@ -142,7 +142,7 @@ static int add_newsitem(User *u, const Anope::string &text, NewsType type)
news->type = type;
news->num = num + 1;
news->Text = text;
news->time = time(NULL);
news->time = Anope::CurTime;
news->who = u->nick;
News.push_back(news);
+2 -2
View File
@@ -114,7 +114,7 @@ class ExceptionViewCallback : public ExceptionListCallback
char timebuf[32];
struct tm tm;
time_t t = time(NULL);
time_t t = Anope::CurTime;
tm = *localtime(exceptions[index]->time ? &exceptions[index]->time : &t);
strftime_lang(timebuf, sizeof(timebuf), u, STRFTIME_SHORT_DATE_FORMAT, &tm);
@@ -249,7 +249,7 @@ class CommandOSException : public Command
return MOD_CONT;
}
else if (expires > 0)
expires += time(NULL);
expires += Anope::CurTime;
int limit = !limitstr.empty() && limitstr.is_number_only() ? convertTo<int>(limitstr) : -1;
+2 -2
View File
@@ -153,7 +153,7 @@ class CommandOSSNLine : public Command
return MOD_CONT;
}
else if (expires > 0)
expires += time(NULL);
expires += Anope::CurTime;
if (param.empty())
{
@@ -200,7 +200,7 @@ class CommandOSSNLine : public Command
buf = "does not expire";
else
{
int wall_expiry = expires - time(NULL);
time_t wall_expiry = expires - Anope::CurTime;
Anope::string s;
if (wall_expiry >= 86400)
+2 -2
View File
@@ -152,7 +152,7 @@ class CommandOSSQLine : public Command
return MOD_CONT;
}
else if (expires > 0)
expires += time(NULL);
expires += Anope::CurTime;
if (params.size() <= last_param)
{
@@ -180,7 +180,7 @@ class CommandOSSQLine : public Command
buf = "does not expire";
else
{
int wall_expiry = expires - time(NULL);
time_t wall_expiry = expires - Anope::CurTime;
Anope::string s;
if (wall_expiry >= 86400)
+1 -1
View File
@@ -130,7 +130,7 @@ class CommandOSStats : public Command
CommandReturn DoStatsUptime(User *u)
{
char timebuf[64];
time_t uptime = time(NULL) - start_time;
time_t uptime = Anope::CurTime - start_time;
int days = uptime / 86400, hours = (uptime / 3600) % 24, mins = (uptime / 60) % 60, secs = uptime % 60;
notice_lang(Config->s_OperServ, u, OPER_STATS_CURRENT_USERS, usercnt, opcnt);
struct tm *tm = localtime(&maxusertime);
+1 -1
View File
@@ -59,7 +59,7 @@ class CommandOSSVSNick : public Command
{
notice_lang(Config->s_OperServ, u, OPER_SVSNICK_NEWNICK, nick.c_str(), newnick.c_str());
ircdproto->SendGlobops(OperServ, "%s used SVSNICK to change %s to %s", u->nick.c_str(), nick.c_str(), newnick.c_str());
ircdproto->SendForceNickChange(u2, newnick, time(NULL));
ircdproto->SendForceNickChange(u2, newnick, Anope::CurTime);
}
return MOD_CONT;
}
+2 -2
View File
@@ -152,7 +152,7 @@ class CommandOSSZLine : public Command
return MOD_CONT;
}
else if (expires > 0)
expires += time(NULL);
expires += Anope::CurTime;
if (params.size() <= last_param)
{
@@ -180,7 +180,7 @@ class CommandOSSZLine : public Command
buf = "does not expire";
else
{
int wall_expiry = expires - time(NULL);
time_t wall_expiry = expires - Anope::CurTime;
Anope::string s;
if (wall_expiry >= 86400)
+1 -1
View File
@@ -85,7 +85,7 @@ class CommandCSAppendTopic : public Command
ci->last_topic = topic;
ci->last_topic_setter = u->nick;
ci->last_topic_time = time(NULL);
ci->last_topic_time = Anope::CurTime;
c->topic = topic;
c->topic_setter = u->nick;
+17 -19
View File
@@ -338,13 +338,11 @@ class DBMySQL : public Module
}
else
{
time_t now = time(NULL);
if (now - Config->UpdateTimeout > lastwarn)
if (Anope::CurTime - Config->UpdateTimeout > lastwarn)
{
ircdproto->SendGlobops(OperServ, "Unable to locate SQL reference, is m_mysql loaded? Going to readonly...");
readonly = this->ro = true;
this->lastwarn = now;
this->lastwarn = Anope::CurTime;
}
}
}
@@ -478,8 +476,8 @@ class DBMySQL : public Module
na->last_quit = r.Get(i, "last_quit");
na->last_realname = r.Get(i, "last_realname");
na->last_usermask = r.Get(i, "last_usermask");
na->time_registered = r.Get(i, "time_registered").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "time_registered")) : time(NULL);
na->last_seen = r.Get(i, "last_seen").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "last_seen")) : time(NULL);
na->time_registered = r.Get(i, "time_registered").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "time_registered")) : Anope::CurTime;
na->last_seen = r.Get(i, "last_seen").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "last_seen")) : Anope::CurTime;
spacesepstream sep(r.Get(i, "flags"));
Anope::string buf;
@@ -518,7 +516,7 @@ class DBMySQL : public Module
if (!bi)
bi = new BotInfo(r.Get(i, "nick"), r.Get(i, "user"), r.Get(i, "host"));
bi->realname = r.Get(i, "rname");
bi->created = r.Get(i, "created").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "creeated")) : time(NULL);
bi->created = r.Get(i, "created").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "creeated")) : Anope::CurTime;
spacesepstream sep(r.Get(i, "flags"));
Anope::string buf;
@@ -569,11 +567,11 @@ class DBMySQL : public Module
if (!r.Get(i, "successor").empty())
ci->successor = findcore(r.Get(i, "successor"));
ci->desc = r.Get(i, "descr");
ci->time_registered = r.Get(i, "time_registered").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "time_registered")) : time(NULL);
ci->last_used = r.Get(i, "last_used").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "last_used")) : time(NULL);
ci->time_registered = r.Get(i, "time_registered").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "time_registered")) : Anope::CurTime;
ci->last_used = r.Get(i, "last_used").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "last_used")) : Anope::CurTime;
ci->last_topic = r.Get(i, "last_topic");
ci->last_topic_setter = r.Get(i, "last_topic_setter");
ci->last_topic_time = r.Get(i, "last_topic_time").is_number_only() ? convertTo<int>(r.Get(i, "last_topic_time")) : time(NULL);
ci->last_topic_time = r.Get(i, "last_topic_time").is_number_only() ? convertTo<int>(r.Get(i, "last_topic_time")) : Anope::CurTime;
ci->forbidby = r.Get(i, "forbidby");
ci->forbidreason = r.Get(i, "forbidreason");
ci->bantype = r.Get(i, "bantype").is_number_only() ? convertTo<int>(r.Get(i, "bantype")) : 2;
@@ -706,7 +704,7 @@ class DBMySQL : public Module
continue;
}
ci->AddAccess(nc, atoi(r.Get(i, "level").c_str()), r.Get(i, "creator"), (r.Get(i, "last_seen").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "last_seen")) : time(NULL)));
ci->AddAccess(nc, atoi(r.Get(i, "level").c_str()), r.Get(i, "creator"), (r.Get(i, "last_seen").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "last_seen")) : Anope::CurTime));
}
r = SQL->RunQuery("SELECT * FROM `anope_cs_akick`");
@@ -777,7 +775,7 @@ class DBMySQL : public Module
nr->password = r.Get(i, "passcode");
nr->password = r.Get(i, "password");
nr->email = r.Get(i, "email");
nr->requested = r.Get(i, "requested").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "requested")) : time(NULL);
nr->requested = r.Get(i, "requested").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "requested")) : Anope::CurTime;
}
r = SQL->RunQuery("SELECT * FROM `anope_ms_info`");
@@ -812,7 +810,7 @@ class DBMySQL : public Module
}
else
m->number = 1;
m->time = r.Get(i, "time").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "time")) : time(NULL);
m->time = r.Get(i, "time").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "time")) : Anope::CurTime;
m->text = r.Get(i, "text");
if (!r.Get(i, "flags").empty())
@@ -843,8 +841,8 @@ class DBMySQL : public Module
Anope::string host = r.Get(i, "host");
Anope::string by = r.Get(i, "by");
Anope::string reason = r.Get(i, "reason");
time_t seton = r.Get(i, "seton").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "seton")) : time(NULL);
time_t expires = r.Get(i, "expires").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "expires")) : time(NULL);
time_t seton = r.Get(i, "seton").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "seton")) : Anope::CurTime;
time_t expires = r.Get(i, "expires").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "expires")) : Anope::CurTime;
XLine *x = SGLine->Add(NULL, NULL, user + "@" + host, expires, reason);
if (x)
@@ -861,8 +859,8 @@ class DBMySQL : public Module
Anope::string mask = r.Get(i, "mask");
Anope::string by = r.Get(i, "xby");
Anope::string reason = r.Get(i, "reason");
time_t seton = r.Get(i, "seton").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "seton")) : time(NULL);
time_t expires = r.Get(i, "expires").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "expires")) : time(NULL);
time_t seton = r.Get(i, "seton").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "seton")) : Anope::CurTime;
time_t expires = r.Get(i, "expires").is_pos_number_only() ? convertTo<time_t>(r.Get(i, "expires")) : Anope::CurTime;
XLine *x = NULL;
if (SNLine && r.Get(i, "type").equals_cs("SNLINE"))
@@ -1145,7 +1143,7 @@ class DBMySQL : public Module
void OnAccessAdd(ChannelInfo *ci, User *u, NickAlias *na, int level)
{
this->RunQuery("INSERT DELAYED INTO `anope_cs_access` (level, display, channel, last_seen, creator) VALUES (" + stringify(level) + ", '" + this->Escape(na->nc->display) + "', '" + this->Escape(ci->name) + "', " + stringify(time(NULL)) + ", '" + this->Escape(u->nick) + "')");
this->RunQuery("INSERT DELAYED INTO `anope_cs_access` (level, display, channel, last_seen, creator) VALUES (" + stringify(level) + ", '" + this->Escape(na->nc->display) + "', '" + this->Escape(ci->name) + "', " + stringify(Anope::CurTime) + ", '" + this->Escape(u->nick) + "')");
}
void OnAccessDel(ChannelInfo *ci, User *u, NickCore *nc)
@@ -1155,7 +1153,7 @@ class DBMySQL : public Module
void OnAccessChange(ChannelInfo *ci, User *u, NickAlias *na, int level)
{
this->RunQuery("INSERT DELAYED INTO `anope_cs_access` (level, display, channel, last_seen, creator) VALUES (" + stringify(level) + ", '" + this->Escape(na->nc->display) + "', '" + this->Escape(ci->name) + "', " + stringify(time(NULL)) + ", '" + this->Escape(u->nick) + "') ON DUPLICATE KEY UPDATE level=VALUES(level), display=VALUES(display), channel=VALUES(channel), last_seen=VALUES(last_seen), creator=VALUES(creator)");
this->RunQuery("INSERT DELAYED INTO `anope_cs_access` (level, display, channel, last_seen, creator) VALUES (" + stringify(level) + ", '" + this->Escape(na->nc->display) + "', '" + this->Escape(ci->name) + "', " + stringify(Anope::CurTime) + ", '" + this->Escape(u->nick) + "') ON DUPLICATE KEY UPDATE level=VALUES(level), display=VALUES(display), channel=VALUES(channel), last_seen=VALUES(last_seen), creator=VALUES(creator)");
}
void OnAccessClear(ChannelInfo *ci, User *u)
+3 -4
View File
@@ -84,7 +84,6 @@ class CommandHSRequest : public Command
Anope::string rawhostmask = params[0];
Anope::string hostmask;
NickAlias *na;
time_t now = time(NULL);
Anope::string vIdent = myStrGetToken(rawhostmask, '@', 0); /* Get the first substring, @ as delimiter */
if (!vIdent.empty())
@@ -129,13 +128,13 @@ class CommandHSRequest : public Command
if ((na = findnick(nick)))
{
if ((HSRequestMemoOper || HSRequestMemoSetters) && Config->MSSendDelay > 0 && u && u->lastmemosend + Config->MSSendDelay > now)
if ((HSRequestMemoOper || HSRequestMemoSetters) && Config->MSSendDelay > 0 && u && u->lastmemosend + Config->MSSendDelay > Anope::CurTime)
{
me->NoticeLang(Config->s_HostServ, u, LNG_REQUEST_WAIT, Config->MSSendDelay);
u->lastmemosend = now;
u->lastmemosend = Anope::CurTime;
return MOD_CONT;
}
my_add_host_request(nick, vIdent, hostmask, u->nick, now);
my_add_host_request(nick, vIdent, hostmask, u->nick, Anope::CurTime);
me->NoticeLang(Config->s_HostServ, u, LNG_REQUESTED);
req_send_memos(u, vIdent, hostmask);
+1 -1
View File
@@ -32,7 +32,7 @@ class DNSBLResolver : public DNSRequest
reason = reason.replace_all_ci("%i", user->ip.addr());
reason = reason.replace_all_ci("%h", user->host);
XLine *x = SGLine->Add(NULL, NULL, Anope::string("*@") + user->host, time(NULL) + this->blacklist.bantime, reason);
XLine *x = SGLine->Add(NULL, NULL, Anope::string("*@") + user->host, Anope::CurTime + this->blacklist.bantime, reason);
if (x)
{
static Command command_akill("AKILL", 0);
+4 -4
View File
@@ -64,7 +64,7 @@ void bahamut_cmd_burst()
*/
void bahamut_cmd_svinfo()
{
send_cmd("", "SVINFO 3 1 0 :%ld", static_cast<long>(time(NULL)));
send_cmd("", "SVINFO 3 1 0 :%ld", static_cast<long>(Anope::CurTime));
}
/* PASS */
@@ -152,7 +152,7 @@ class BahamutIRCdProto : public IRCDProto
/* this will likely fail so its only here for legacy */
send_cmd("", "SZLINE %s :%s", x->Mask.c_str(), x->Reason.c_str());
/* this is how we are supposed to deal with it */
send_cmd("", "AKILL %s * %d %s %ld :%s", x->Mask.c_str(), 172800, x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str());
send_cmd("", "AKILL %s * %d %s %ld :%s", x->Mask.c_str(), 172800, x->By.c_str(), static_cast<long>(Anope::CurTime), x->Reason.c_str());
}
/* SVSNOOP */
@@ -207,10 +207,10 @@ class BahamutIRCdProto : public IRCDProto
void SendAkill(const XLine *x)
{
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->Expires - time(NULL);
time_t timeleft = x->Expires - Anope::CurTime;
if (timeleft > 172800)
timeleft = 172800;
send_cmd("", "AKILL %s %s %d %s %ld :%s", x->GetHost().c_str(), x->GetUser().c_str(), static_cast<int>(timeleft), x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str());
send_cmd("", "AKILL %s %s %d %s %ld :%s", x->GetHost().c_str(), x->GetUser().c_str(), static_cast<int>(timeleft), x->By.c_str(), static_cast<long>(Anope::CurTime), x->Reason.c_str());
}
/*
+8 -9
View File
@@ -73,7 +73,7 @@ void inspircd_cmd_chghost(const Anope::string &nick, const Anope::string &vhost)
int anope_event_idle(const Anope::string &source, int ac, const char **av)
{
if (ac == 1)
send_cmd(av[0], "IDLE %s %ld 0", source.c_str(), static_cast<long>(time(NULL)));
send_cmd(av[0], "IDLE %s %ld 0", source.c_str(), static_cast<long>(Anope::CurTime));
return MOD_CONT;
}
@@ -111,10 +111,10 @@ class InspIRCdProto : public IRCDProto
void SendAkill(const XLine *x)
{
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->Expires - time(NULL);
time_t timeleft = x->Expires - Anope::CurTime;
if (timeleft > 172800)
timeleft = 172800;
send_cmd(Config->ServerName, "ADDLINE G %s %s %ld %ld :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), static_cast<long>(timeleft), x->Reason.c_str());
send_cmd(Config->ServerName, "ADDLINE G %s %s %ld %ld :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime), static_cast<long>(timeleft), x->Reason.c_str());
}
void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf)
@@ -201,7 +201,7 @@ class InspIRCdProto : public IRCDProto
/* SQLINE */
void SendSQLine(const XLine *x)
{
send_cmd(Config->ServerName, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config->s_OperServ.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str());
send_cmd(Config->ServerName, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config->s_OperServ.c_str(), static_cast<long>(Anope::CurTime), x->Reason.c_str());
}
/* SQUIT */
@@ -264,7 +264,7 @@ class InspIRCdProto : public IRCDProto
/* SZLINE */
void SendSZLine(const XLine *x)
{
send_cmd(Config->ServerName, "ADDLINE Z %s %s %ld 0 :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str());
send_cmd(Config->ServerName, "ADDLINE Z %s %s %ld 0 :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime), x->Reason.c_str());
}
void SendSVSJoin(const Anope::string &source, const Anope::string &nick, const Anope::string &chan, const Anope::string &)
@@ -279,7 +279,7 @@ class InspIRCdProto : public IRCDProto
void SendBOB()
{
send_cmd("", "BURST %ld", time(NULL));
send_cmd("", "BURST %ld", Anope::CurTime);
}
void SendEOB()
@@ -516,7 +516,6 @@ int anope_event_away(const Anope::string &source, int ac, const char **av)
int anope_event_topic(const Anope::string &source, int ac, const char **av)
{
Channel *c = findchan(av[0]);
time_t topic_time = time(NULL);
if (!c)
{
@@ -524,7 +523,7 @@ int anope_event_topic(const Anope::string &source, int ac, const char **av)
return MOD_CONT;
}
if (check_topiclock(c, topic_time))
if (check_topiclock(c, Anope::CurTime))
return MOD_CONT;
c->topic.clear();
@@ -532,7 +531,7 @@ int anope_event_topic(const Anope::string &source, int ac, const char **av)
c->topic = av[1];
c->topic_setter = source;
c->topic_time = topic_time;
c->topic_time = Anope::CurTime;
record_topic(av[0]);
+9 -10
View File
@@ -76,7 +76,7 @@ int anope_event_idle(const Anope::string &source, int ac, const char **av)
{
BotInfo *bi = findbot(av[0]);
send_cmd(bi ? bi->GetUID() : av[0], "IDLE %s %ld %ld", source.c_str(), static_cast<long>(start_time), bi ? (static_cast<long>(time(NULL) - bi->lastmsg)) : 0);
send_cmd(bi ? bi->GetUID() : av[0], "IDLE %s %ld %ld", source.c_str(), static_cast<long>(start_time), bi ? (static_cast<long>(Anope::CurTime - bi->lastmsg)) : 0);
return MOD_CONT;
}
@@ -114,10 +114,10 @@ class InspIRCdProto : public IRCDProto
void SendAkill(const XLine *x)
{
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->Expires - time(NULL);
time_t timeleft = x->Expires - Anope::CurTime;
if (timeleft > 172800 || !x->Expires)
timeleft = 172800;
send_cmd(OperServ->GetUID(), "ADDLINE G %s@%s %s %ld %ld :%s", x->GetUser().c_str(), x->GetHost().c_str(), x->By.c_str(), static_cast<long>(time(NULL)), static_cast<long>(timeleft), x->Reason.c_str());
send_cmd(OperServ->GetUID(), "ADDLINE G %s@%s %s %ld %ld :%s", x->GetUser().c_str(), x->GetHost().c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime), static_cast<long>(timeleft), x->Reason.c_str());
}
void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf)
@@ -191,7 +191,7 @@ class InspIRCdProto : public IRCDProto
/* SQLINE */
void SendSQLine(const XLine *x)
{
send_cmd(TS6SID, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config->s_OperServ.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str());
send_cmd(TS6SID, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config->s_OperServ.c_str(), static_cast<long>(Anope::CurTime), x->Reason.c_str());
}
/* SQUIT */
@@ -248,7 +248,7 @@ class InspIRCdProto : public IRCDProto
/* SZLINE */
void SendSZLine(const XLine *x)
{
send_cmd(TS6SID, "ADDLINE Z %s %s %ld 0 :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str());
send_cmd(TS6SID, "ADDLINE Z %s %s %ld 0 :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime), x->Reason.c_str());
}
void SendSVSJoin(const Anope::string &source, const Anope::string &nick, const Anope::string &chan, const Anope::string &)
@@ -274,7 +274,7 @@ class InspIRCdProto : public IRCDProto
void SendBOB()
{
send_cmd(TS6SID, "BURST %ld", time(NULL));
send_cmd(TS6SID, "BURST %ld", Anope::CurTime);
}
void SendEOB()
@@ -539,7 +539,7 @@ int anope_event_time(const Anope::string &source, int ac, const char **av)
if (ac !=2)
return MOD_CONT;
send_cmd(TS6SID, "TIME %s %s %ld", source.c_str(), av[1], static_cast<long>(time(NULL)));
send_cmd(TS6SID, "TIME %s %s %ld", source.c_str(), av[1], static_cast<long>(Anope::CurTime));
/* We handled it, don't pass it on to the core..
* The core doesn't understand our syntax anyways.. ~ Viper */
@@ -562,7 +562,6 @@ int anope_event_away(const Anope::string &source, int ac, const char **av)
int anope_event_topic(const Anope::string &source, int ac, const char **av)
{
Channel *c = findchan(av[0]);
time_t topic_time = time(NULL);
User *u = finduser(source);
if (!c)
@@ -571,7 +570,7 @@ int anope_event_topic(const Anope::string &source, int ac, const char **av)
return MOD_CONT;
}
if (check_topiclock(c, topic_time))
if (check_topiclock(c, Anope::CurTime))
return MOD_CONT;
c->topic.clear();
@@ -579,7 +578,7 @@ int anope_event_topic(const Anope::string &source, int ac, const char **av)
c->topic = av[1];
c->topic_setter = u ? u->nick : source;
c->topic_time = topic_time;
c->topic_time = Anope::CurTime;
record_topic(av[0]);
+9 -10
View File
@@ -74,7 +74,7 @@ int anope_event_idle(const Anope::string &source, int ac, const char **av)
{
BotInfo *bi = findbot(av[0]);
send_cmd(bi ? bi->GetUID() : av[0], "IDLE %s %ld %ld", source.c_str(), static_cast<long>(start_time), bi ? (static_cast<long>(time(NULL) - bi->lastmsg)) : 0);
send_cmd(bi ? bi->GetUID() : av[0], "IDLE %s %ld %ld", source.c_str(), static_cast<long>(start_time), bi ? (static_cast<long>(Anope::CurTime - bi->lastmsg)) : 0);
return MOD_CONT;
}
@@ -112,10 +112,10 @@ class InspIRCdProto : public IRCDProto
void SendAkill(const XLine *x)
{
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->Expires - time(NULL);
time_t timeleft = x->Expires - Anope::CurTime;
if (timeleft > 172800 || !x->Expires)
timeleft = 172800;
send_cmd(OperServ->GetUID(), "ADDLINE G %s@%s %s %ld %ld :%s", x->GetUser().c_str(), x->GetHost().c_str(), x->By.c_str(), static_cast<long>(time(NULL)), static_cast<long>(timeleft), x->Reason.c_str());
send_cmd(OperServ->GetUID(), "ADDLINE G %s@%s %s %ld %ld :%s", x->GetUser().c_str(), x->GetHost().c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime), static_cast<long>(timeleft), x->Reason.c_str());
}
void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf)
@@ -189,7 +189,7 @@ class InspIRCdProto : public IRCDProto
/* SQLINE */
void SendSQLine(const XLine *x)
{
send_cmd(TS6SID, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config->s_OperServ.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str());
send_cmd(TS6SID, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config->s_OperServ.c_str(), static_cast<long>(Anope::CurTime), x->Reason.c_str());
}
/* SQUIT */
@@ -249,7 +249,7 @@ class InspIRCdProto : public IRCDProto
/* SZLINE */
void SendSZLine(const XLine *x)
{
send_cmd(TS6SID, "ADDLINE Z %s %s %ld 0 :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL)), x->Reason.c_str());
send_cmd(TS6SID, "ADDLINE Z %s %s %ld 0 :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime), x->Reason.c_str());
}
void SendSVSJoin(const Anope::string &source, const Anope::string &nick, const Anope::string &chan, const Anope::string &)
@@ -275,7 +275,7 @@ class InspIRCdProto : public IRCDProto
void SendBOB()
{
send_cmd(TS6SID, "BURST %ld", time(NULL));
send_cmd(TS6SID, "BURST %ld", Anope::CurTime);
}
void SendEOB()
@@ -537,7 +537,7 @@ int anope_event_time(const Anope::string &source, int ac, const char **av)
if (ac !=2)
return MOD_CONT;
send_cmd(TS6SID, "TIME %s %s %ld", source.c_str(), av[1], static_cast<long>(time(NULL)));
send_cmd(TS6SID, "TIME %s %s %ld", source.c_str(), av[1], static_cast<long>(Anope::CurTime));
/* We handled it, don't pass it on to the core..
* The core doesn't understand our syntax anyways.. ~ Viper */
@@ -560,7 +560,6 @@ int anope_event_away(const Anope::string &source, int ac, const char **av)
int anope_event_topic(const Anope::string &source, int ac, const char **av)
{
Channel *c = findchan(av[0]);
time_t topic_time = time(NULL);
User *u = finduser(source);
if (!c)
@@ -569,7 +568,7 @@ int anope_event_topic(const Anope::string &source, int ac, const char **av)
return MOD_CONT;
}
if (check_topiclock(c, topic_time))
if (check_topiclock(c, Anope::CurTime))
return MOD_CONT;
c->topic.clear();
@@ -577,7 +576,7 @@ int anope_event_topic(const Anope::string &source, int ac, const char **av)
c->topic = av[1];
c->topic_setter = u ? u->nick : source;
c->topic_time = topic_time;
c->topic_time = Anope::CurTime;
record_topic(av[0]);
+4 -5
View File
@@ -59,7 +59,7 @@ IRCDVar myIrcd[] = {
*/
void ratbox_cmd_svinfo()
{
send_cmd("", "SVINFO 6 3 0 :%ld", static_cast<long>(time(NULL)));
send_cmd("", "SVINFO 6 3 0 :%ld", static_cast<long>(Anope::CurTime));
}
void ratbox_cmd_svsinfo()
@@ -147,7 +147,7 @@ class RatboxProto : public IRCDProto
void SendAkill(const XLine *x)
{
BotInfo *bi = OperServ;
send_cmd(bi ? bi->GetUID() : Config->s_OperServ, "KLINE * %ld %s %s :%s", static_cast<long>(x->Expires - time(NULL)), x->GetUser().c_str(), x->GetHost().c_str(), x->Reason.c_str());
send_cmd(bi ? bi->GetUID() : Config->s_OperServ, "KLINE * %ld %s %s :%s", static_cast<long>(x->Expires - Anope::CurTime), x->GetUser().c_str(), x->GetHost().c_str(), x->Reason.c_str());
}
void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf)
@@ -424,7 +424,6 @@ int anope_event_topic(const Anope::string &source, int ac, const char **av)
else
{
Channel *c = findchan(av[0]);
time_t topic_time = time(NULL);
if (!c)
{
@@ -432,7 +431,7 @@ int anope_event_topic(const Anope::string &source, int ac, const char **av)
return MOD_CONT;
}
if (check_topiclock(c, topic_time))
if (check_topiclock(c, Anope::CurTime))
return MOD_CONT;
c->topic.clear();
@@ -441,7 +440,7 @@ int anope_event_topic(const Anope::string &source, int ac, const char **av)
u = finduser(source);
c->topic_setter = u ? u->nick : source;
c->topic_time = topic_time;
c->topic_time = Anope::CurTime;
record_topic(av[0]);
+6 -6
View File
@@ -51,7 +51,7 @@ IRCDVar myIrcd[] = {
void unreal_cmd_netinfo(int ac, const char **av)
{
send_cmd("", "AO %ld %ld %d %s 0 0 0 :%s", static_cast<long>(maxusercnt), static_cast<long>(time(NULL)), Anope::string(av[2]).is_number_only() ? convertTo<int>(av[2]) : 0, av[3], av[7]);
send_cmd("", "AO %ld %ld %d %s 0 0 0 :%s", static_cast<long>(maxusercnt), static_cast<long>(Anope::CurTime), Anope::string(av[2]).is_number_only() ? convertTo<int>(av[2]) : 0, av[3], av[7]);
}
/* PROTOCTL */
@@ -129,10 +129,10 @@ class UnrealIRCdProto : public IRCDProto
void SendAkill(const XLine *x)
{
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->Expires - time(NULL);
time_t timeleft = x->Expires - Anope::CurTime;
if (timeleft > 172800)
timeleft = 172800;
send_cmd("", "BD + G %s %s %s %ld %ld :%s", x->GetUser().c_str(), x->GetHost().c_str(), x->By.c_str(), static_cast<long>(time(NULL) + timeleft), static_cast<long>(x->Created), x->Reason.c_str());
send_cmd("", "BD + G %s %s %s %ld %ld :%s", x->GetUser().c_str(), x->GetHost().c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime + timeleft), static_cast<long>(x->Created), x->Reason.c_str());
}
void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf)
@@ -249,7 +249,7 @@ class UnrealIRCdProto : public IRCDProto
{
if (!oldnick || newnick.empty())
return;
send_cmd(oldnick->nick, "& %s %ld", newnick.c_str(), static_cast<long>(time(NULL)));
send_cmd(oldnick->nick, "& %s %ld", newnick.c_str(), static_cast<long>(Anope::CurTime));
}
/* Functions that use serval cmd functions */
@@ -272,7 +272,7 @@ class UnrealIRCdProto : public IRCDProto
/* SVSHOLD - set */
void SendSVSHold(const Anope::string &nick)
{
send_cmd("", "BD + Q H %s %s %ld %ld :Being held for registered user", nick.c_str(), Config->ServerName.c_str(), static_cast<long>(time(NULL) + Config->NSReleaseTimeout), static_cast<long>(time(NULL)));
send_cmd("", "BD + Q H %s %s %ld %ld :Being held for registered user", nick.c_str(), Config->ServerName.c_str(), static_cast<long>(Anope::CurTime + Config->NSReleaseTimeout), static_cast<long>(Anope::CurTime));
}
/* SVSHOLD - release */
@@ -299,7 +299,7 @@ class UnrealIRCdProto : public IRCDProto
/* SZLINE */
void SendSZLine(const XLine *x)
{
send_cmd("", "BD + Z * %s %s %ld %ld :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(time(NULL) + 172800), static_cast<long>(time(NULL)), x->Reason.c_str());
send_cmd("", "BD + Z * %s %s %ld %ld :%s", x->Mask.c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime + 172800), static_cast<long>(Anope::CurTime), x->Reason.c_str());
}
/* SGLINE */
@@ -119,6 +119,7 @@ class SocketEngineEPoll : public SocketEngineBase
void Process()
{
int total = epoll_wait(EngineHandle, events, max - 1, Config->ReadTimeout * 1000);
Anope::CurTime = time(NULL);
if (total == -1)
{
@@ -65,6 +65,7 @@ class SocketEngineSelect : public SocketEngineBase
tval.tv_usec = 0;
int sresult = select(MaxFD + 1, &rfdset, &wfdset, &efdset, &tval);
Anope::CurTime = time(NULL);
if (sresult == -1)
{