From c3055e1cfa112c7deecc434ce01b928fd8736c70 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 22 Nov 2024 15:22:23 +0000 Subject: Add a plural form overload of SendMessage. --- src/users.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src') diff --git a/src/users.cpp b/src/users.cpp index 5f83420a4..55bfde478 100644 --- a/src/users.cpp +++ b/src/users.cpp @@ -328,6 +328,21 @@ void User::SendMessage(BotInfo *source, const char *fmt, ...) va_end(args); } +void User::SendMessage(BotInfo *source, int count, const char *singular, const char *plural, ...) +{ + va_list args; + char buf[BUFSIZE] = ""; + + const char *translated_message = Language::Translate(this, count, singular, plural); + + va_start(args, plural); + vsnprintf(buf, BUFSIZE - 1, translated_message, args); + + this->SendMessage(source, Anope::string(buf)); + + va_end(args); +} + namespace { void SendMessageInternal(BotInfo *source, User *target, const Anope::string &msg, const Anope::map &tags) -- cgit