diff options
author | Adam <Adam@anope.org> | 2011-11-05 00:11:49 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2011-11-05 00:11:49 -0400 |
commit | 5f0b9338dc58923bbbba8293bf9021e87ceb1976 (patch) | |
tree | 1f86843375527d98e51a2afaff2dee0eb5e58453 /modules/protocol | |
parent | b3194a10c520aa97d0e50ee74554f6c76f7f6c9e (diff) |
Set proper expirys on ZLines if the IRCd supports it
Diffstat (limited to 'modules/protocol')
-rw-r--r-- | modules/protocol/inspircd-ts6.h | 12 | ||||
-rw-r--r-- | modules/protocol/inspircd11.cpp | 14 | ||||
-rw-r--r-- | modules/protocol/plexus.cpp | 6 | ||||
-rw-r--r-- | modules/protocol/ratbox.cpp | 6 | ||||
-rw-r--r-- | modules/protocol/unreal.cpp | 6 |
5 files changed, 36 insertions, 8 deletions
diff --git a/modules/protocol/inspircd-ts6.h b/modules/protocol/inspircd-ts6.h index 6cc5661a7..4ad003ad5 100644 --- a/modules/protocol/inspircd-ts6.h +++ b/modules/protocol/inspircd-ts6.h @@ -158,7 +158,11 @@ class InspIRCdTS6Proto : public IRCDProto /* SQLINE */ void SendSQLine(User *, const XLine *x) { - send_cmd(Config->Numeric, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config->OperServ.c_str(), static_cast<long>(Anope::CurTime), x->Reason.c_str()); + // 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; + send_cmd(Config->Numeric, "ADDLINE Q %s %s %ld %ld :%s", x->Mask.c_str(), Config->OperServ.c_str(), static_cast<long>(Anope::CurTime), static_cast<long>(timeleft), x->Reason.c_str()); } /* SQUIT */ @@ -210,7 +214,11 @@ class InspIRCdTS6Proto : public IRCDProto /* SZLINE */ void SendSZLine(User *, const XLine *x) { - send_cmd(Config->Numeric, "ADDLINE Z %s %s %ld 0 :%s", x->GetHost().c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime), x->Reason.c_str()); + // 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; + send_cmd(Config->Numeric, "ADDLINE Z %s %s %ld %ld :%s", x->GetHost().c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime), 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 &) diff --git a/modules/protocol/inspircd11.cpp b/modules/protocol/inspircd11.cpp index 77b619f64..262892c42 100644 --- a/modules/protocol/inspircd11.cpp +++ b/modules/protocol/inspircd11.cpp @@ -110,7 +110,7 @@ class InspIRCdProto : 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) + if (timeleft > 172800 || !x->Expires) timeleft = 172800; 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()); } @@ -187,7 +187,11 @@ class InspIRCdProto : public IRCDProto /* SQLINE */ void SendSQLine(User *, const XLine *x) { - send_cmd(Config->ServerName, "ADDLINE Q %s %s %ld 0 :%s", x->Mask.c_str(), Config->OperServ.c_str(), static_cast<long>(Anope::CurTime), x->Reason.c_str()); + // 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; + send_cmd(Config->ServerName, "ADDLINE Q %s %s %ld %ld :%s", x->Mask.c_str(), Config->OperServ.c_str(), static_cast<long>(Anope::CurTime), static_cast<long>(timeleft), x->Reason.c_str()); } /* SQUIT */ @@ -249,7 +253,11 @@ class InspIRCdProto : public IRCDProto /* SZLINE */ void SendSZLine(User *, const XLine *x) { - send_cmd(Config->ServerName, "ADDLINE Z %s %s %ld 0 :%s", x->GetHost().c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime), x->Reason.c_str()); + // 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; + send_cmd(Config->ServerName, "ADDLINE Z %s %s %ld %ld :%s", x->GetHost().c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime), static_cast<long>(timeleft), x->Reason.c_str()); } void SendSVSJoin(const Anope::string &source, const Anope::string &nick, const Anope::string &chan, const Anope::string &) diff --git a/modules/protocol/plexus.cpp b/modules/protocol/plexus.cpp index 9d6902080..92b55ac46 100644 --- a/modules/protocol/plexus.cpp +++ b/modules/protocol/plexus.cpp @@ -146,8 +146,12 @@ class PlexusProto : public IRCDProto void SendAkill(User *, const XLine *x) { + // 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; BotInfo *bi = findbot(Config->OperServ); - send_cmd(bi ? bi->GetUID() : Config->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()); + send_cmd(bi ? bi->GetUID() : Config->OperServ, "KLINE * %ld %s %s :%s", static_cast<long>(timeleft), x->GetUser().c_str(), x->GetHost().c_str(), x->Reason.c_str()); } void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) diff --git a/modules/protocol/ratbox.cpp b/modules/protocol/ratbox.cpp index 32acfc3e1..6cb58968f 100644 --- a/modules/protocol/ratbox.cpp +++ b/modules/protocol/ratbox.cpp @@ -144,8 +144,12 @@ class RatboxProto : public IRCDProto void SendAkill(User *, const XLine *x) { + // 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; BotInfo *bi = findbot(Config->OperServ); - send_cmd(bi ? bi->GetUID() : Config->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()); + send_cmd(bi ? bi->GetUID() : Config->OperServ, "KLINE * %ld %s %s :%s", static_cast<long>(timeleft), x->GetUser().c_str(), x->GetHost().c_str(), x->Reason.c_str()); } void SendSVSKillInternal(const BotInfo *source, const User *user, const Anope::string &buf) diff --git a/modules/protocol/unreal.cpp b/modules/protocol/unreal.cpp index 6b4d844d5..bb23ade2a 100644 --- a/modules/protocol/unreal.cpp +++ b/modules/protocol/unreal.cpp @@ -267,7 +267,11 @@ class UnrealIRCdProto : public IRCDProto /* SZLINE */ void SendSZLine(User *, const XLine *x) { - send_cmd("", "BD + Z * %s %s %ld %ld :%s", x->GetHost().c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime + 172800), static_cast<long>(Anope::CurTime), x->Reason.c_str()); + // 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; + send_cmd("", "BD + Z * %s %s %ld %ld :%s", x->GetHost().c_str(), x->By.c_str(), static_cast<long>(Anope::CurTime + timeleft), static_cast<long>(x->Created), x->Reason.c_str()); } /* SGLINE */ |