mirror of
https://github.com/anope/anope.git
synced 2026-07-05 08:53:12 +02:00
Added Anope::CurTime to keep us from calling time() everywhere
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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]);
|
||||
|
||||
|
||||
@@ -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]);
|
||||
|
||||
|
||||
@@ -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]);
|
||||
|
||||
|
||||
@@ -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]);
|
||||
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user