aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Sadie Powell2025-03-18 14:16:23 +0000
committerGravatar Sadie Powell2025-03-18 14:18:18 +0000
commit627f8d1403a8fad13c0558203f99bdb9fbbac574 (patch)
treeee45fbe52129ccb636c26f22dc232b44a4e90974
parentRename ToHuman to ToLongString. (diff)
Allow using the long duration format in the xline message.
-rw-r--r--docs/conf/inspircd.example.conf40
-rw-r--r--src/xline.cpp18
2 files changed, 32 insertions, 26 deletions
diff --git a/docs/conf/inspircd.example.conf b/docs/conf/inspircd.example.conf
index 4a0e2fb46..93b426a21 100644
--- a/docs/conf/inspircd.example.conf
+++ b/docs/conf/inspircd.example.conf
@@ -654,15 +654,17 @@
# xlinequit: The quit message to show to opers and affected users when
# a user is [KGZ]-lined. The variables you can use in this are:
#
- # %created% - The date/time at which the X-line was created.
- # %duration% - The duration of the X-line.
- # %expiry% - The date/time at which the X-line expires.
- # %fulltype% - The type of X-line which was matched, suffixed with
- # "-lined" if its name is one or two characters.
- # %reason% - The reason the X-line was added.
- # %remaining% - The duration remaining on the X-line.
- # %setter% - The name of the X-line setter.
- # %type% - The type of X-line which was matched.
+ # %created% - The date/time at which the X-line was created.
+ # %duration% - The duration of the X-line.
+ # %duration.long% - The long duration of the X-line.
+ # %expiry% - The date/time at which the X-line expires.
+ # %fulltype% - The type of X-line which was matched, suffixed with
+ # "-lined" if its name is one or two characters.
+ # %reason% - The reason the X-line was added.
+ # %remaining% - The duration remaining on the X-line.
+ # %remaining.long% - The long duration remaining on the X-line.
+ # %setter% - The name of the X-line setter.
+ # %type% - The type of X-line which was matched.
xlinequit="%fulltype%: %reason%"
# modesinlist: Whether to show the current channel modes in the /LIST
@@ -801,15 +803,17 @@
# publicxlinequit: The quit message to show to unprivileged users when
# a user is [KGZ]-lined. The variables you can use in this are:
#
- # %created% - The date/time at which the X-line was created.
- # %duration% - The duration of the X-line.
- # %expiry% - The date/time at which the X-line expires.
- # %fulltype% - The type of X-line which was matched, suffixed with
- # "-lined" if its name is one or two characters.
- # %reason% - The reason the X-line was added.
- # %remaining% - The duration remaining on the X-line.
- # %setter% - The name of the X-line setter.
- # %type% - The type of X-line which was matched.
+ # %created% - The date/time at which the X-line was created.
+ # %duration% - The duration of the X-line.
+ # %duration.long% - The long duration of the X-line.
+ # %expiry% - The date/time at which the X-line expires.
+ # %fulltype% - The type of X-line which was matched, suffixed with
+ # "-lined" if its name is one or two characters.
+ # %reason% - The reason the X-line was added.
+ # %remaining% - The duration remaining on the X-line.
+ # %remaining.long% - The long duration remaining on the X-line.
+ # %setter% - The name of the X-line setter.
+ # %type% - The type of X-line which was matched.
#publicxlinequit="%fulltype%"
# hidekills: If defined, replaces who executed a /KILL with a custom string.
diff --git a/src/xline.cpp b/src/xline.cpp
index d39a1c97e..e48d1010b 100644
--- a/src/xline.cpp
+++ b/src/xline.cpp
@@ -556,14 +556,16 @@ void XLine::DefaultApply(User* u, bool bancache)
u->WriteNumeric(ERR_YOUREBANNEDCREEP, ServerInstance->Config->XLineMessage);
Template::VariableMap vars = {
- { "created", Time::ToString(set_time) },
- { "duration", Duration::ToString(duration) },
- { "expiry", Time::ToString(expiry) },
- { "fulltype", type.length() <= 2 ? type + "-lined" : type },
- { "reason", reason },
- { "remaining", Duration::ToString(ServerInstance->Time() - expiry) },
- { "setter", source },
- { "type", type },
+ { "created", Time::ToString(set_time) },
+ { "duration", Duration::ToString(duration) },
+ { "duration.long", Duration::ToLongString(duration) },
+ { "expiry", Time::ToString(expiry) },
+ { "fulltype", type.length() <= 2 ? type + "-lined" : type },
+ { "reason", reason },
+ { "remaining", Duration::ToString(ServerInstance->Time() - expiry) },
+ { "remaining.long", Duration::ToLongString(ServerInstance->Time() - expiry) },
+ { "setter", source },
+ { "type", type },
};
const std::string banreason = Template::Replace(ServerInstance->Config->XLineQuit, vars);