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

Add a plural form overload of SendMessage.

This commit is contained in:
Sadie Powell
2024-11-22 15:22:23 +00:00
parent a27be92e4b
commit c3055e1cfa
4 changed files with 21 additions and 6 deletions
+15
View File
@@ -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)