aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/inspircd.cpp5
-rw-r--r--src/modules/m_delaymsg.cpp4
-rw-r--r--src/modules/m_filter.cpp2
-rw-r--r--src/modules/m_joinflood.cpp5
-rw-r--r--src/modules/m_kicknorejoin.cpp5
-rw-r--r--src/modules/m_nickflood.cpp9
-rw-r--r--src/modules/m_permchannels.cpp2
-rw-r--r--src/modules/m_setidle.cpp2
-rw-r--r--src/modules/m_spanningtree/main.cpp4
-rw-r--r--src/modules/m_spanningtree/pingtimer.cpp4
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp8
-rw-r--r--src/modules/m_xline_db.cpp2
-rw-r--r--src/usermanager.cpp3
13 files changed, 33 insertions, 22 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 67fc29ef5..c83bda18d 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -37,6 +37,7 @@
#include <lyra/lyra.hpp>
#include "inspircd.h"
+#include "timeutils.h"
#include "xline.h"
#ifndef _WIN32
@@ -128,10 +129,10 @@ namespace
time_t timediff = newtime - oldtime;
if (timediff > ServerInstance->Config->TimeSkipWarn)
- ServerInstance->SNO.WriteToSnoMask('a', "\002Performance warning!\002 Server clock jumped forwards by {} seconds!", timediff);
+ ServerInstance->SNO.WriteToSnoMask('a', "\002Performance warning!\002 Server clock jumped forwards by {}!", Duration::ToHuman(timediff));
else if (timediff < -ServerInstance->Config->TimeSkipWarn)
- ServerInstance->SNO.WriteToSnoMask('a', "\002Performance warning!\002 Server clock jumped backwards by {} seconds!", labs(timediff));
+ ServerInstance->SNO.WriteToSnoMask('a', "\002Performance warning!\002 Server clock jumped backwards by {}!", Duration::ToHuman(std::abs(timediff)));
}
// Drops to the unprivileged user/group specified in <security:runas{user,group}>.
diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp
index 9627223c1..4408a1654 100644
--- a/src/modules/m_delaymsg.cpp
+++ b/src/modules/m_delaymsg.cpp
@@ -25,6 +25,7 @@
#include "inspircd.h"
#include "modules/ctctags.h"
#include "modules/exemption.h"
+#include "timeutils.h"
#include "numerichelper.h"
class DelayMsgMode final
@@ -139,7 +140,8 @@ ModResult ModuleDelayMsg::HandleMessage(User* user, const MessageTarget& target)
if (user->HasPrivPermission("channels/ignore-delaymsg"))
return MOD_RES_PASSTHRU;
- const std::string message = INSP_FORMAT("You cannot send messages to this channel until you have been a member for {} seconds.", len);
+ const std::string message = INSP_FORMAT("You cannot send messages to this channel until you have been a member for {}.",
+ Duration::ToHuman(len));
user->WriteNumeric(Numerics::CannotSendTo(channel, message));
return MOD_RES_DENY;
}
diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp
index 387224030..df750fd7c 100644
--- a/src/modules/m_filter.cpp
+++ b/src/modules/m_filter.cpp
@@ -981,7 +981,7 @@ bool ModuleFilter::Tick()
// Back off a bit to avoid spamming opers.
if (backoff > 1)
SetInterval(std::min(GetInterval() * backoff, maxbackoff), false);
- ServerInstance->Logs.Debug(MODNAME, "Trying again in {} seconds", GetInterval());
+ ServerInstance->Logs.Debug(MODNAME, "Trying again in {}", Duration::ToHuman(GetInterval()));
}
}
return true;
diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp
index f7ab1efbd..0c83abefc 100644
--- a/src/modules/m_joinflood.cpp
+++ b/src/modules/m_joinflood.cpp
@@ -28,6 +28,7 @@
#include "extension.h"
#include "modules/server.h"
#include "numerichelper.h"
+#include "timeutils.h"
// The number of seconds the channel will be closed for.
static unsigned int duration;
@@ -201,8 +202,8 @@ public:
f->lock();
PrefixMode* pm = ServerInstance->Modes.FindNearestPrefixMode(notifyrank);
- memb->chan->WriteNotice(INSP_FORMAT("This channel has been closed to new users for {} seconds because there have been more than {} joins in {} seconds.",
- duration, f->joins, f->secs), pm ? pm->GetPrefix() : 0);
+ memb->chan->WriteNotice(INSP_FORMAT("This channel has been closed to new users for {} because there have been more than {} joins in {}.",
+ Duration::ToHuman(duration), f->joins, Duration::ToHuman(f->secs)), pm ? pm->GetPrefix() : 0);
}
}
}
diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp
index 823938a10..e9c75e71b 100644
--- a/src/modules/m_kicknorejoin.cpp
+++ b/src/modules/m_kicknorejoin.cpp
@@ -28,6 +28,7 @@
#include "extension.h"
#include "modules/invite.h"
#include "numerichelper.h"
+#include "timeutils.h"
class KickRejoinData final
{
@@ -143,8 +144,8 @@ public:
const KickRejoinData* data = kr.ext.Get(chan);
if ((data) && !invapi->IsInvited(user, chan) && (!data->canjoin(user)))
{
- user->WriteNumeric(ERR_UNAVAILRESOURCE, chan->name, INSP_FORMAT("You must wait {} seconds after being kicked to rejoin (+{} is set)",
- data->delay, kr.GetModeChar()));
+ user->WriteNumeric(ERR_UNAVAILRESOURCE, chan->name, INSP_FORMAT("You must wait for {} after being kicked to rejoin (+{} is set)",
+ Duration::ToHuman(data->delay), kr.GetModeChar()));
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp
index db873d837..9aeb37a6f 100644
--- a/src/modules/m_nickflood.cpp
+++ b/src/modules/m_nickflood.cpp
@@ -26,6 +26,7 @@
#include "extension.h"
#include "modules/exemption.h"
#include "numerichelper.h"
+#include "timeutils.h"
// The number of seconds nickname changing will be blocked for.
static unsigned int duration;
@@ -159,8 +160,8 @@ public:
if (f->islocked())
{
- user->WriteNumeric(ERR_CANTCHANGENICK, INSP_FORMAT("{} has been locked for nickchanges for {} seconds because there have been more than {} nick changes in {} seconds",
- memb->chan->name, duration, f->nicks, f->secs));
+ user->WriteNumeric(ERR_CANTCHANGENICK, INSP_FORMAT("{} has been locked for nick changes for {} because there have been more than {} nick changes in {}",
+ memb->chan->name, Duration::ToHuman(duration), f->nicks, Duration::ToHuman(f->secs)));
return MOD_RES_DENY;
}
@@ -168,8 +169,8 @@ public:
{
f->clear();
f->lock();
- memb->chan->WriteNotice(INSP_FORMAT("No nick changes are allowed for {} seconds because there have been more than {} nick changes in {} seconds.",
- duration, f->nicks, f->secs));
+ memb->chan->WriteNotice(INSP_FORMAT("No nick changes are allowed for {} because there have been more than {} nick changes in {}.",
+ Duration::ToHuman(duration), f->nicks, Duration::ToHuman(f->secs)));
return MOD_RES_DENY;
}
}
diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp
index 413ac46fc..30ff20a74 100644
--- a/src/modules/m_permchannels.cpp
+++ b/src/modules/m_permchannels.cpp
@@ -337,7 +337,7 @@ public:
// Back off a bit to avoid spamming opers.
if (backoff > 1)
SetInterval(std::min(GetInterval() * backoff, maxbackoff), false);
- ServerInstance->Logs.Debug(MODNAME, "Trying again in {} seconds", GetInterval());
+ ServerInstance->Logs.Debug(MODNAME, "Trying again in {}", Duration::ToHuman(GetInterval()));
}
}
return true;
diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp
index eab34d76c..d0ef8f418 100644
--- a/src/modules/m_setidle.cpp
+++ b/src/modules/m_setidle.cpp
@@ -61,7 +61,7 @@ public:
if (user->signon > user->idle_lastmsg)
user->signon = user->idle_lastmsg;
- ServerInstance->SNO.WriteToSnoMask('a', "{} used SETIDLE to set their idle time to {} seconds", user->nick, idle);
+ ServerInstance->SNO.WriteToSnoMask('a', "{} used SETIDLE to set their idle time to {}", user->nick, Duration::ToHuman(idle));
noterpl.SendIfCap(user, stdrplcap, this, "IDLE_TIME_SET", user->idle_lastmsg, "Idle time set.");
return CmdResult::SUCCESS;
}
diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp
index c1e74d4c4..cf91fa7ec 100644
--- a/src/modules/m_spanningtree/main.cpp
+++ b/src/modules/m_spanningtree/main.cpp
@@ -30,6 +30,7 @@
#include "clientprotocolmsg.h"
#include "iohook.h"
#include "socket.h"
+#include "timeutils.h"
#include "xline.h"
#include "commands.h"
@@ -302,7 +303,8 @@ void ModuleSpanningTree::DoConnectTimeout(time_t curtime)
}
else if (curtime > s->age + (time_t)p.second)
{
- ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002{}\002 (timeout of {} seconds)", p.first, p.second);
+ ServerInstance->SNO.WriteToSnoMask('l', "CONNECT: Error connecting \002{}\002 (timeout of {})",
+ p.first, Duration::ToHuman(p.second));
Utils->timeoutlist.erase(me);
s->Close();
}
diff --git a/src/modules/m_spanningtree/pingtimer.cpp b/src/modules/m_spanningtree/pingtimer.cpp
index c9535366c..a6d193bfb 100644
--- a/src/modules/m_spanningtree/pingtimer.cpp
+++ b/src/modules/m_spanningtree/pingtimer.cpp
@@ -19,6 +19,7 @@
#include "inspircd.h"
+#include "timeutils.h"
#include "pingtimer.h"
#include "treeserver.h"
@@ -48,7 +49,8 @@ PingTimer::State PingTimer::TickInternal()
else if (state == PS_WARN)
{
// No pong arrived in PingWarnTime seconds, send a warning to opers
- ServerInstance->SNO.WriteToSnoMask('l', "Server \002{}\002 has not responded to PING for {} seconds, high latency.", server->GetName(), GetInterval());
+ ServerInstance->SNO.WriteToSnoMask('l', "Server \002{}\002 has not responded to PING for {}, high latency.",
+ server->GetName(), Duration::ToHuman(GetInterval()));
return PS_TIMEOUT;
}
else // PS_TIMEOUT
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index 563099bae..e8fa38a54 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -164,13 +164,13 @@ void TreeSocket::ProcessLine(std::string& line)
time_t delta = std::abs(them - ServerInstance->Time());
if (delta > 15)
{
- ServerInstance->SNO.WriteGlobalSno('l', "\002ERROR\002: Your clocks are off by {} seconds (this is more than fifteen seconds). Link aborted, \002PLEASE SYNC YOUR CLOCKS!\002", delta);
- SendError(INSP_FORMAT("Your clocks are out by {} seconds (this is more than fifteen seconds). Link aborted, PLEASE SYNC YOUR CLOCKS!", delta));
+ ServerInstance->SNO.WriteGlobalSno('l', "\002ERROR\002: Your clocks are off by {} (this is more than fifteen seconds). Link aborted, \002PLEASE SYNC YOUR CLOCKS!\002", Duration::ToHuman(delta));
+ SendError(INSP_FORMAT("Your clocks are out by {} (this is more than fifteen seconds). Link aborted, PLEASE SYNC YOUR CLOCKS!", Duration::ToHuman(delta)));
return;
}
- else if ((delta < -5) || (delta > 5))
+ else if (delta > 5)
{
- ServerInstance->SNO.WriteGlobalSno('l', "\002WARNING\002: Your clocks are off by {} seconds. Please consider syncing your clocks.", labs((long)delta));
+ ServerInstance->SNO.WriteGlobalSno('l', "\002WARNING\002: Your clocks are off by {}. Please consider syncing your clocks.", Duration::ToHuman(delta));
}
}
diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp
index c067ec436..ad18df5a8 100644
--- a/src/modules/m_xline_db.cpp
+++ b/src/modules/m_xline_db.cpp
@@ -109,7 +109,7 @@ public:
// Back off a bit to avoid spamming opers.
if (backoff > 1)
SetInterval(std::min(GetInterval() * backoff, maxbackoff), false);
- ServerInstance->Logs.Debug(MODNAME, "Trying again in {} seconds", GetInterval());
+ ServerInstance->Logs.Debug(MODNAME, "Trying again in {}", Duration::ToHuman(GetInterval()));
}
}
return true;
diff --git a/src/usermanager.cpp b/src/usermanager.cpp
index c6da619b8..1bdf21ec0 100644
--- a/src/usermanager.cpp
+++ b/src/usermanager.cpp
@@ -27,6 +27,7 @@
#include "inspircd.h"
#include "clientprotocolmsg.h"
#include "iohook.h"
+#include "timeutils.h"
#include "xline.h"
namespace
@@ -65,7 +66,7 @@ namespace
if (!user->lastping)
{
time_t secs = ServerInstance->Time() - (user->nextping - user->GetClass()->pingtime);
- const std::string message = INSP_FORMAT("Ping timeout: {} {}", secs, (secs != 1 ? "seconds" : "second"));
+ const std::string message = INSP_FORMAT("Ping timeout: {}", Duration::ToHuman(secs));
ServerInstance->Users.QuitUser(user, message);
return;
}