diff options
| author | 2025-03-18 13:57:00 +0000 | |
|---|---|---|
| committer | 2025-03-18 14:18:03 +0000 | |
| commit | 31c446201bf1b2b14dde2770e2006712438589e7 (patch) | |
| tree | 06dbc5c1493ce81b984c8804cfc759c06fb278a1 | |
| parent | Add a formatting overload of the ModuleException constructor. (diff) | |
Rename ToHuman to ToLongString.
This name is used by functions in too many places already.
37 files changed, 57 insertions, 57 deletions
diff --git a/include/timeutils.h b/include/timeutils.h index 521105743..5ac185e22 100644 --- a/include/timeutils.h +++ b/include/timeutils.h @@ -38,7 +38,7 @@ namespace Duration */ CoreExport bool IsValid(const std::string& str); - /** Converts a number of seconds to a human-readable representation. + /** Converts a number of seconds to a human-readable duration string. * * e.g. 33,019,565 will result in 1 year, 2 weeks, 3 days, 4 hours, 6 * minutes, 5 seconds. @@ -46,7 +46,7 @@ namespace Duration * @param duration The number of seconds to convert. * @param brief Whether to round to the nearest time period. */ - CoreExport std::string ToHuman(unsigned long duration, bool brief = false); + CoreExport std::string ToLongString(unsigned long duration, bool brief = false); /** Converts a number of seconds to a duration string. * diff --git a/src/coremods/core_oper/core_oper.cpp b/src/coremods/core_oper/core_oper.cpp index 0f464b660..4f7c3cbdc 100644 --- a/src/coremods/core_oper/core_oper.cpp +++ b/src/coremods/core_oper/core_oper.cpp @@ -217,7 +217,7 @@ public: std::string extra; if (oper->IsAway()) { - const std::string awayperiod = Duration::ToHuman(ServerInstance->Time() - oper->away->time, true); + const std::string awayperiod = Duration::ToLongString(ServerInstance->Time() - oper->away->time, true); const std::string awaytime = Time::ToString(oper->away->time); extra = INSP_FORMAT(": away for {} [since {}] ({})", awayperiod, awaytime, oper->away->message); @@ -226,7 +226,7 @@ public: auto* loper = IS_LOCAL(oper); if (loper) { - const std::string idleperiod = Duration::ToHuman(ServerInstance->Time() - loper->idle_lastmsg, true); + const std::string idleperiod = Duration::ToLongString(ServerInstance->Time() - loper->idle_lastmsg, true); const std::string idletime = Time::ToString(loper->idle_lastmsg); extra += INSP_FORMAT("{} idle for {} [since {}]", extra.empty() ? ':' : ',', idleperiod, idletime); diff --git a/src/coremods/core_xline/cmd_eline.cpp b/src/coremods/core_xline/cmd_eline.cpp index 61e407ec2..885801141 100644 --- a/src/coremods/core_xline/cmd_eline.cpp +++ b/src/coremods/core_xline/cmd_eline.cpp @@ -83,7 +83,7 @@ CmdResult CommandEline::Handle(User* user, const Params& parameters) else { ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed E-line on {}, expires in {} (on {}): {}", - user->nick, target, Duration::ToHuman(duration), Time::FromNow(duration), el->reason); + user->nick, target, Duration::ToLongString(duration), Time::FromNow(duration), el->reason); } } else diff --git a/src/coremods/core_xline/cmd_gline.cpp b/src/coremods/core_xline/cmd_gline.cpp index 59a393b5e..4201c0dad 100644 --- a/src/coremods/core_xline/cmd_gline.cpp +++ b/src/coremods/core_xline/cmd_gline.cpp @@ -90,7 +90,7 @@ CmdResult CommandGline::Handle(User* user, const Params& parameters) else { ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed G-line on {}, expires in {} (on {}): {}", - user->nick, target, Duration::ToHuman(duration), Time::FromNow(duration), gl->reason); + user->nick, target, Duration::ToLongString(duration), Time::FromNow(duration), gl->reason); } ServerInstance->XLines->ApplyLines(); diff --git a/src/coremods/core_xline/cmd_kline.cpp b/src/coremods/core_xline/cmd_kline.cpp index 68d5e8e62..49609a9d0 100644 --- a/src/coremods/core_xline/cmd_kline.cpp +++ b/src/coremods/core_xline/cmd_kline.cpp @@ -90,7 +90,7 @@ CmdResult CommandKline::Handle(User* user, const Params& parameters) else { ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed K-line on {}, expires in {} (on {}): {}", - user->nick, target, Duration::ToHuman(duration), Time::FromNow(duration), kl->reason); + user->nick, target, Duration::ToLongString(duration), Time::FromNow(duration), kl->reason); } ServerInstance->XLines->ApplyLines(); diff --git a/src/coremods/core_xline/cmd_qline.cpp b/src/coremods/core_xline/cmd_qline.cpp index e8327d702..94a711c97 100644 --- a/src/coremods/core_xline/cmd_qline.cpp +++ b/src/coremods/core_xline/cmd_qline.cpp @@ -72,7 +72,7 @@ CmdResult CommandQline::Handle(User* user, const Params& parameters) else { ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Q-line on {}, expires in {} (on {}): {}", - user->nick, parameters[0], Duration::ToHuman(duration), Time::FromNow(duration), ql->reason); + user->nick, parameters[0], Duration::ToLongString(duration), Time::FromNow(duration), ql->reason); } ServerInstance->XLines->ApplyLines(); } diff --git a/src/coremods/core_xline/cmd_zline.cpp b/src/coremods/core_xline/cmd_zline.cpp index 6bd909932..3ff7d7db7 100644 --- a/src/coremods/core_xline/cmd_zline.cpp +++ b/src/coremods/core_xline/cmd_zline.cpp @@ -89,7 +89,7 @@ CmdResult CommandZline::Handle(User* user, const Params& parameters) else { ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Z-line on {}, expires in {} (on {}): {}", - user->nick, ipaddr, Duration::ToHuman(duration), Time::FromNow(duration), zl->reason); + user->nick, ipaddr, Duration::ToLongString(duration), Time::FromNow(duration), zl->reason); } ServerInstance->XLines->ApplyLines(); } diff --git a/src/helperfuncs.cpp b/src/helperfuncs.cpp index 4f6ccb6f2..3c5f0f399 100644 --- a/src/helperfuncs.cpp +++ b/src/helperfuncs.cpp @@ -504,7 +504,7 @@ std::string Duration::ToString(unsigned long duration) return ret; } -std::string Duration::ToHuman(unsigned long duration, bool brief) +std::string Duration::ToLongString(unsigned long duration, bool brief) { if (duration == 0) return "0 seconds"; diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 68ed5b6ef..fc4c13ede 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -131,13 +131,13 @@ namespace if (timediff > ServerInstance->Config->TimeSkipWarn) { ServerInstance->SNO.WriteToSnoMask('a', "\002Performance warning!\002 Server clock jumped forwards by {} (from {} to {})!", - Duration::ToHuman(timediff), Time::ToString(oldtime), Time::ToString(newtime)); + Duration::ToLongString(timediff), Time::ToString(oldtime), Time::ToString(newtime)); } else if (timediff < -ServerInstance->Config->TimeSkipWarn) { ServerInstance->SNO.WriteToSnoMask('a', "\002Performance warning!\002 Server clock jumped backwards by {} (from {} to {})!", - Duration::ToHuman(std::abs(timediff)), Time::ToString(oldtime), Time::ToString(newtime)); + Duration::ToLongString(std::abs(timediff)), Time::ToString(oldtime), Time::ToString(newtime)); } } diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index 8b1fc0b8b..2e2da3ab2 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -792,7 +792,7 @@ private: else if (certinfo->activation >= ServerInstance->Time()) { certinfo->error = INSP_FORMAT("Certificate not active for {} (on {})", - Duration::ToHuman(certinfo->activation - ServerInstance->Time(), true), + Duration::ToLongString(certinfo->activation - ServerInstance->Time(), true), Time::ToString(certinfo->activation)); } @@ -805,7 +805,7 @@ private: else if (certinfo->expiration <= ServerInstance->Time()) { certinfo->error = INSP_FORMAT("Certificate expired {} ago (on {})", - Duration::ToHuman(ServerInstance->Time() - certinfo->expiration, true), + Duration::ToLongString(ServerInstance->Time() - certinfo->expiration, true), Time::ToString(certinfo->expiration)); } diff --git a/src/modules/extra/m_ssl_openssl.cpp b/src/modules/extra/m_ssl_openssl.cpp index d9fd7b6f5..d3cfa0728 100644 --- a/src/modules/extra/m_ssl_openssl.cpp +++ b/src/modules/extra/m_ssl_openssl.cpp @@ -635,7 +635,7 @@ private: if (activated != -1 && activated != 0) { certinfo->error = INSP_FORMAT("Certificate not active for {} (on {})", - Duration::ToHuman(certinfo->activation - ServerInstance->Time(), true), + Duration::ToLongString(certinfo->activation - ServerInstance->Time(), true), Time::ToString(certinfo->activation)); } @@ -643,7 +643,7 @@ private: if (expired != 0 && expired != 1) { certinfo->error = INSP_FORMAT("Certificate expired {} ago (on {})", - Duration::ToHuman(ServerInstance->Time() - certinfo->expiration, true), + Duration::ToLongString(ServerInstance->Time() - certinfo->expiration, true), Time::ToString(certinfo->expiration)); } diff --git a/src/modules/m_cban.cpp b/src/modules/m_cban.cpp index 210a4ec8c..6c75e507f 100644 --- a/src/modules/m_cban.cpp +++ b/src/modules/m_cban.cpp @@ -142,7 +142,7 @@ public: else { ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed CBan on {}, expires in {} (on {}): {}", - user->nick, parameters[0], Duration::ToHuman(duration), Time::FromNow(duration), r->reason); + user->nick, parameters[0], Duration::ToLongString(duration), Time::FromNow(duration), r->reason); } } else diff --git a/src/modules/m_chanhistory.cpp b/src/modules/m_chanhistory.cpp index c9038c36e..8b306a6c7 100644 --- a/src/modules/m_chanhistory.cpp +++ b/src/modules/m_chanhistory.cpp @@ -283,7 +283,7 @@ public: { auto message = INSP_FORMAT("Replaying up to {} lines of pre-join history", list->maxlen); if (list->maxtime > 0) - message += INSP_FORMAT(" from the last {}", Duration::ToHuman(list->maxtime)); + message += INSP_FORMAT(" from the last {}", Duration::ToLongString(list->maxtime)); memb->WriteNotice(message); } diff --git a/src/modules/m_connectban.cpp b/src/modules/m_connectban.cpp index 4dc0cdcaf..52ed5788f 100644 --- a/src/modules/m_connectban.cpp +++ b/src/modules/m_connectban.cpp @@ -162,7 +162,7 @@ public: } ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Z-line on {}, expires in {} (on {}): {}", - zl->source, maskstr, Duration::ToHuman(zl->duration), + zl->source, maskstr, Duration::ToLongString(zl->duration), Time::ToString(zl->expiry), zl->reason); ServerInstance->SNO.WriteGlobalSno('a', "Connect flooding from IP range {} ({})", maskstr, threshold); connects.erase(i); diff --git a/src/modules/m_dccallow.cpp b/src/modules/m_dccallow.cpp index 8ebc1090a..d69719d67 100644 --- a/src/modules/m_dccallow.cpp +++ b/src/modules/m_dccallow.cpp @@ -325,7 +325,7 @@ public: if (length > 0) { - user->WriteNumeric(RPL_DCCALLOWTIMED, user->nick, INSP_FORMAT("Added {} to DCCALLOW list for {}", target->nick, Duration::ToHuman(length))); + user->WriteNumeric(RPL_DCCALLOWTIMED, user->nick, INSP_FORMAT("Added {} to DCCALLOW list for {}", target->nick, Duration::ToLongString(length))); } else { diff --git a/src/modules/m_delaymsg.cpp b/src/modules/m_delaymsg.cpp index 4408a1654..8b1d6b968 100644 --- a/src/modules/m_delaymsg.cpp +++ b/src/modules/m_delaymsg.cpp @@ -141,7 +141,7 @@ ModResult ModuleDelayMsg::HandleMessage(User* user, const MessageTarget& target) return MOD_RES_PASSTHRU; const std::string message = INSP_FORMAT("You cannot send messages to this channel until you have been a member for {}.", - Duration::ToHuman(len)); + Duration::ToLongString(len)); user->WriteNumeric(Numerics::CannotSendTo(channel, message)); return MOD_RES_DENY; } diff --git a/src/modules/m_dnsbl.cpp b/src/modules/m_dnsbl.cpp index 28dd5f77d..3eb8b5154 100644 --- a/src/modules/m_dnsbl.cpp +++ b/src/modules/m_dnsbl.cpp @@ -295,7 +295,7 @@ private: } ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed {} on {}, expires in {} (on {}): {}", - line->source, type, line->Displayable(), Duration::ToHuman(line->duration), + line->source, type, line->Displayable(), Duration::ToLongString(line->duration), Time::ToString(line->expiry), line->reason); ServerInstance->XLines->ApplyLines(); } diff --git a/src/modules/m_filter.cpp b/src/modules/m_filter.cpp index df750fd7c..b78e1c472 100644 --- a/src/modules/m_filter.cpp +++ b/src/modules/m_filter.cpp @@ -319,7 +319,7 @@ CmdResult CommandFilter::Handle(User* user, const Params& parameters) if (result.first) { const std::string message = INSP_FORMAT("'{}', type '{}'{}, flags '{}', reason: {}", freeform, parameters[1], - (duration ? INSP_FORMAT(", duration '{}'", Duration::ToHuman(duration)) : ""), + (duration ? INSP_FORMAT(", duration '{}'", Duration::ToLongString(duration)) : ""), flags, parameters[reasonindex]); user->WriteNotice("*** Added filter " + message); @@ -472,7 +472,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, MessageTarget& msgtarget, M { auto* sh = new Shun(ServerInstance->Time(), f->duration, MODNAME "@" + ServerInstance->Config->ServerName, f->reason, user->GetAddress()); ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was shunned for {} (expires on {}) because their message to {} matched {} ({})", - user->nick, sh->Displayable(), Duration::ToHuman(f->duration), + user->nick, sh->Displayable(), Duration::ToLongString(f->duration), Time::FromNow(f->duration), msgtarget.GetName(), f->freeform, f->reason); if (ServerInstance->XLines->AddLine(sh, nullptr)) @@ -486,7 +486,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, MessageTarget& msgtarget, M { auto* gl = new GLine(ServerInstance->Time(), f->duration, MODNAME "@" + ServerInstance->Config->ServerName, f->reason, "*", user->GetAddress()); ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was G-lined for {} (expires on {}) because their message to {} matched {} ({})", - user->nick, gl->Displayable(), Duration::ToHuman(f->duration), + user->nick, gl->Displayable(), Duration::ToLongString(f->duration), Time::FromNow(f->duration), msgtarget.GetName(), f->freeform, f->reason); if (ServerInstance->XLines->AddLine(gl, nullptr)) @@ -500,7 +500,7 @@ ModResult ModuleFilter::OnUserPreMessage(User* user, MessageTarget& msgtarget, M { auto* zl = new ZLine(ServerInstance->Time(), f->duration, MODNAME "@" + ServerInstance->Config->ServerName, f->reason, user->GetAddress()); ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was Z-lined for {} (expires on {}) because their message to {} matched {} ({})", - user->nick, zl->Displayable(), Duration::ToHuman(f->duration), + user->nick, zl->Displayable(), Duration::ToLongString(f->duration), Time::FromNow(f->duration), msgtarget.GetName(), f->freeform, f->reason); if (ServerInstance->XLines->AddLine(zl, nullptr)) @@ -578,7 +578,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& auto* gl = new GLine(ServerInstance->Time(), f->duration, MODNAME "@" + ServerInstance->Config->ServerName, f->reason, "*", user->GetAddress()); ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was G-lined for {} (expires on {}) because their {} message matched {} ({})", user->nick, gl->Displayable(), - Duration::ToHuman(f->duration), + Duration::ToLongString(f->duration), Time::FromNow(f->duration), command, f->freeform, f->reason); @@ -594,7 +594,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& auto* zl = new ZLine(ServerInstance->Time(), f->duration, MODNAME "@" + ServerInstance->Config->ServerName, f->reason, user->GetAddress()); ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was Z-lined for {} (expires on {}) because their {} message matched {} ({})", user->nick, zl->Displayable(), - Duration::ToHuman(f->duration), + Duration::ToLongString(f->duration), Time::FromNow(f->duration), command, f->freeform, f->reason); @@ -611,7 +611,7 @@ ModResult ModuleFilter::OnPreCommand(std::string& command, CommandBase::Params& auto* sh = new Shun(ServerInstance->Time(), f->duration, MODNAME "@" + ServerInstance->Config->ServerName, f->reason, user->GetAddress()); ServerInstance->SNO.WriteGlobalSno('f', "{} ({}) was shunned for {} (expires on {}) because their {} message matched {} ({})", user->nick, sh->Displayable(), - Duration::ToHuman(f->duration), + Duration::ToLongString(f->duration), Time::FromNow(f->duration), command, f->freeform, f->reason); @@ -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 {}", Duration::ToHuman(GetInterval())); + ServerInstance->Logs.Debug(MODNAME, "Trying again in {}", Duration::ToLongString(GetInterval())); } } return true; diff --git a/src/modules/m_helpmode.cpp b/src/modules/m_helpmode.cpp index 7083aec48..47bacb311 100644 --- a/src/modules/m_helpmode.cpp +++ b/src/modules/m_helpmode.cpp @@ -102,7 +102,7 @@ public: std::string extra; if (helper->IsAway()) { - const std::string awayperiod = Duration::ToHuman(ServerInstance->Time() - helper->away->time, true); + const std::string awayperiod = Duration::ToLongString(ServerInstance->Time() - helper->away->time, true); const std::string awaytime = Time::ToString(helper->away->time); extra = INSP_FORMAT(": away for {} [since {}] ({})", awayperiod, awaytime, helper->away->message); @@ -111,7 +111,7 @@ public: auto* lhelper = IS_LOCAL(helper); if (lhelper) { - const std::string idleperiod = Duration::ToHuman(ServerInstance->Time() - lhelper->idle_lastmsg, true); + const std::string idleperiod = Duration::ToLongString(ServerInstance->Time() - lhelper->idle_lastmsg, true); const std::string idletime = Time::ToString(lhelper->idle_lastmsg); extra += INSP_FORMAT("{} idle for {} [since {}]", extra.empty() ? ':' : ',', idleperiod, idletime); diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp index ea2143fe7..3abd37143 100644 --- a/src/modules/m_hideoper.cpp +++ b/src/modules/m_hideoper.cpp @@ -157,7 +157,7 @@ public: std::string extra; if (oper->IsAway()) { - const std::string awayperiod = Duration::ToHuman(ServerInstance->Time() - oper->away->time, true); + const std::string awayperiod = Duration::ToLongString(ServerInstance->Time() - oper->away->time, true); const std::string awaytime = Time::ToString(oper->away->time); extra = INSP_FORMAT(": away for {} [since {}] ({})", awayperiod, awaytime, oper->away->message); @@ -166,7 +166,7 @@ public: auto* loper = IS_LOCAL(oper); if (loper) { - const std::string idleperiod = Duration::ToHuman(ServerInstance->Time() - loper->idle_lastmsg, true); + const std::string idleperiod = Duration::ToLongString(ServerInstance->Time() - loper->idle_lastmsg, true); const std::string idletime = Time::ToString(loper->idle_lastmsg); extra += INSP_FORMAT("{} idle for {} [since {}]", extra.empty() ? ':' : ',', idleperiod, idletime); diff --git a/src/modules/m_joinflood.cpp b/src/modules/m_joinflood.cpp index 0c83abefc..95eaaea76 100644 --- a/src/modules/m_joinflood.cpp +++ b/src/modules/m_joinflood.cpp @@ -203,7 +203,7 @@ public: PrefixMode* pm = ServerInstance->Modes.FindNearestPrefixMode(notifyrank); 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); + Duration::ToLongString(duration), f->joins, Duration::ToLongString(f->secs)), pm ? pm->GetPrefix() : 0); } } } diff --git a/src/modules/m_kicknorejoin.cpp b/src/modules/m_kicknorejoin.cpp index e9c75e71b..6b72fd1d2 100644 --- a/src/modules/m_kicknorejoin.cpp +++ b/src/modules/m_kicknorejoin.cpp @@ -145,7 +145,7 @@ public: if ((data) && !invapi->IsInvited(user, chan) && (!data->canjoin(user))) { 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())); + Duration::ToLongString(data->delay), kr.GetModeChar())); return MOD_RES_DENY; } } diff --git a/src/modules/m_nickflood.cpp b/src/modules/m_nickflood.cpp index 9aeb37a6f..45ed5f1cd 100644 --- a/src/modules/m_nickflood.cpp +++ b/src/modules/m_nickflood.cpp @@ -161,7 +161,7 @@ public: if (f->islocked()) { 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))); + memb->chan->name, Duration::ToLongString(duration), f->nicks, Duration::ToLongString(f->secs))); return MOD_RES_DENY; } @@ -170,7 +170,7 @@ public: f->clear(); f->lock(); 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))); + Duration::ToLongString(duration), f->nicks, Duration::ToLongString(f->secs))); return MOD_RES_DENY; } } diff --git a/src/modules/m_permchannels.cpp b/src/modules/m_permchannels.cpp index 30ff20a74..e86019152 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 {}", Duration::ToHuman(GetInterval())); + ServerInstance->Logs.Debug(MODNAME, "Trying again in {}", Duration::ToLongString(GetInterval())); } } return true; diff --git a/src/modules/m_rline.cpp b/src/modules/m_rline.cpp index 19fd1958a..12c4548d4 100644 --- a/src/modules/m_rline.cpp +++ b/src/modules/m_rline.cpp @@ -79,7 +79,7 @@ public: else { ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed Z-line on {}, expires in {} (on {}): {}", - zl->source, u->GetAddress(), Duration::ToHuman(zl->duration), + zl->source, u->GetAddress(), Duration::ToLongString(zl->duration), Time::ToString(zl->duration), zl->reason); } added_zline = true; @@ -182,7 +182,7 @@ public: else { ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed R-line on {}, expires in {} (on {}): {}", - user->nick, parameters[0], Duration::ToHuman(duration), Time::FromNow(duration), r->reason); + user->nick, parameters[0], Duration::ToLongString(duration), Time::FromNow(duration), r->reason); } ServerInstance->XLines->ApplyLines(); diff --git a/src/modules/m_securelist.cpp b/src/modules/m_securelist.cpp index c7cf3834a..958ac995f 100644 --- a/src/modules/m_securelist.cpp +++ b/src/modules/m_securelist.cpp @@ -122,7 +122,7 @@ public: { user->WriteNotice("*** You cannot view the channel list right now. Please {}try again in {}.", exemptregistered ? "log in to an account or " : "", - Duration::ToHuman(maxwaittime - ServerInstance->Time())); + Duration::ToLongString(maxwaittime - ServerInstance->Time())); } else { diff --git a/src/modules/m_setidle.cpp b/src/modules/m_setidle.cpp index d0ef8f418..2aa6f6608 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 {}", user->nick, Duration::ToHuman(idle)); + ServerInstance->SNO.WriteToSnoMask('a', "{} used SETIDLE to set their idle time to {}", user->nick, Duration::ToLongString(idle)); noterpl.SendIfCap(user, stdrplcap, this, "IDLE_TIME_SET", user->idle_lastmsg, "Idle time set."); return CmdResult::SUCCESS; } diff --git a/src/modules/m_shun.cpp b/src/modules/m_shun.cpp index 7200483f4..59b2b8b3a 100644 --- a/src/modules/m_shun.cpp +++ b/src/modules/m_shun.cpp @@ -128,7 +128,7 @@ public: else { ServerInstance->SNO.WriteToSnoMask('x', "{} added a timed SHUN on {}, expires in {} (on {}): {}", - user->nick, target, Duration::ToHuman(duration), + user->nick, target, Duration::ToLongString(duration), Time::FromNow(duration), expr); } } diff --git a/src/modules/m_spanningtree/addline.cpp b/src/modules/m_spanningtree/addline.cpp index 2b16dff23..eff11b12b 100644 --- a/src/modules/m_spanningtree/addline.cpp +++ b/src/modules/m_spanningtree/addline.cpp @@ -59,7 +59,7 @@ CmdResult CommandAddLine::Handle(User* usr, Params& params) { ServerInstance->SNO.WriteToSnoMask('X', "{} added a timed {}{} on {}, expires in {} (on {}): {}", setter, params[0], params[0].length() <= 2 ? "-line" : "", - params[1], Duration::ToHuman(xl->duration), + params[1], Duration::ToLongString(xl->duration), Time::ToString(xl->expiry), params[5]); } else diff --git a/src/modules/m_spanningtree/main.cpp b/src/modules/m_spanningtree/main.cpp index cf91fa7ec..aa1ad4e52 100644 --- a/src/modules/m_spanningtree/main.cpp +++ b/src/modules/m_spanningtree/main.cpp @@ -304,7 +304,7 @@ 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 {})", - p.first, Duration::ToHuman(p.second)); + p.first, Duration::ToLongString(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 a6d193bfb..8d7ee6866 100644 --- a/src/modules/m_spanningtree/pingtimer.cpp +++ b/src/modules/m_spanningtree/pingtimer.cpp @@ -50,7 +50,7 @@ PingTimer::State PingTimer::TickInternal() { // No pong arrived in PingWarnTime seconds, send a warning to opers ServerInstance->SNO.WriteToSnoMask('l', "Server \002{}\002 has not responded to PING for {}, high latency.", - server->GetName(), Duration::ToHuman(GetInterval())); + server->GetName(), Duration::ToLongString(GetInterval())); return PS_TIMEOUT; } else // PS_TIMEOUT diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index e8fa38a54..46ef73f70 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 {} (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))); + 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::ToLongString(delta)); + SendError(INSP_FORMAT("Your clocks are out by {} (this is more than fifteen seconds). Link aborted, PLEASE SYNC YOUR CLOCKS!", Duration::ToLongString(delta))); return; } else if (delta > 5) { - ServerInstance->SNO.WriteGlobalSno('l', "\002WARNING\002: Your clocks are off by {}. Please consider syncing your clocks.", Duration::ToHuman(delta)); + ServerInstance->SNO.WriteGlobalSno('l', "\002WARNING\002: Your clocks are off by {}. Please consider syncing your clocks.", Duration::ToLongString(delta)); } } @@ -436,7 +436,7 @@ void TreeSocket::Close() time_t server_uptime = ServerInstance->Time() - this->age; if (server_uptime) { - std::string timestr = Duration::ToHuman(server_uptime); + std::string timestr = Duration::ToLongString(server_uptime); ServerInstance->SNO.WriteGlobalSno('l', "Connection to '\002{}\002' was established for {}", linkID, timestr); } } diff --git a/src/modules/m_sslinfo.cpp b/src/modules/m_sslinfo.cpp index 77bf87096..59a8c4281 100644 --- a/src/modules/m_sslinfo.cpp +++ b/src/modules/m_sslinfo.cpp @@ -458,7 +458,7 @@ public: } else if (static_cast<time_t>(ServerInstance->Time() + warnexpiring) > cert->GetExpirationTime()) { - const std::string duration = Duration::ToHuman(cert->GetExpirationTime() - ServerInstance->Time()); + const std::string duration = Duration::ToLongString(cert->GetExpirationTime() - ServerInstance->Time()); user->WriteNotice("*** Your TLS client certificate expires in " + duration + "."); } } diff --git a/src/modules/m_timedbans.cpp b/src/modules/m_timedbans.cpp index b7e2727ba..2d875c4be 100644 --- a/src/modules/m_timedbans.cpp +++ b/src/modules/m_timedbans.cpp @@ -152,7 +152,7 @@ public: if (sendnotice) { const std::string message = INSP_FORMAT("Timed ban {} added by {} on {} lasting for {}.", - mask, user->nick, channel->name, Duration::ToHuman(duration)); + mask, user->nick, channel->name, Duration::ToLongString(duration)); // If halfop is loaded, send notice to halfops and above, otherwise send to ops and above PrefixMode* mh = ServerInstance->Modes.FindNearestPrefixMode(HALFOP_VALUE); diff --git a/src/modules/m_xline_db.cpp b/src/modules/m_xline_db.cpp index ad18df5a8..107efde0e 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 {}", Duration::ToHuman(GetInterval())); + ServerInstance->Logs.Debug(MODNAME, "Trying again in {}", Duration::ToLongString(GetInterval())); } } return true; @@ -252,7 +252,7 @@ public: { ServerInstance->SNO.WriteToSnoMask('x', "database: added a timed {}{} on {}, expires in {} (on {}): {}", xl->type, xl->type.length() <= 2 ? "-line" : "", xl->Displayable(), - Duration::ToHuman(xl->duration), Time::FromNow(xl->duration), xl->reason); + Duration::ToLongString(xl->duration), Time::FromNow(xl->duration), xl->reason); } else { diff --git a/src/usermanager.cpp b/src/usermanager.cpp index 1bdf21ec0..3b3e743e6 100644 --- a/src/usermanager.cpp +++ b/src/usermanager.cpp @@ -66,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: {}", Duration::ToHuman(secs)); + const std::string message = INSP_FORMAT("Ping timeout: {}", Duration::ToLongString(secs)); ServerInstance->Users.QuitUser(user, message); return; } diff --git a/src/xline.cpp b/src/xline.cpp index d83617dae..d39a1c97e 100644 --- a/src/xline.cpp +++ b/src/xline.cpp @@ -707,7 +707,7 @@ void XLine::DisplayExpiry() { ServerInstance->SNO.WriteToSnoMask('x', "Removing an expired {}{} on {} (set by {} {} ago): {}", type, (type.length() <= 2 ? "-line" : ""), Displayable(), source, - Duration::ToHuman(ServerInstance->Time() - set_time), reason); + Duration::ToLongString(ServerInstance->Time() - set_time), reason); } const std::string& ELine::Displayable() const |
