1
0
mirror of https://github.com/anope/anope.git synced 2026-06-26 14:56:39 +02:00

Improve how Anope formats C strings.

This commit is contained in:
Sadie Powell
2025-08-02 18:09:31 +01:00
parent e6e812c43c
commit b2d40d4189
40 changed files with 157 additions and 183 deletions
+4 -16
View File
@@ -105,32 +105,20 @@ bool CommandSource::IsOper()
void CommandSource::Reply(const char *message, ...)
{
va_list args;
char buf[4096]; // Messages can be really big.
const char *translated_message = Language::Translate(this->nc, message);
va_start(args, message);
vsnprintf(buf, sizeof(buf), translated_message, args);
Anope::string buf;
ANOPE_FORMAT(message, translated_message, buf);
this->reply->SendMessage(*this, buf);
va_end(args);
}
void CommandSource::Reply(int count, const char *single, const char *plural, ...)
{
va_list args;
char buf[4096]; // Messages can be really big.
const char *translated_message = Language::Translate(this->nc, count, single, plural);
va_start(args, plural);
vsnprintf(buf, sizeof(buf), translated_message, args);
Anope::string buf;
ANOPE_FORMAT(plural, translated_message, buf);
this->reply->SendMessage(*this, buf);
va_end(args);
}
void CommandSource::Reply(const Anope::string &message)