summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-03-12 00:14:13 +0000
committerSadie Powell <sadie@witchery.services>2024-03-12 11:02:08 +0000
commit04e1a4f5c8c4172ca36dd79dfd0731f4aba873a5 (patch)
tree52caf9828c7fdb497c323b32e00b68b566db325a /src
parent1538909ac09a0e84269e36a08da5ae9fce92e8f3 (diff)
Add a protocol module function for extracting timestamps.
Diffstat (limited to 'src')
-rw-r--r--src/protocol.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/protocol.cpp b/src/protocol.cpp
index 5699a2d48..55603c8e7 100644
--- a/src/protocol.cpp
+++ b/src/protocol.cpp
@@ -86,6 +86,14 @@ Anope::string IRCDProto::SID_Retrieve()
return current_sid;
}
+time_t IRCDProto::ExtractTimestamp(const Anope::string &str)
+{
+ auto ts = Anope::TryConvert<time_t>(str);
+ if (!ts.has_value())
+ throw ProtocolException("Invalid timestamp: " + str);
+ return ts.value();
+}
+
void IRCDProto::SendError(const Anope::string &reason)
{
Uplink::Send("ERROR", reason);