1
0
mirror of https://github.com/anope/anope.git synced 2026-06-25 10:16:39 +02:00

Add a protocol module function for extracting timestamps.

This commit is contained in:
Sadie Powell
2024-03-12 00:14:13 +00:00
parent 1538909ac0
commit 04e1a4f5c8
9 changed files with 44 additions and 31 deletions
+8
View File
@@ -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);