From 4de59d61d8f593c18630b46270f48e32e4549ec0 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Wed, 13 Nov 2024 11:44:03 +0000 Subject: Use durations instead of seconds in waiting messages. --- modules/memoserv/ms_rsend.cpp | 6 +++++- modules/memoserv/ms_send.cpp | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'modules/memoserv') diff --git a/modules/memoserv/ms_rsend.cpp b/modules/memoserv/ms_rsend.cpp index b94910d28..0002a0a88 100644 --- a/modules/memoserv/ms_rsend.cpp +++ b/modules/memoserv/ms_rsend.cpp @@ -56,7 +56,11 @@ public: if (result == MemoServService::MEMO_INVALID_TARGET) source.Reply(_("\002%s\002 is not a registered unforbidden nick or channel."), nick.c_str()); else if (result == MemoServService::MEMO_TOO_FAST) - source.Reply(_("Please wait %lu seconds before using the %s command again."), Config->GetModule("memoserv")->Get("senddelay"), source.command.c_str()); + { + auto lastmemosend = source.GetUser() ? source.GetUser()->lastmemosend : 0; + auto waitperiod = (lastmemosend + Config->GetModule("memoserv")->Get("senddelay")) - Anope::CurTime; + source.Reply(_("Please wait %s before using the %s command again."), Anope::Duration(waitperiod, source.GetAccount()).c_str(), source.command.c_str()); + } else if (result == MemoServService::MEMO_TARGET_FULL) source.Reply(_("Sorry, %s currently has too many memos and cannot receive more."), nick.c_str()); else diff --git a/modules/memoserv/ms_send.cpp b/modules/memoserv/ms_send.cpp index 6805bde7b..85e9acffc 100644 --- a/modules/memoserv/ms_send.cpp +++ b/modules/memoserv/ms_send.cpp @@ -55,7 +55,11 @@ public: else if (result == MemoServService::MEMO_INVALID_TARGET) source.Reply(_("\002%s\002 is not a registered unforbidden nick or channel."), nick.c_str()); else if (result == MemoServService::MEMO_TOO_FAST) - source.Reply(_("Please wait %lu seconds before using the %s command again."), Config->GetModule("memoserv")->Get("senddelay"), source.command.c_str()); + { + auto lastmemosend = source.GetUser() ? source.GetUser()->lastmemosend : 0; + auto waitperiod = (lastmemosend + Config->GetModule("memoserv")->Get("senddelay")) - Anope::CurTime; + source.Reply(_("Please wait %s before using the %s command again."), Anope::Duration(waitperiod, source.GetAccount()).c_str(), source.command.c_str()); + } else if (result == MemoServService::MEMO_TARGET_FULL) source.Reply(_("Sorry, %s currently has too many memos and cannot receive more."), nick.c_str()); } -- cgit