summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2023-11-03 11:01:01 +0000
committerSadie Powell <sadie@witchery.services>2023-11-03 11:01:01 +0000
commit6e16e71fdaf4b725c8e4b3e89db5ed66d497a1a4 (patch)
tree3af3b4c9c5e034ad95dab5e3ee84b12b61ae75a2 /modules
parent38d5b93e4af1babc7ec23a61aea8ba91b4fa9a57 (diff)
Remove the two day X-line cap.
Diffstat (limited to 'modules')
-rw-r--r--modules/protocol/bahamut.cpp13
-rw-r--r--modules/protocol/hybrid.cpp14
-rw-r--r--modules/protocol/inspircd.cpp19
-rw-r--r--modules/protocol/ngircd.cpp6
-rw-r--r--modules/protocol/ratbox.cpp7
-rw-r--r--modules/protocol/unrealircd.cpp12
6 files changed, 22 insertions, 49 deletions
diff --git a/modules/protocol/bahamut.cpp b/modules/protocol/bahamut.cpp
index 608d3d869..091b6b999 100644
--- a/modules/protocol/bahamut.cpp
+++ b/modules/protocol/bahamut.cpp
@@ -106,10 +106,9 @@ class BahamutIRCdProto : public IRCDProto
/* SZLINE */
void SendSZLine(User *, const XLine *x) override
{
- // Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
- timeleft = 172800;
+ // Calculate the time left before this would expire
+ time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
+
/* this will likely fail so its only here for legacy */
UplinkSocket::Message() << "SZLINE " << x->GetHost() << " :" << x->GetReason();
/* this is how we are supposed to deal with it */
@@ -220,10 +219,8 @@ class BahamutIRCdProto : public IRCDProto
}
}
- // Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
- if (timeleft > 172800)
- timeleft = 172800;
+ // Calculate the time left before this would expire
+ time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
UplinkSocket::Message() << "AKILL " << x->GetHost() << " " << x->GetUser() << " " << timeleft << " " << x->by << " " << Anope::CurTime << " :" << x->GetReason();
}
diff --git a/modules/protocol/hybrid.cpp b/modules/protocol/hybrid.cpp
index c554cc19d..465f3fd25 100644
--- a/modules/protocol/hybrid.cpp
+++ b/modules/protocol/hybrid.cpp
@@ -77,11 +77,8 @@ class HybridProto : public IRCDProto
void SendSZLine(User *, const XLine *x) override
{
- /* Calculate the time left before this would expire, capping it at 2 days */
- time_t timeleft = x->expires - Anope::CurTime;
-
- if (timeleft > 172800 || !x->expires)
- timeleft = 172800;
+ /* Calculate the time left before this would expire */
+ time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
UplinkSocket::Message(Me) << "DLINE * " << timeleft << " " << x->GetHost() << " :" << x->GetReason();
}
@@ -162,11 +159,8 @@ class HybridProto : public IRCDProto
<< u->realname << " matches " << old->mask;
}
- /* Calculate the time left before this would expire, capping it at 2 days */
- time_t timeleft = x->expires - Anope::CurTime;
-
- if (timeleft > 172800 || !x->expires)
- timeleft = 172800;
+ /* Calculate the time left before this would expire */
+ time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
UplinkSocket::Message(Me) << "KLINE * " << timeleft << " " << x->GetUser() << " " << x->GetHost() << " :" << x->GetReason();
}
diff --git a/modules/protocol/inspircd.cpp b/modules/protocol/inspircd.cpp
index 8e0581b13..d3628fb8f 100644
--- a/modules/protocol/inspircd.cpp
+++ b/modules/protocol/inspircd.cpp
@@ -207,10 +207,8 @@ class InspIRCdProto : public IRCDProto
void SendAkill(User *u, XLine *x) override
{
- // Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
- timeleft = 172800;
+ // Calculate the time left before this would expire
+ time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
/* InspIRCd may support regex bans, if they do we can send this and forget about it
* Mask is expected in format: 'n!u@h\sr' and spaces as '\s'
@@ -349,10 +347,8 @@ class InspIRCdProto : public IRCDProto
void SendSQLine(User *u, const XLine *x) override
{
- // Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
- timeleft = 172800;
+ // Calculate the time left before this would expire
+ time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
if (IRCD->CanSQLineChannel && (x->mask[0] == '#'))
SendAddLine("CBAN", x->mask, timeleft, x->by, x->GetReason());
@@ -385,10 +381,9 @@ class InspIRCdProto : public IRCDProto
void SendSZLine(User *u, const XLine *x) override
{
- // Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
- timeleft = 172800;
+ // Calculate the time left before this would expire
+ time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
+
SendAddLine("Z", x->GetHost(), timeleft, x->by, x->GetReason());
}
diff --git a/modules/protocol/ngircd.cpp b/modules/protocol/ngircd.cpp
index 7b2fc908e..8a88eab61 100644
--- a/modules/protocol/ngircd.cpp
+++ b/modules/protocol/ngircd.cpp
@@ -32,10 +32,8 @@ class ngIRCdProto : public IRCDProto
void SendAkill(User *u, XLine *x) override
{
- // Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
- timeleft = 172800;
+ // Calculate the time left before this would expire
+ time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
UplinkSocket::Message(Me) << "GLINE " << x->mask << " " << timeleft << " :" << x->GetReason() << " (" << x->by << ")";
}
diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp
index 1324fa057..89a190d7e 100644
--- a/modules/protocol/ratbox.cpp
+++ b/modules/protocol/ratbox.cpp
@@ -63,11 +63,8 @@ class RatboxProto : public IRCDProto
void SendSQLine(User *, const XLine *x) override
{
- /* Calculate the time left before this would expire, capping it at 2 days */
- time_t timeleft = x->expires - Anope::CurTime;
-
- if (timeleft > 172800 || !x->expires)
- timeleft = 172800;
+ // Calculate the time left before this would expire
+ time_t timeleft = x->expires ? x->expires - Anope::CurTime : x->expires;
UplinkSocket::Message(FindIntroduced()) << "ENCAP * RESV " << timeleft << " " << x->mask << " 0 :" << x->GetReason();
}
diff --git a/modules/protocol/unrealircd.cpp b/modules/protocol/unrealircd.cpp
index ddc714841..a6b0aaef8 100644
--- a/modules/protocol/unrealircd.cpp
+++ b/modules/protocol/unrealircd.cpp
@@ -123,11 +123,7 @@ class UnrealIRCdProto : public IRCDProto
}
}
- // Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
- timeleft = 172800;
- UplinkSocket::Message() << "TKL + G " << x->GetUser() << " " << x->GetHost() << " " << x->by << " " << Anope::CurTime + timeleft << " " << x->created << " :" << x->GetReason();
+ UplinkSocket::Message() << "TKL + G " << x->GetUser() << " " << x->GetHost() << " " << x->by << " " << x->expires << " " << x->created << " :" << x->GetReason();
}
void SendSVSKillInternal(const MessageSource &source, User *user, const Anope::string &buf) override
@@ -273,11 +269,7 @@ class UnrealIRCdProto : public IRCDProto
/* SZLINE */
void SendSZLine(User *, const XLine *x) override
{
- // Calculate the time left before this would expire, capping it at 2 days
- time_t timeleft = x->expires - Anope::CurTime;
- if (timeleft > 172800 || !x->expires)
- timeleft = 172800;
- UplinkSocket::Message() << "TKL + Z * " << x->GetHost() << " " << x->by << " " << Anope::CurTime + timeleft << " " << x->created << " :" << x->GetReason();
+ UplinkSocket::Message() << "TKL + Z * " << x->GetHost() << " " << x->by << " " << x->expires << " " << x->created << " :" << x->GetReason();
}
/* SGLINE */