summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/commands/ns_register.cpp19
-rw-r--r--modules/commands/ns_resetpass.cpp20
-rw-r--r--modules/commands/ns_sendpass.cpp24
-rw-r--r--modules/commands/ns_set_email.cpp19
-rw-r--r--modules/pseudoclients/ms_main.cpp24
5 files changed, 55 insertions, 51 deletions
diff --git a/modules/commands/ns_register.cpp b/modules/commands/ns_register.cpp
index 22668e042..9e30167d8 100644
--- a/modules/commands/ns_register.cpp
+++ b/modules/commands/ns_register.cpp
@@ -339,15 +339,16 @@ static bool SendRegmail(User *u, NickAlias *na, BotInfo *bi)
na->nc->Extend("ns_register_passcode", new ExtensibleItemRegular<Anope::string>(code));
}
- Anope::string subject = Anope::printf(_("Nickname Registration (%s)"), na->nick.c_str());
- Anope::string message = Anope::printf(_("Hi,\n"
- " \n"
- "You have requested to register the nickname %s on %s.\n"
- "Please type \" %s%s confirm %s \" to complete registration.\n"
- " \n"
- "If you don't know why this mail was sent to you, please ignore it silently.\n"
- " \n"
- "%s administrators."), na->nick.c_str(), Config->NetworkName.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str(), code.c_str(), Config->NetworkName.c_str());
+ Anope::string subject = translate(na->nc, Config->MailRegistrationSubject.c_str());
+ Anope::string message = translate(na->nc, Config->MailRegistrationMessage.c_str());
+
+ subject = subject.replace_all_cs("%n", na->nick);
+ subject = subject.replace_all_cs("%N", Config->NetworkName);
+ subject = subject.replace_all_cs("%c", code);
+
+ message = message.replace_all_cs("%n", na->nick);
+ message = message.replace_all_cs("%N", Config->NetworkName);
+ message = message.replace_all_cs("%c", code);
return Mail(u, na->nc, bi, subject, message);
}
diff --git a/modules/commands/ns_resetpass.cpp b/modules/commands/ns_resetpass.cpp
index ba766921b..400be41f9 100644
--- a/modules/commands/ns_resetpass.cpp
+++ b/modules/commands/ns_resetpass.cpp
@@ -132,16 +132,16 @@ static bool SendResetEmail(User *u, NickAlias *na, BotInfo *bi)
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(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"
- "To reset your password, type %s%s CONFIRM %s %s\n"
- " \n"
- "If you don't know why this mail was sent to you, please ignore it silently.\n"
- " \n"
- "%s administrators.")), na->nick.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str(), na->nick.c_str(), passcode.c_str(), Config->NetworkName.c_str());
+ Anope::string subject = translate(na->nc, Config->MailResetSubject.c_str());
+ Anope::string message = translate(na->nc, Config->MailResetMessage.c_str());
+
+ subject = subject.replace_all_cs("%n", na->nick);
+ subject = subject.replace_all_cs("%N", Config->NetworkName);
+ subject = subject.replace_all_cs("%c", passcode);
+
+ message = message.replace_all_cs("%n", na->nick);
+ message = message.replace_all_cs("%N", Config->NetworkName);
+ message = message.replace_all_cs("%c", passcode);
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/commands/ns_sendpass.cpp b/modules/commands/ns_sendpass.cpp
index ca185c68b..5195ac727 100644
--- a/modules/commands/ns_sendpass.cpp
+++ b/modules/commands/ns_sendpass.cpp
@@ -47,7 +47,7 @@ class CommandNSSendPass : public Command
}
}
else
- source.Reply(_("SENDPASS command unavailable because encryption is in use."));
+ source.Reply(_("%s command unavailable because encryption is in use."), source.command.c_str());
}
return;
@@ -89,18 +89,16 @@ class NSSendPass : public Module
static bool SendPassMail(User *u, NickAlias *na, BotInfo *bi, const Anope::string &pass)
{
- char subject[BUFSIZE], message[BUFSIZE];
-
- 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"
- "The password is %s. For security purposes, you should change it as soon as you receive this mail.\n"
- " \n"
- "If you don't know why this mail was sent to you, please ignore it silently.\n"
- " \n"
- "%s administrators.")), na->nick.c_str(), pass.c_str(), Config->NetworkName.c_str());
+ Anope::string subject = translate(na->nc, Config->MailSendpassSubject.c_str());
+ Anope::string message = translate(na->nc, Config->MailSendpassMessage.c_str());
+
+ subject = subject.replace_all_cs("%n", na->nick);
+ subject = subject.replace_all_cs("%N", Config->NetworkName);
+ subject = subject.replace_all_cs("%p", pass);
+
+ message = message.replace_all_cs("%n", na->nick);
+ message = message.replace_all_cs("%N", Config->NetworkName);
+ message = message.replace_all_cs("%p", pass);
return Mail(u, na->nc, bi, subject, message);
}
diff --git a/modules/commands/ns_set_email.cpp b/modules/commands/ns_set_email.cpp
index f0914eb51..0df8584b7 100644
--- a/modules/commands/ns_set_email.cpp
+++ b/modules/commands/ns_set_email.cpp
@@ -28,15 +28,16 @@ static bool SendConfirmMail(User *u, BotInfo *bi)
code += chars[1 + static_cast<int>((static_cast<float>(max - min)) * getrandom16() / 65536.0) + min];
u->Account()->Extend("ns_set_email_passcode", new ExtensibleItemRegular<Anope::string>(code));
- Anope::string subject = _("Email confirmation");
- Anope::string message = Anope::printf(_("Hi,\n"
- " \n"
- "You have requested to change your email address to %s.\n"
- "Please type \" %s%s confirm %s \" to confirm this change.\n"
- " \n"
- "If you don't know why this mail was sent to you, please ignore it silently.\n"
- " \n"
- "%s administrators."), u->Account()->email.c_str(), Config->UseStrictPrivMsgString.c_str(), Config->NickServ.c_str(), code.c_str(), Config->NetworkName.c_str());
+ Anope::string subject = Config->MailEmailchangeSubject;
+ Anope::string message = Config->MailEmailchangeMessage;
+
+ subject = subject.replace_all_cs("%e", u->Account()->email);
+ subject = subject.replace_all_cs("%N", Config->NetworkName);
+ subject = subject.replace_all_cs("%c", code);
+
+ message = message.replace_all_cs("%e", u->Account()->email);
+ message = message.replace_all_cs("%N", Config->NetworkName);
+ message = message.replace_all_cs("%c", code);
return Mail(u, u->Account(), bi, subject, message);
}
diff --git a/modules/pseudoclients/ms_main.cpp b/modules/pseudoclients/ms_main.cpp
index c002fc147..eb8af114f 100644
--- a/modules/pseudoclients/ms_main.cpp
+++ b/modules/pseudoclients/ms_main.cpp
@@ -18,16 +18,20 @@ static BotInfo *MemoServ;
static bool SendMemoMail(NickCore *nc, MemoInfo *mi, Memo *m)
{
- 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")), nc->display.c_str(), m->sender.c_str(), mi->GetIndex(m), m->text.c_str());
-
- return Mail(nc, translate(nc, _("New memo")), message);
+ Anope::string subject = translate(nc, Config->MailMemoSubject.c_str());
+ Anope::string message = translate(nc, Config->MailMemoMessage.c_str());
+
+ subject = subject.replace_all_cs("%n", nc->display);
+ subject = subject.replace_all_cs("%s", m->sender);
+ subject = subject.replace_all_cs("%d", mi->GetIndex(m));
+ subject = subject.replace_all_cs("%t", m->text);
+
+ message = message.replace_all_cs("%n", nc->display);
+ message = message.replace_all_cs("%s", m->sender);
+ message = message.replace_all_cs("%d", mi->GetIndex(m));
+ message = message.replace_all_cs("%t", m->text);
+
+ return Mail(nc, subject, message);
}
class MyMemoServService : public MemoServService