mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-11 03:29:02 -04:00
Use Duration::ToHuman instead of seconds in various messages.
This commit is contained in:
parent
2102b065d4
commit
abba3ed1e6
@ -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}>.
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user