summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatt Schatz <genius3000@g3k.solutions>2019-02-17 02:23:32 -0700
committerPeter Powell <petpow@saberuk.com>2019-02-18 09:17:38 +0000
commit755a32c75101c4df0e5699db558785fc0dbc1973 (patch)
treea5e789f122881bf1ed7dc124da779600bb3fe13c /src
parentff7bebe90c6b348b0df28864e4954d04bd17256b (diff)
Start using DurationString() in X-line additions and
a few other modules where it fits better than just showing seconds.
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_xline/cmd_eline.cpp9
-rw-r--r--src/coremods/core_xline/cmd_gline.cpp9
-rw-r--r--src/coremods/core_xline/cmd_kline.cpp9
-rw-r--r--src/coremods/core_xline/cmd_qline.cpp9
-rw-r--r--src/coremods/core_xline/cmd_zline.cpp9
-rw-r--r--src/modules/m_cban.cpp6
-rw-r--r--src/modules/m_dccallow.cpp2
-rw-r--r--src/modules/m_dnsbl.cpp18
-rw-r--r--src/modules/m_rline.cpp12
-rw-r--r--src/modules/m_shun.cpp9
-rw-r--r--src/modules/m_spanningtree/addline.cpp12
-rw-r--r--src/modules/m_timedbans.cpp2
12 files changed, 51 insertions, 55 deletions
diff --git a/src/coremods/core_xline/cmd_eline.cpp b/src/coremods/core_xline/cmd_eline.cpp
index 99794be3e..4a56ba7ea 100644
--- a/src/coremods/core_xline/cmd_eline.cpp
+++ b/src/coremods/core_xline/cmd_eline.cpp
@@ -69,14 +69,13 @@ CmdResult CommandEline::Handle(User* user, const Params& parameters)
{
if (!duration)
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent E-line for %s: %s", user->nick.c_str(), target.c_str(), parameters[2].c_str());
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added permanent E-line for %s: %s", user->nick.c_str(), target.c_str(), parameters[2].c_str());
}
else
{
- time_t c_requires_crap = duration + ServerInstance->Time();
- std::string timestr = InspIRCd::TimeString(c_requires_crap);
- ServerInstance->SNO->WriteToSnoMask('x',"%s added timed E-line for %s, expires on %s: %s",user->nick.c_str(),target.c_str(),
- timestr.c_str(), parameters[2].c_str());
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added timed E-line for %s, expires in %s (on %s): %s",
+ user->nick.c_str(), target.c_str(), InspIRCd::DurationString(duration).c_str(),
+ InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str());
}
}
else
diff --git a/src/coremods/core_xline/cmd_gline.cpp b/src/coremods/core_xline/cmd_gline.cpp
index ae1ea5d6e..3e710978d 100644
--- a/src/coremods/core_xline/cmd_gline.cpp
+++ b/src/coremods/core_xline/cmd_gline.cpp
@@ -75,14 +75,13 @@ CmdResult CommandGline::Handle(User* user, const Params& parameters)
{
if (!duration)
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent G-line for %s: %s",user->nick.c_str(),target.c_str(), parameters[2].c_str());
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added permanent G-line for %s: %s", user->nick.c_str(), target.c_str(), parameters[2].c_str());
}
else
{
- time_t c_requires_crap = duration + ServerInstance->Time();
- std::string timestr = InspIRCd::TimeString(c_requires_crap);
- ServerInstance->SNO->WriteToSnoMask('x',"%s added timed G-line for %s, expires on %s: %s",user->nick.c_str(),target.c_str(),
- timestr.c_str(), parameters[2].c_str());
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added timed G-line for %s, expires in %s (on %s): %s",
+ user->nick.c_str(), target.c_str(), InspIRCd::DurationString(duration).c_str(),
+ InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str());
}
ServerInstance->XLines->ApplyLines();
diff --git a/src/coremods/core_xline/cmd_kline.cpp b/src/coremods/core_xline/cmd_kline.cpp
index ad7511d56..1ec10aebb 100644
--- a/src/coremods/core_xline/cmd_kline.cpp
+++ b/src/coremods/core_xline/cmd_kline.cpp
@@ -75,14 +75,13 @@ CmdResult CommandKline::Handle(User* user, const Params& parameters)
{
if (!duration)
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent K-line for %s: %s",user->nick.c_str(),target.c_str(), parameters[2].c_str());
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added permanent K-line for %s: %s", user->nick.c_str(), target.c_str(), parameters[2].c_str());
}
else
{
- time_t c_requires_crap = duration + ServerInstance->Time();
- std::string timestr = InspIRCd::TimeString(c_requires_crap);
- ServerInstance->SNO->WriteToSnoMask('x',"%s added timed K-line for %s, expires on %s: %s",user->nick.c_str(),target.c_str(),
- timestr.c_str(), parameters[2].c_str());
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added timed K-line for %s, expires in %s (on %s): %s",
+ user->nick.c_str(), target.c_str(), InspIRCd::DurationString(duration).c_str(),
+ InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str());
}
ServerInstance->XLines->ApplyLines();
diff --git a/src/coremods/core_xline/cmd_qline.cpp b/src/coremods/core_xline/cmd_qline.cpp
index 51f5bec16..afdc0431e 100644
--- a/src/coremods/core_xline/cmd_qline.cpp
+++ b/src/coremods/core_xline/cmd_qline.cpp
@@ -55,14 +55,13 @@ CmdResult CommandQline::Handle(User* user, const Params& parameters)
{
if (!duration)
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Q-line for %s: %s",user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str());
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added permanent Q-line for %s: %s", user->nick.c_str(), parameters[0].c_str(), parameters[2].c_str());
}
else
{
- time_t c_requires_crap = duration + ServerInstance->Time();
- std::string timestr = InspIRCd::TimeString(c_requires_crap);
- ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Q-line for %s, expires on %s: %s",user->nick.c_str(),parameters[0].c_str(),
- timestr.c_str(), parameters[2].c_str());
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added timed Q-line for %s, expires in %s (on %s): %s",
+ user->nick.c_str(), parameters[0].c_str(), InspIRCd::DurationString(duration).c_str(),
+ InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str());
}
ServerInstance->XLines->ApplyLines();
}
diff --git a/src/coremods/core_xline/cmd_zline.cpp b/src/coremods/core_xline/cmd_zline.cpp
index 4aaa3061f..d32cde295 100644
--- a/src/coremods/core_xline/cmd_zline.cpp
+++ b/src/coremods/core_xline/cmd_zline.cpp
@@ -73,14 +73,13 @@ CmdResult CommandZline::Handle(User* user, const Params& parameters)
{
if (!duration)
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent Z-line for %s: %s", user->nick.c_str(), ipaddr, parameters[2].c_str());
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added permanent Z-line for %s: %s", user->nick.c_str(), ipaddr, parameters[2].c_str());
}
else
{
- time_t c_requires_crap = duration + ServerInstance->Time();
- std::string timestr = InspIRCd::TimeString(c_requires_crap);
- ServerInstance->SNO->WriteToSnoMask('x',"%s added timed Z-line for %s, expires on %s: %s",user->nick.c_str(),ipaddr,
- timestr.c_str(), parameters[2].c_str());
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added timed Z-line for %s, expires in %s (on %s): %s",
+ user->nick.c_str(), ipaddr, InspIRCd::DurationString(duration).c_str(),
+ InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str());
}
ServerInstance->XLines->ApplyLines();
}
diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp
index ae49dbc05..32b45abfb 100644
--- a/src/modules/m_cban.cpp
+++ b/src/modules/m_cban.cpp
@@ -130,9 +130,9 @@ class CommandCBan : public Command
}
else
{
- time_t c_requires_crap = duration + ServerInstance->Time();
- std::string timestr = InspIRCd::TimeString(c_requires_crap);
- ServerInstance->SNO->WriteGlobalSno('x', "%s added timed CBan for %s, expires on %s: %s", user->nick.c_str(), parameters[0].c_str(), timestr.c_str(), reason);
+ ServerInstance->SNO->WriteGlobalSno('x', "%s added timed CBan for %s, expires in %s (on %s): %s",
+ user->nick.c_str(), parameters[0].c_str(), InspIRCd::DurationString(duration).c_str(),
+ InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), reason);
}
}
else
diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp
index f0a88022c..86fa50724 100644
--- a/src/modules/m_dccallow.cpp
+++ b/src/modules/m_dccallow.cpp
@@ -235,7 +235,7 @@ class CommandDccallow : public Command
if (length > 0)
{
- user->WriteNumeric(RPL_DCCALLOWTIMED, user->nick, InspIRCd::Format("Added %s to DCCALLOW list for %ld seconds", target->nick.c_str(), length));
+ user->WriteNumeric(RPL_DCCALLOWTIMED, user->nick, InspIRCd::Format("Added %s to DCCALLOW list for %s", target->nick.c_str(), InspIRCd::DurationString(length).c_str()));
}
else
{
diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp
index eade39bd7..91777637c 100644
--- a/src/modules/m_dnsbl.cpp
+++ b/src/modules/m_dnsbl.cpp
@@ -147,9 +147,9 @@ class DNSBLResolver : public DNS::Request
"*", them->GetIPString());
if (ServerInstance->XLines->AddLine(kl,NULL))
{
- std::string timestr = InspIRCd::TimeString(kl->expiry);
- ServerInstance->SNO->WriteGlobalSno('x', "K-line added due to DNSBL match on *@%s to expire on %s: %s",
- them->GetIPString().c_str(), timestr.c_str(), reason.c_str());
+ ServerInstance->SNO->WriteGlobalSno('x', "K-line added due to DNSBL match on *@%s to expire in %s (on %s): %s",
+ them->GetIPString().c_str(), InspIRCd::DurationString(kl->duration).c_str(),
+ InspIRCd::TimeString(kl->expiry).c_str(), reason.c_str());
ServerInstance->XLines->ApplyLines();
}
else
@@ -165,9 +165,9 @@ class DNSBLResolver : public DNS::Request
"*", them->GetIPString());
if (ServerInstance->XLines->AddLine(gl,NULL))
{
- std::string timestr = InspIRCd::TimeString(gl->expiry);
- ServerInstance->SNO->WriteGlobalSno('x', "G-line added due to DNSBL match on *@%s to expire on %s: %s",
- them->GetIPString().c_str(), timestr.c_str(), reason.c_str());
+ ServerInstance->SNO->WriteGlobalSno('x', "G-line added due to DNSBL match on *@%s to expire in %s (on %s): %s",
+ them->GetIPString().c_str(), InspIRCd::DurationString(gl->duration).c_str(),
+ InspIRCd::TimeString(gl->expiry).c_str(), reason.c_str());
ServerInstance->XLines->ApplyLines();
}
else
@@ -183,9 +183,9 @@ class DNSBLResolver : public DNS::Request
them->GetIPString());
if (ServerInstance->XLines->AddLine(zl,NULL))
{
- std::string timestr = InspIRCd::TimeString(zl->expiry);
- ServerInstance->SNO->WriteGlobalSno('x', "Z-line added due to DNSBL match on %s to expire on %s: %s",
- them->GetIPString().c_str(), timestr.c_str(), reason.c_str());
+ ServerInstance->SNO->WriteGlobalSno('x', "Z-line added due to DNSBL match on %s to expire in %s (on %s): %s",
+ them->GetIPString().c_str(), InspIRCd::DurationString(zl->duration).c_str(),
+ InspIRCd::TimeString(zl->expiry).c_str(), reason.c_str());
ServerInstance->XLines->ApplyLines();
}
else
diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp
index 353a184aa..c7088a855 100644
--- a/src/modules/m_rline.cpp
+++ b/src/modules/m_rline.cpp
@@ -80,9 +80,9 @@ class RLine : public XLine
ZLine* zl = new ZLine(ServerInstance->Time(), duration ? expiry - ServerInstance->Time() : 0, ServerInstance->Config->ServerName.c_str(), reason.c_str(), u->GetIPString());
if (ServerInstance->XLines->AddLine(zl, NULL))
{
- std::string timestr = InspIRCd::TimeString(zl->expiry);
- ServerInstance->SNO->WriteToSnoMask('x', "Z-line added due to R-line match on %s%s%s: %s",
- zl->ipaddr.c_str(), zl->duration ? " to expire on " : "", zl->duration ? timestr.c_str() : "", zl->reason.c_str());
+ std::string expirystr = zl->duration ? InspIRCd::Format(" to expire in %s (on %s)", InspIRCd::DurationString(zl->duration).c_str(), InspIRCd::TimeString(zl->expiry).c_str()) : "";
+ ServerInstance->SNO->WriteToSnoMask('x', "Z-line added due to R-line match on %s%s: %s",
+ zl->ipaddr.c_str(), expirystr.c_str(), zl->reason.c_str());
added_zline = true;
}
else
@@ -174,9 +174,9 @@ class CommandRLine : public Command
}
else
{
- time_t c_requires_crap = duration + ServerInstance->Time();
- std::string timestr = InspIRCd::TimeString(c_requires_crap);
- ServerInstance->SNO->WriteToSnoMask('x', "%s added timed R-line for %s to expire on %s: %s", user->nick.c_str(), parameters[0].c_str(), timestr.c_str(), parameters[2].c_str());
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added timed R-line for %s to expire in %s (on %s): %s",
+ user->nick.c_str(), parameters[0].c_str(), InspIRCd::DurationString(duration).c_str(),
+ InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), parameters[2].c_str());
}
ServerInstance->XLines->ApplyLines();
diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp
index e54156da6..b4e538624 100644
--- a/src/modules/m_shun.cpp
+++ b/src/modules/m_shun.cpp
@@ -110,15 +110,14 @@ class CommandShun : public Command
{
if (!duration)
{
- ServerInstance->SNO->WriteToSnoMask('x',"%s added permanent SHUN for %s: %s",
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added permanent SHUN for %s: %s",
user->nick.c_str(), target.c_str(), expr.c_str());
}
else
{
- time_t c_requires_crap = duration + ServerInstance->Time();
- std::string timestr = InspIRCd::TimeString(c_requires_crap);
- ServerInstance->SNO->WriteToSnoMask('x', "%s added timed SHUN for %s to expire on %s: %s",
- user->nick.c_str(), target.c_str(), timestr.c_str(), expr.c_str());
+ ServerInstance->SNO->WriteToSnoMask('x', "%s added timed SHUN for %s to expire in %s (on %s): %s",
+ user->nick.c_str(), target.c_str(), InspIRCd::DurationString(duration).c_str(),
+ InspIRCd::TimeString(ServerInstance->Time() + duration).c_str(), expr.c_str());
}
}
else
diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp
index 5124339fb..a2c459f15 100644
--- a/src/modules/m_spanningtree/addline.cpp
+++ b/src/modules/m_spanningtree/addline.cpp
@@ -50,14 +50,16 @@ CmdResult CommandAddLine::Handle(User* usr, Params& params)
{
if (xl->duration)
{
- std::string timestr = InspIRCd::TimeString(xl->expiry);
- ServerInstance->SNO->WriteToSnoMask('X',"%s added %s%s on %s to expire on %s: %s",setter.c_str(),params[0].c_str(),params[0].length() == 1 ? "-line" : "",
- params[1].c_str(), timestr.c_str(), params[5].c_str());
+ ServerInstance->SNO->WriteToSnoMask('X', "%s added %s%s on %s to expire in %s (on %s): %s",
+ setter.c_str(), params[0].c_str(), params[0].length() == 1 ? "-line" : "",
+ params[1].c_str(), InspIRCd::DurationString(xl->duration).c_str(),
+ InspIRCd::TimeString(xl->expiry).c_str(), params[5].c_str());
}
else
{
- ServerInstance->SNO->WriteToSnoMask('X',"%s added permanent %s%s on %s: %s",setter.c_str(),params[0].c_str(),params[0].length() == 1 ? "-line" : "",
- params[1].c_str(),params[5].c_str());
+ ServerInstance->SNO->WriteToSnoMask('X', "%s added permanent %s%s on %s: %s",
+ setter.c_str(), params[0].c_str(), params[0].length() == 1 ? "-line" : "",
+ params[1].c_str(), params[5].c_str());
}
TreeServer* remoteserver = TreeServer::Get(usr);
diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp
index 32b376c79..83488a954 100644
--- a/src/modules/m_timedbans.cpp
+++ b/src/modules/m_timedbans.cpp
@@ -118,7 +118,7 @@ class CommandTban : public Command
T.chan = channel;
TimedBanList.push_back(T);
- const std::string addban = user->nick + " added a timed ban on " + mask + " lasting for " + ConvToStr(duration) + " seconds.";
+ const std::string addban = user->nick + " added a timed ban on " + mask + " lasting for " + InspIRCd::DurationString(duration) + ".";
// If halfop is loaded, send notice to halfops and above, otherwise send to ops and above
PrefixMode* mh = ServerInstance->Modes->FindPrefixMode('h');
char pfxchar = (mh && mh->name == "halfop") ? mh->GetPrefix() : '@';