1
0
mirror of https://github.com/anope/anope.git synced 2026-06-25 17:26:37 +02:00

Translate whole messages before splitting them up to send to users

This commit is contained in:
Adam
2011-09-03 14:39:12 -04:00
parent 30e6fc07d6
commit 3815e7d61e
2 changed files with 9 additions and 9 deletions
+5 -4
View File
@@ -233,20 +233,21 @@ void User::SendMessage(BotInfo *source, const char *fmt, ...)
void User::SendMessage(BotInfo *source, Anope::string msg)
{
const char *translated_message = translate(this, msg.c_str());
/* Send privmsg instead of notice if:
* - UsePrivmsg is enabled
* - The user is not registered and NSDefMsg is enabled
* - The user is registered and has set /ns set msg on
*/
sepstream sep(msg, '\n');
sepstream sep(translated_message, '\n');
Anope::string tok;
while (sep.GetToken(tok))
{
const char *translated_message = translate(this, tok.c_str());
if (Config->UsePrivmsg && ((!this->nc && Config->NSDefFlags.HasFlag(NI_MSG)) || (this->nc && this->nc->HasFlag(NI_MSG))))
ircdproto->SendPrivmsg(source, this->nick, "%s", translated_message);
ircdproto->SendPrivmsg(source, this->nick, "%s", tok.c_str());
else
ircdproto->SendNotice(source, this->nick, "%s", translated_message);
ircdproto->SendNotice(source, this->nick, "%s", tok.c_str());
}
}