summaryrefslogtreecommitdiff
path: root/modules/core
diff options
context:
space:
mode:
Diffstat (limited to 'modules/core')
-rw-r--r--modules/core/bs_kick.cpp4
-rw-r--r--modules/core/bs_main.cpp12
-rw-r--r--modules/core/cs_access.cpp2
-rw-r--r--modules/core/cs_main.cpp15
-rw-r--r--modules/core/cs_suspend.cpp2
-rw-r--r--modules/core/ms_main.cpp10
-rw-r--r--modules/core/ms_read.cpp2
-rw-r--r--modules/core/ns_help.cpp2
-rw-r--r--modules/core/ns_main.cpp10
-rw-r--r--modules/core/ns_recover.cpp4
-rw-r--r--modules/core/ns_resetpass.cpp6
-rw-r--r--modules/core/ns_sendpass.cpp6
-rw-r--r--modules/core/ns_set_language.cpp6
-rw-r--r--modules/core/os_main.cpp4
14 files changed, 32 insertions, 53 deletions
diff --git a/modules/core/bs_kick.cpp b/modules/core/bs_kick.cpp
index 66232f10c..3e6719338 100644
--- a/modules/core/bs_kick.cpp
+++ b/modules/core/bs_kick.cpp
@@ -616,10 +616,8 @@ class BSKick : public Module
if (!ci || !ci->bi || !ci->c || !u || u->server->IsULined())
return;
- Anope::string fmt = GetString(u->Account(), message);
+ Anope::string fmt = translate(u, message);
va_start(args, message);
- if (fmt.empty())
- return;
vsnprintf(buf, sizeof(buf), fmt.c_str(), args);
va_end(args);
diff --git a/modules/core/bs_main.cpp b/modules/core/bs_main.cpp
index 442d522db..e325b012f 100644
--- a/modules/core/bs_main.cpp
+++ b/modules/core/bs_main.cpp
@@ -24,8 +24,6 @@ class BotServBotInfo : public BotInfo
void OnMessage(User *u, const Anope::string &message)
{
- PushLanguage("anope", u->Account() ? u->Account()->language : "");
-
spacesepstream sep(message);
Anope::string command, param;
if (sep.GetToken(command) && sep.GetToken(param))
@@ -40,30 +38,26 @@ class BotServBotInfo : public BotInfo
{
if (ci->HasFlag(CI_SUSPENDED) && !c->HasFlag(CFLAG_ALLOW_SUSPENDED))
{
- u->SendMessage(this, _(_(CHAN_X_SUSPENDED)), ci->name.c_str());
+ u->SendMessage(this, CHAN_X_SUSPENDED, ci->name.c_str());
Log(LOG_COMMAND, "denied", this) << "Access denied for user " << u->GetMask() << " with command " << command << " because of SUSPENDED channel " << ci->name;
- PopLanguage();
return;
}
}
else if (!c->HasFlag(CFLAG_ALLOW_UNREGISTEREDCHANNEL))
{
- u->SendMessage(this, _(_(CHAN_X_NOT_REGISTERED)), param.c_str());
- PopLanguage();
+ u->SendMessage(this, CHAN_X_NOT_REGISTERED, param.c_str());
return;
}
}
/* A user not giving a channel name for a param that should be a channel */
else
{
- u->SendMessage(this, _(CHAN_X_INVALID), param.c_str());
- PopLanguage();
+ u->SendMessage(this, CHAN_X_INVALID, param.c_str());
return;
}
}
}
- PopLanguage();
BotInfo::OnMessage(u, message);
}
};
diff --git a/modules/core/cs_access.cpp b/modules/core/cs_access.cpp
index 23d8c4e16..7d39b2ce5 100644
--- a/modules/core/cs_access.cpp
+++ b/modules/core/cs_access.cpp
@@ -716,7 +716,7 @@ class CommandCSLevels : public Command
levelinfo_maxwidth = len;
}
for (i = 0; levelinfo[i].what >= 0; ++i)
- source.Reply(_(" %-*s %s"), levelinfo_maxwidth, levelinfo[i].name.c_str(), GetString(source.u->Account(), levelinfo[i].desc).c_str());
+ source.Reply(_(" %-*s %s"), levelinfo_maxwidth, levelinfo[i].name.c_str(), translate(source.u, levelinfo[i].desc));
}
else
source.Reply(_("Syntax: \002LEVELS \037channel\037 SET \037type\037 \037level\037\002\n"
diff --git a/modules/core/cs_main.cpp b/modules/core/cs_main.cpp
index 9d1664afb..49d1c800b 100644
--- a/modules/core/cs_main.cpp
+++ b/modules/core/cs_main.cpp
@@ -23,12 +23,9 @@ class ChanServBotInfo : public BotInfo
void OnMessage(User *u, const Anope::string &message)
{
- PushLanguage("anope", u->Account() ? u->Account()->language : "");
-
if (!u->HasMode(UMODE_OPER) && Config->CSOpersOnly)
{
- u->SendMessage(ChanServ, _(ACCESS_DENIED));
- PopLanguage();
+ u->SendMessage(ChanServ, ACCESS_DENIED);
return;
}
@@ -46,30 +43,26 @@ class ChanServBotInfo : public BotInfo
{
if (ci->HasFlag(CI_SUSPENDED) && !c->HasFlag(CFLAG_ALLOW_SUSPENDED))
{
- u->SendMessage(this, _(_(CHAN_X_SUSPENDED)), ci->name.c_str());
+ u->SendMessage(this, CHAN_X_SUSPENDED, ci->name.c_str());
Log(LOG_COMMAND, "denied", this) << "Access denied for user " << u->GetMask() << " with command " << command << " because of SUSPENDED channel " << ci->name;
- PopLanguage();
return;
}
}
else if (!c->HasFlag(CFLAG_ALLOW_UNREGISTEREDCHANNEL))
{
- u->SendMessage(this, _(CHAN_X_NOT_REGISTERED), param.c_str());
- PopLanguage();
+ u->SendMessage(this, CHAN_X_NOT_REGISTERED, param.c_str());
return;
}
}
/* A user not giving a channel name for a param that should be a channel */
else
{
- u->SendMessage(this, _(CHAN_X_INVALID), param.c_str());
- PopLanguage();
+ u->SendMessage(this, CHAN_X_INVALID, param.c_str());
return;
}
}
}
- PopLanguage();
BotInfo::OnMessage(u, message);
}
};
diff --git a/modules/core/cs_suspend.cpp b/modules/core/cs_suspend.cpp
index 32d75bbeb..a027bc173 100644
--- a/modules/core/cs_suspend.cpp
+++ b/modules/core/cs_suspend.cpp
@@ -54,7 +54,7 @@ class CommandCSSuspend : public Command
if (uc->user->HasMode(UMODE_OPER))
continue;
- c->Kick(NULL, uc->user, "%s", !reason.empty() ? reason.c_str() : GetString(uc->user->Account(), gtl("This channel has been suspended.")).c_str());
+ c->Kick(NULL, uc->user, "%s", !reason.empty() ? reason.c_str() : translate(uc->user, _("This channel has been suspended.")));
}
}
diff --git a/modules/core/ms_main.cpp b/modules/core/ms_main.cpp
index c2933254c..487059413 100644
--- a/modules/core/ms_main.cpp
+++ b/modules/core/ms_main.cpp
@@ -17,16 +17,16 @@
static BotInfo *MemoServ = NULL;
static bool SendMemoMail(NickCore *nc, MemoInfo *mi, Memo *m)
{
- Anope::string message = Anope::printf(GetString(nc, gtl(
+ Anope::string message = Anope::printf(translate(nc, _(
"Hi %s\n"
" \n"
"You've just received a new memo from %s. This is memo number %d.\n"
" \n"
"Memo text:\n"
" \n"
- "%s")).c_str(), nc->display.c_str(), m->sender.c_str(), mi->GetIndex(m), m->text.c_str());
+ "%s")), nc->display.c_str(), m->sender.c_str(), mi->GetIndex(m), m->text.c_str());
- return Mail(nc, GetString(nc, gtl("New memo")), message);
+ return Mail(nc, translate(nc, _("New memo")), message);
}
class MyMemoServService : public MemoServService
@@ -105,7 +105,7 @@ class MyMemoServService : public MemoServService
if (check_access(cu->user, ci, CA_MEMO))
{
if (cu->user->Account() && cu->user->Account()->HasFlag(NI_MEMO_RECEIVE))
- cu->user->SendMessage(MemoServ, _(MEMO_NEW_X_MEMO_ARRIVED), ci->name.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->s_MemoServ.c_str(), ci->name.c_str(), mi->memos.size());
+ cu->user->SendMessage(MemoServ, MEMO_NEW_X_MEMO_ARRIVED, ci->name.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->s_MemoServ.c_str(), ci->name.c_str(), mi->memos.size());
}
}
}
@@ -121,7 +121,7 @@ class MyMemoServService : public MemoServService
NickAlias *na = *it;
User *user = finduser(na->nick);
if (user && user->IsIdentified())
- user->SendMessage(MemoServ, _(MEMO_NEW_MEMO_ARRIVED), source.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->s_MemoServ.c_str(), mi->memos.size());
+ user->SendMessage(MemoServ, MEMO_NEW_MEMO_ARRIVED, source.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->s_MemoServ.c_str(), mi->memos.size());
}
}
diff --git a/modules/core/ms_read.cpp b/modules/core/ms_read.cpp
index 706906be4..a868b5c88 100644
--- a/modules/core/ms_read.cpp
+++ b/modules/core/ms_read.cpp
@@ -33,7 +33,7 @@ void rsend_notify(CommandSource &source, MemoInfo *mi, Memo *m, const Anope::str
/* Text of the memo varies if the recepient was a
nick or channel */
- Anope::string text = Anope::printf(GetString(na->nc, gtl("\002[auto-memo]\002 The memo you sent to %s has been viewed.")).c_str(), targ.c_str());
+ Anope::string text = Anope::printf(translate(na->nc, _("\002[auto-memo]\002 The memo you sent to %s has been viewed.")), targ.c_str());
/* Send notification */
memoserv->Send(source.u->nick, m->sender, text, true);
diff --git a/modules/core/ns_help.cpp b/modules/core/ns_help.cpp
index 29a6bd1cd..77c1b6f69 100644
--- a/modules/core/ns_help.cpp
+++ b/modules/core/ns_help.cpp
@@ -37,7 +37,7 @@ class CommandNSHelp : public Command
"commands allow for registration and maintenance of\n"
"nicknames; to use them, type \002%s%s \037command\037\002.\n"
"For more information on a specific command, type\n"
- "\002%s%s HELP \037command\037\002."), Config->UseStrictPrivMsgString.c_str(), Config->s_NickServ.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->s_NickServ.c_str(), Config->s_NickServ.c_str());
+ "\002%s%s HELP \037command\037\002."), Config->s_NickServ.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->s_NickServ.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->s_NickServ.c_str());
for (CommandMap::const_iterator it = nickserv->Bot()->Commands.begin(), it_end = nickserv->Bot()->Commands.end(); it != it_end; ++it)
if (!Config->HidePrivilegedCommands || it->second->permission.empty() || u->HasCommand(it->second->permission))
it->second->OnServHelp(source);
diff --git a/modules/core/ns_main.cpp b/modules/core/ns_main.cpp
index 8d50f7042..f4797fa29 100644
--- a/modules/core/ns_main.cpp
+++ b/modules/core/ns_main.cpp
@@ -34,14 +34,14 @@ class MyNickServService : public NickServService
if (na->nc->HasFlag(NI_SUSPENDED))
{
- u->SendMessage(NickServ, _(NICK_X_SUSPENDED), u->nick.c_str());
+ u->SendMessage(NickServ, NICK_X_SUSPENDED, u->nick.c_str());
u->Collide(na);
return;
}
if (!u->IsIdentified() && !u->fingerprint.empty() && na->nc->FindCert(u->fingerprint))
{
- u->SendMessage(NickServ, _("SSL Fingerprint accepted, you are now identified"));
+ u->SendMessage(NickServ, _("SSL Fingerprint accepted, you are now identified."));
u->Identify(na);
return;
}
@@ -58,16 +58,16 @@ class MyNickServService : public NickServService
if (u->IsRecognized() || !na->nc->HasFlag(NI_KILL_IMMED))
{
if (na->nc->HasFlag(NI_SECURE))
- u->SendMessage(NickServ, _(NICK_IS_SECURE), Config->UseStrictPrivMsgString.c_str(), Config->s_NickServ.c_str());
+ u->SendMessage(NickServ, NICK_IS_SECURE, Config->UseStrictPrivMsgString.c_str(), Config->s_NickServ.c_str());
else
- u->SendMessage(NickServ, _(NICK_IS_REGISTERED), Config->UseStrictPrivMsgString.c_str(), Config->s_NickServ.c_str());
+ u->SendMessage(NickServ, NICK_IS_REGISTERED, Config->UseStrictPrivMsgString.c_str(), Config->s_NickServ.c_str());
}
if (na->nc->HasFlag(NI_KILLPROTECT) && !u->IsRecognized())
{
if (na->nc->HasFlag(NI_KILL_IMMED))
{
- u->SendMessage(NickServ, _(FORCENICKCHANGE_NOW));
+ u->SendMessage(NickServ, FORCENICKCHANGE_NOW);
u->Collide(na);
}
else if (na->nc->HasFlag(NI_KILL_QUICK))
diff --git a/modules/core/ns_recover.cpp b/modules/core/ns_recover.cpp
index bbac98e09..b6a8e1c5d 100644
--- a/modules/core/ns_recover.cpp
+++ b/modules/core/ns_recover.cpp
@@ -49,7 +49,7 @@ class CommandNSRecover : public Command
if (MOD_RESULT == EVENT_ALLOW)
{
- u2->SendMessage(nickserv->Bot(), _(FORCENICKCHANGE_NOW));
+ u2->SendMessage(nickserv->Bot(), FORCENICKCHANGE_NOW);
u2->Collide(na);
/* Convert Config->NSReleaseTimeout seconds to string format */
@@ -69,7 +69,7 @@ class CommandNSRecover : public Command
if (u->Account() == na->nc || (!na->nc->HasFlag(NI_SECURE) && is_on_access(u, na->nc)) ||
(!u->fingerprint.empty() && na->nc->FindCert(u->fingerprint)))
{
- u2->SendMessage(nickserv->Bot(), _(FORCENICKCHANGE_NOW));
+ u2->SendMessage(nickserv->Bot(), FORCENICKCHANGE_NOW);
u2->Collide(na);
/* Convert Config->NSReleaseTimeout seconds to string format */
diff --git a/modules/core/ns_resetpass.cpp b/modules/core/ns_resetpass.cpp
index 903e136fb..55b4ae18b 100644
--- a/modules/core/ns_resetpass.cpp
+++ b/modules/core/ns_resetpass.cpp
@@ -138,8 +138,8 @@ static bool SendResetEmail(User *u, NickAlias *na)
for (idx = 0; idx < 20; ++idx)
passcode += chars[1 + static_cast<int>((static_cast<float>(max - min)) * getrandom16() / 65536.0) + min];
- Anope::string subject = Anope::printf(GetString(na->nc, gtl("Reset password request for %s")).c_str(), na->nick.c_str());
- Anope::string message = Anope::printf(GetString(na->nc, gtl(
+ Anope::string subject = Anope::printf(translate(na->nc, _("Reset password request for %s")), na->nick.c_str());
+ Anope::string message = Anope::printf(translate(na->nc, _(
"Hi,\n"
" \n"
"You have requested to have the password for %s reset.\n"
@@ -147,7 +147,7 @@ static bool SendResetEmail(User *u, NickAlias *na)
" \n"
"If you don't know why this mail was sent to you, please ignore it silently.\n"
" \n"
- "%s administrators.")).c_str(), na->nick.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->s_NickServ.c_str(), na->nick.c_str(), passcode.c_str(), Config->NetworkName.c_str());
+ "%s administrators.")), na->nick.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->s_NickServ.c_str(), na->nick.c_str(), passcode.c_str(), Config->NetworkName.c_str());
na->nc->Extend("ns_resetpass_code", new ExtensibleItemRegular<Anope::string>(passcode));
na->nc->Extend("ns_resetpass_time", new ExtensibleItemRegular<time_t>(Anope::CurTime));
diff --git a/modules/core/ns_sendpass.cpp b/modules/core/ns_sendpass.cpp
index e9ef06d59..d1d47df84 100644
--- a/modules/core/ns_sendpass.cpp
+++ b/modules/core/ns_sendpass.cpp
@@ -98,8 +98,8 @@ static bool SendPassMail(User *u, NickAlias *na, const Anope::string &pass)
{
char subject[BUFSIZE], message[BUFSIZE];
- snprintf(subject, sizeof(subject), GetString(na->nc, gtl("Nickname password (%s)")).c_str(), na->nick.c_str());
- snprintf(message, sizeof(message), GetString(na->nc, gtl(
+ snprintf(subject, sizeof(subject), translate(na->nc, _("Nickname password (%s)")), na->nick.c_str());
+ snprintf(message, sizeof(message), translate(na->nc, _(
"Hi,\n"
" \n"
"You have requested to receive the password of nickname %s by e-mail.\n"
@@ -107,7 +107,7 @@ static bool SendPassMail(User *u, NickAlias *na, const Anope::string &pass)
" \n"
"If you don't know why this mail was sent to you, please ignore it silently.\n"
" \n"
- "%s administrators.")).c_str(), na->nick.c_str(), pass.c_str(), Config->NetworkName.c_str());
+ "%s administrators.")), na->nick.c_str(), pass.c_str(), Config->NetworkName.c_str());
return Mail(u, na->nc, nickserv->Bot(), subject, message);
}
diff --git a/modules/core/ns_set_language.cpp b/modules/core/ns_set_language.cpp
index 98f8f044a..c614e7642 100644
--- a/modules/core/ns_set_language.cpp
+++ b/modules/core/ns_set_language.cpp
@@ -43,8 +43,6 @@ class CommandNSSetLanguage : public Command
}
nc->language = param != "en" ? param : "";
- PopLanguage();
- PushLanguage("anope", nc->language);
source.Reply(_("Language changed to \002English\002."));
return MOD_CONT;
@@ -62,9 +60,7 @@ class CommandNSSetLanguage : public Command
source.Reply(" en (English)");
for (unsigned j = 0; j < languages.size(); ++j)
{
- PushLanguage("anope", languages[j]);
- const Anope::string &langname = _("English");
- PopLanguage();
+ const Anope::string &langname = anope_gettext(languages[j].c_str(), _("English"));
if (langname == "English")
continue;
source.Reply(" %s (%s)", languages[j].c_str(), langname.c_str());
diff --git a/modules/core/os_main.cpp b/modules/core/os_main.cpp
index 1c8203e8d..ec5e95ac8 100644
--- a/modules/core/os_main.cpp
+++ b/modules/core/os_main.cpp
@@ -25,9 +25,7 @@ class OperServBotInfo : public BotInfo
{
if (!u->HasMode(UMODE_OPER) && Config->OSOpersOnly)
{
- PushLanguage("anope", u->Account() ? u->Account()->language : "");
- u->SendMessage(OperServ, _(ACCESS_DENIED));
- PopLanguage();
+ u->SendMessage(OperServ, ACCESS_DENIED);
if (Config->WallBadOS)
ircdproto->SendGlobops(this, "Denied access to %s from %s!%s@%s (non-oper)", Config->s_OperServ.c_str(), u->nick.c_str(), u->GetIdent().c_str(), u->host.c_str());
}