1
0
mirror of https://github.com/anope/anope.git synced 2026-06-30 19:26:38 +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
+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]);