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

Changed the language system to use gettext

This commit is contained in:
Adam
2010-09-26 02:33:01 -04:00
parent 05e6815d91
commit d646d455e2
239 changed files with 168730 additions and 90259 deletions
+28 -2
View File
@@ -11,7 +11,6 @@
#include "services.h"
#include "modules.h"
#include "language.h"
/* Hash maps used for users. Note UserListByUID will not be used on non-TS6 IRCds, and should never
* be assumed to have users
@@ -244,6 +243,33 @@ void User::SendMessage(const Anope::string &source, const Anope::string &msg) co
ircdproto->SendNotice(findbot(source), this->nick, "%s", msg.c_str());
}
void User::SendMessage(BotInfo *source, LanguageString message, ...) const
{
Anope::string m = GetString(this, message);
if (Config->UseStrictPrivMsg)
m = m.replace_all_cs("%R", "/");
else
m = m.replace_all_cs("%R", "/msg ");
m = m.replace_all_cs("%S", source->nick);
if (m.length() >= 4096)
Log() << "Warning, language string " << message << " is longer than 4096 bytes";
va_list args;
char buf[4096];
va_start(args, message);
vsnprintf(buf, sizeof(buf) - 1, m.c_str(), args);
va_end(args);
sepstream sep(buf, '\n');
Anope::string line;
while (sep.GetToken(line))
this->SendMessage(source->nick, line.empty() ? " " : line);
}
/** Collides a nick.
*
* First, it marks the nick (if the user is on a registered nick, we don't use it without but it could be)
@@ -314,7 +340,7 @@ void User::Collide(NickAlias *na)
guestnick = Config->NSGuestNickPrefix + stringify(getrandom16());
} while (finduser(guestnick));
notice_lang(Config->s_NickServ, this, FORCENICKCHANGE_CHANGING, guestnick.c_str());
this->SendMessage(NickServ, FORCENICKCHANGE_CHANGING, guestnick.c_str());
ircdproto->SendForceNickChange(this, guestnick, Anope::CurTime);
}
else