Permalink
Browse files

Remove 2 day xline cap

  • Loading branch information...
Adam- committed Oct 8, 2017
1 parent 50f7429 commit 2cb0d9057bf1968d36168a76e25f4cf4d3b33fbf
@@ -72,6 +72,7 @@ class CoreExport XLine : public Serialize::Object
const Anope::string &GetReal() const;
Anope::string GetReasonWithID();
bool IsExpired();
bool HasNickOrReal() const;
bool IsRegex();
@@ -65,11 +65,11 @@ void bahamut::senders::Akill::Send(User* u, XLine* x)
}
}
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->GetExpires() - Anope::CurTime;
if (timeleft > 172800)
timeleft = 172800;
if (x->IsExpired())
return;
// Calculate the time left before this would expire
time_t timeleft = x->GetExpires() > 0 ? x->GetExpires() - Anope::CurTime : 0;
Uplink::Send("AKILL", x->GetHost(), x->GetUser(), timeleft, x->GetBy(), Anope::CurTime, x->GetReason());
}
@@ -194,10 +194,11 @@ void bahamut::senders::SQLineDel::Send(XLine* x)
void bahamut::senders::SZLine::Send(User*, XLine* x)
{
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->GetExpires() - Anope::CurTime;
if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
if (x->IsExpired())
return;
// Calculate the time left before this would expire
time_t timeleft = x->GetExpires() > 0 ? x->GetExpires() - Anope::CurTime : 0;
/* this will likely fail so its only here for legacy */
Uplink::Send("SZLINE", x->GetHost(), x->GetReason());
/* this is how we are supposed to deal with it */
@@ -62,12 +62,11 @@ void hybrid::senders::Akill::Send(User* u, XLine* x)
x->GetMask(), u->GetMask(), u->realname, old->GetMask());
}
/* Calculate the time left before this would expire, capping it at 2 days */
time_t timeleft = x->GetExpires() - Anope::CurTime;
if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
if (x->IsExpired())
return;
/* Calculate the time left before this would expire */
time_t timeleft = x->GetExpires() > 0 ? x->GetExpires() - Anope::CurTime : 0;
Uplink::Send(Config->GetClient("OperServ"), "KLINE", timeleft, x->GetUser(), x->GetHost(), x->GetReason());
}
@@ -173,12 +172,11 @@ void hybrid::senders::SQLineDel::Send(XLine* x)
void hybrid::senders::SZLine::Send(User*, XLine* x)
{
/* Calculate the time left before this would expire, capping it at 2 days */
time_t timeleft = x->GetExpires() - Anope::CurTime;
if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
if (x->IsExpired())
return;
/* Calculate the time left before this would expire */
time_t timeleft = x->GetExpires() > 0 ? x->GetExpires() - Anope::CurTime : 0;
Uplink::Send(Config->GetClient("OperServ"), "DLINE", "*", timeleft, x->GetHost(), x->GetReason());
}
@@ -39,10 +39,11 @@ static unsigned int spanningtree_proto_ver = 0;
void inspircd20::senders::Akill::Send(User* u, XLine* x)
{
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->GetExpires() - Anope::CurTime;
if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
if (x->IsExpired())
return;
// Calculate the time left before this would expire
time_t timeleft = x->GetExpires() > 0 ? x->GetExpires() - Anope::CurTime : 0;
/* InspIRCd may support regex bans, if they do we can send this and forget about it */
if (x->IsRegex() && Servers::Capab.count("RLINE"))
@@ -218,10 +219,11 @@ void inspircd20::senders::MessageServer::Send(Server* server)
void inspircd20::senders::SQLine::Send(User*, XLine* x)
{
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->GetExpires() - Anope::CurTime;
if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
if (x->IsExpired())
return;
// Calculate the time left before this would expire
time_t timeleft = x->GetExpires() > 0 ? x->GetExpires() - Anope::CurTime : 0;
proto->SendAddLine("Q", x->GetMask(), timeleft, x->GetBy(), x->GetReason());
}
@@ -247,10 +249,11 @@ void inspircd20::senders::SQuit::Send(Server *s, const Anope::string &message)
void inspircd20::senders::SZLine::Send(User*, XLine* x)
{
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->GetExpires() - Anope::CurTime;
if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
if (x->IsExpired())
return;
// Calculate the time left before this would expire
time_t timeleft = x->GetExpires() > 0 ? x->GetExpires() - Anope::CurTime : 0;
proto->SendAddLine("Z", x->GetHost(), timeleft, x->GetBy(), x->GetReason());
}
@@ -26,10 +26,11 @@
void ngircd::senders::Akill::Send(User* u, XLine* x)
{
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->GetExpires() - Anope::CurTime;
if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
if (x->IsExpired())
return;
// Calculate the time left before this would expire
time_t timeleft = x->GetExpires() > 0 ? x->GetExpires() - Anope::CurTime : 0;
Uplink::Send(Me, "GLINE", x->GetMask(), timeleft, x->GetReason() + " (" + x->GetBy() + ")");
}
@@ -46,12 +46,11 @@ void ratbox::senders::Logout::Send(User *u)
void ratbox::senders::SQLine::Send(User*, XLine* x)
{
/* Calculate the time left before this would expire, capping it at 2 days */
time_t timeleft = x->GetExpires() - Anope::CurTime;
if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
if (x->IsExpired())
return;
/* Calculate the time left before this would expire */
time_t timeleft = x->GetExpires() > 0 ? x->GetExpires() - Anope::CurTime : 0;
#warning "find introduced"
// Uplink::Send(FindIntroduced(), "ENCAP", "*", "RESV", timeleft, x->GetMask(), 0, x->GetReason());
}
@@ -73,11 +73,10 @@ void unreal::senders::Akill::Send(User* u, XLine* x)
}
}
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->GetExpires() - Anope::CurTime;
if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
Uplink::Send("TKL", "+", "G", x->GetUser(), x->GetHost(), x->GetBy(), Anope::CurTime + timeleft, x->GetCreated(), x->GetReason());
if (x->IsExpired())
return;
Uplink::Send("TKL", "+", "G", x->GetUser(), x->GetHost(), x->GetBy(), x->GetExpires(), x->GetCreated(), x->GetReason());
}
void unreal::senders::AkillDel::Send(XLine* x)
@@ -209,11 +208,10 @@ void unreal::senders::SQLineDel::Send(XLine* x)
void unreal::senders::SZLine::Send(User*, XLine* x)
{
// Calculate the time left before this would expire, capping it at 2 days
time_t timeleft = x->GetExpires() - Anope::CurTime;
if (timeleft > 172800 || !x->GetExpires())
timeleft = 172800;
Uplink::Send("TKL", "+", "Z", "*", x->GetHost(), x->GetBy(), Anope::CurTime + timeleft, x->GetCreated(), x->GetReason());
if (x->IsExpired())
return;
Uplink::Send("TKL", "+", "Z", "*", x->GetHost(), x->GetBy(), x->GetExpires(), x->GetCreated(), x->GetReason());
}
void unreal::senders::SZLineDel::Send(XLine* x)
@@ -199,6 +199,12 @@ Anope::string XLine::GetReasonWithID()
return r;
}
bool XLine::IsExpired()
{
time_t expires = GetExpires();
return expires > 0 && expires <= Anope::CurTime;
}
bool XLine::HasNickOrReal() const
{
return !this->GetNick().empty() || !this->GetReal().empty();

0 comments on commit 2cb0d90

Please sign in to comment.