diff options
author | Sadie Powell <sadie@witchery.services> | 2024-11-22 15:22:23 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-11-22 15:22:23 +0000 |
commit | c3055e1cfa112c7deecc434ce01b928fd8736c70 (patch) | |
tree | 623b3aca08009949178c7457555994a0de00254f /src | |
parent | a27be92e4b406e4bee8a0d56bda00eae335c80a5 (diff) |
Add a plural form overload of SendMessage.
Diffstat (limited to 'src')
-rw-r--r-- | src/users.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
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<Anope::string> &tags) |