More translateable strings, #1354

This commit is contained in:
Alexey Sokolov
2017-10-30 22:56:36 +00:00
parent cfadadb5d3
commit a80074712a
15 changed files with 365 additions and 331 deletions

View File

@@ -1,29 +1,30 @@
<? I18N znc-sasl ?>
<? INC Header.tmpl ?>
<form action="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>" method="post">
<? INC _csrf_check.tmpl ?>
<div class="section">
<h3>SASL</h3>
<h3><? FORMAT "SASL" ?></h3>
<div class="sectionbg">
<div class="sectionbody">
<div class="subsection">
<div class="inputlabel">Username:</div>
<div class="inputlabel"><? FORMAT "Username:" ?></div>
<input type="text" name="username" value="<? VAR Username ?>" class="half" maxlength="128"
title="Please enter a username." />
title="<? FORMAT "Please enter a username." ?>" />
</div>
<div class="subsection">
<div class="inputlabel">Password:</div>
<div class="inputlabel"><? FORMAT "Password:" ?></div>
<input type="password" name="password" class="half"
title="Please enter a password." autocomplete="off" />
title="<? FORMAT "Please enter a password." ?>" autocomplete="off" />
</div>
</div>
</div>
<h3>Options</h3>
<h3><? FORMAT "Options" ?></h3>
<div class="sectionbg">
<div class="sectionbody lotsofcheckboxes">
<span class="checkboxandlabel" title="Connect only if SASL authentication succeeds.">
<span class="checkboxandlabel" title="<? FORMAT "Connect only if SASL authentication succeeds." ?>">
<input type="checkbox" name="require_auth" id="opt_require_auth" value="1"<? IF RequireAuth ?> checked="checked"<? ENDIF ?> />
<label for="opt_require_auth">Require authentication</label>
<label for="opt_require_auth"><? FORMAT "Require authentication" ?></label>
</span>
<div style="clear:both;"></div>
</div>
@@ -31,15 +32,15 @@
</div>
<div class="section">
<h3>Mechanisms</h3>
<h3><? FORMAT "Mechanisms" ?></h3>
<div class="sectionbg">
<div class="sectionbody">
<div class="subsection">
<table class="data">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th><? FORMAT "Name" ?></th>
<th><? FORMAT "Description" ?></th>
</tr>
</thead>
<tbody>
@@ -53,7 +54,7 @@
</table>
</div>
<div class="subsection">
<div class="inputlabel">Selected mechanisms and their order:</div>
<div class="inputlabel"><? FORMAT "Selected mechanisms and their order:" ?></div>
<input type="text" name="mechanisms" id="mechanisms" value="<? VAR Mechanisms ?>" class="half"/>
<script>
$("#mechanisms").selectize({
@@ -70,7 +71,7 @@
<div class="submitline">
<input type="hidden" name="submitted" value="1" />
<input type="submit" value="Save" />
<input type="submit" value="<? FORMAT "Save" ?>" />
</div>
</form>

View File

@@ -1,3 +1,4 @@
<? I18N znc-send_raw ?>
<? ADDROW JSLoop HREF=/modfiles/user/send_raw/select.js ?>
<? INC Header.tmpl ?>
@@ -5,17 +6,17 @@
<? INC _csrf_check.tmpl ?>
<div class="section">
<h3>Send a raw IRC line</h3>
<h3><? FORMAT "Send a raw IRC line" ?></h3>
<div class="sectionbg">
<div class="sectionbody">
<div class="subsection third" id="userblock" style="display:none">
<div class="inputlabel">User:</div>
<input id="user" type="text" disabled="disabled" title="To change user, click to Network selector"/>
<div class="inputlabel"><? FORMAT "User:" ?></div>
<input id="user" type="text" disabled="disabled" title="<? FORMAT "To change user, click to Network selector" ?>"/>
</div>
<div class="subsection third">
<div class="inputlabel" id="networklabel">User/Network:</div>
<div class="inputlabel" id="networklabel"><? FORMAT "User/Network:" ?></div>
<select name="network" id="selectnetwork" onchange="javascript:updateUser()">
<? LOOP UserLoop ?>
<optgroup label="<? VAR Username ?>">
@@ -28,20 +29,20 @@
</div>
<div class="subsection third">
<div class="inputlabel">Send to:</div>
<div class="inputlabel"><? FORMAT "Send to:" ?></div>
<select name="send_to">
<option value="client"<? IF to_client ?> selected="yes"<? ENDIF ?>>Client</option>
<option value="server"<? IF to_server ?> selected="yes"<? ENDIF ?>>Server</option>
<option value="client"<? IF to_client ?> selected="yes"<? ENDIF ?>><? FORMAT "Client" ?></option>
<option value="server"<? IF to_server ?> selected="yes"<? ENDIF ?>><? FORMAT "Server" ?></option>
</select>
</div>
<div class="subsection full">
<div class="inputlabel">Line:</div>
<div class="inputlabel"><? FORMAT "Line:" ?></div>
<input type="text" name="line" value="<? VAR line ?>" />
</div>
<div class="subsection submitline">
<input type="submit" value="Send"/>
<input type="submit" value="<? FORMAT "Send" ?>"/>
</div>
</div>
</div>

View File

@@ -1,3 +1,4 @@
<? I18N znc-stickychan ?>
<? INC Header.tmpl ?>
<form method="post" action="<? VAR URIPrefix TOP ?><? VAR ModPath TOP ?>">
@@ -5,8 +6,8 @@
<table class="data">
<thead>
<tr>
<th>Name</th>
<th>Sticky</th>
<th><? FORMAT "Name" ?></th>
<th><? FORMAT "Sticky" ?></th>
</tr>
</thead>
<tbody>
@@ -21,7 +22,7 @@
<div class="submitline">
<input type="hidden" name="submitted" value="1" />
<input type="submit" value="Save" />
<input type="submit" value="<? FORMAT "Save" ?>" />
</div>
</form>

View File

@@ -1,10 +1,11 @@
<? I18N znc-stickychan ?>
<div class="sectionbg">
<div class="sectionbody">
<div class="subsection">
<input type="hidden" name="embed_stickychan_presented" value="1">
<div class="checkbox">
<input type="checkbox" name="embed_stickychan_sticky" id="opt_embed_stickychan_sticky" value="1"<? IF Sticky ?> checked="checked"<? ENDIF ?> />
<label for="opt_embed_stickychan_sticky">Channel is sticky</label>
<label for="opt_embed_stickychan_sticky"><? FORMAT "Channel is sticky" ?></label>
</div>
</div>
<div style="clear:both;"></div>

View File

@@ -75,7 +75,7 @@ class CQModule : public CModule {
"reconnect to IRC. "
"If you want to cloak your host now, /msg *q Cloak. "
"You can set your preference "
"with /msg *q Set UseCloakedHost true/false."))k;
"with /msg *q Set UseCloakedHost true/false."));
m_bUseCloakedHost = true;
SetUseCloakedHost(m_bUseCloakedHost);
m_bJoinAfterCloaked = true;

View File

@@ -28,9 +28,9 @@ class CSampleJob : public CModuleJob {
~CSampleJob() override {
if (wasCancelled()) {
GetModule()->PutModule("Sample job cancelled");
GetModule()->PutModule(GetModule()->t_s("Sample job cancelled"));
} else {
GetModule()->PutModule("Sample job destroyed");
GetModule()->PutModule(GetModule()->t_s("Sample job destroyed"));
}
}
@@ -46,7 +46,9 @@ class CSampleJob : public CModuleJob {
}
}
void runMain() override { GetModule()->PutModule("Sample job done"); }
void runMain() override {
GetModule()->PutModule(GetModule()->t_s("Sample job done"));
}
};
#endif
@@ -59,7 +61,9 @@ class CSampleTimer : public CTimer {
private:
protected:
void RunJob() override { GetModule()->PutModule("TEST!!!!"); }
void RunJob() override {
GetModule()->PutModule(GetModule()->t_s("TEST!!!!"));
}
};
class CSampleMod : public CModule {
@@ -67,7 +71,7 @@ class CSampleMod : public CModule {
MODCONSTRUCTOR(CSampleMod) {}
bool OnLoad(const CString& sArgs, CString& sMessage) override {
PutModule("I'm being loaded with the arguments: [" + sArgs + "]");
PutModule(t_f("I'm being loaded with the arguments: {1}")(sArgs));
// AddTimer(new CSampleTimer(this, 300, 0, "Sample", "Sample timer for sample
// things."));
// AddTimer(new CSampleTimer(this, 5, 20, "Another", "Another sample timer."));
@@ -78,7 +82,7 @@ class CSampleMod : public CModule {
return true;
}
~CSampleMod() override { PutModule("I'm being unloaded!"); }
~CSampleMod() override { PutModule(t_s("I'm being unloaded!")); }
bool OnBoot() override {
// This is called when the app starts up (only modules that are loaded
@@ -86,10 +90,12 @@ class CSampleMod : public CModule {
return true;
}
void OnIRCConnected() override { PutModule("You got connected BoyOh."); }
void OnIRCConnected() override {
PutModule(t_s("You got connected BoyOh."));
}
void OnIRCDisconnected() override {
PutModule("You got disconnected BoyOh.");
PutModule(t_s("You got disconnected BoyOh."));
}
EModRet OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent,
@@ -107,99 +113,98 @@ class CSampleMod : public CModule {
void OnChanPermission(const CNick& OpNick, const CNick& Nick,
CChan& Channel, unsigned char uMode, bool bAdded,
bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() +
"] set mode [" + Channel.GetName() +
((bAdded) ? "] +" : "] -") + CString(uMode) + " " +
Nick.GetNick());
PutModule(t_f("{1} {2} set mode on {3} {4}{5} {6}")(
bNoChange, OpNick.GetNick(), Channel.GetName(), bAdded ? '+' : '-',
uMode, Nick.GetNick()));
}
void OnOp(const CNick& OpNick, const CNick& Nick, CChan& Channel,
bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() +
"] opped [" + Nick.GetNick() + "] on [" + Channel.GetName() +
"]");
PutModule(t_f("{1} {2} opped {3} on {4}")(
bNoChange, OpNick.GetNick(), Nick.GetNick(), Channel.GetName()));
}
void OnDeop(const CNick& OpNick, const CNick& Nick, CChan& Channel,
bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() +
"] deopped [" + Nick.GetNick() + "] on [" +
Channel.GetName() + "]");
PutModule(t_f("{1} {2} deopped {3} on {4}")(
bNoChange, OpNick.GetNick(), Nick.GetNick(), Channel.GetName()));
}
void OnVoice(const CNick& OpNick, const CNick& Nick, CChan& Channel,
bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() +
"] voiced [" + Nick.GetNick() + "] on [" + Channel.GetName() +
"]");
PutModule(t_f("{1} {2} voiced {3} on {4}")(
bNoChange, OpNick.GetNick(), Nick.GetNick(), Channel.GetName()));
}
void OnDevoice(const CNick& OpNick, const CNick& Nick, CChan& Channel,
bool bNoChange) override {
PutModule(((bNoChange) ? "[0] [" : "[1] [") + OpNick.GetNick() +
"] devoiced [" + Nick.GetNick() + "] on [" +
Channel.GetName() + "]");
PutModule(t_f("{1} {2} devoiced {3} on {4}")(
bNoChange, OpNick.GetNick(), Nick.GetNick(), Channel.GetName()));
}
void OnRawMode(const CNick& OpNick, CChan& Channel, const CString& sModes,
const CString& sArgs) override {
PutModule("* " + OpNick.GetNick() + " sets mode: " + sModes + " " +
sArgs + " (" + Channel.GetName() + ")");
PutModule(t_f("* {1} sets mode: {2} {3} on {4}")(
OpNick.GetNick(), sModes, sArgs, Channel.GetName()));
}
EModRet OnRaw(CString& sLine) override {
// PutModule("OnRaw() [" + sLine + "]");
// PutModule(t_f("OnRaw(): {1}")(sLine));
return CONTINUE;
}
EModRet OnUserRaw(CString& sLine) override {
// PutModule("UserRaw() [" + sLine + "]");
// PutModule(t_f("OnUserRaw(): {1}")(sLine));
return CONTINUE;
}
void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel,
const CString& sMessage) override {
PutModule("[" + OpNick.GetNick() + "] kicked [" + sKickedNick +
"] from [" + Channel.GetName() + "] with the msg [" +
sMessage + "]");
PutModule(t_f("{1} kicked {2} from {3} with the msg {4}")(
OpNick.GetNick(), sKickedNick, Channel.GetName(), sMessage));
}
void OnQuit(const CNick& Nick, const CString& sMessage,
const vector<CChan*>& vChans) override {
PutModule("* Quits: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" +
Nick.GetHost() + ") (" + sMessage + ")");
PutModule(t_p("* {1} ({2}@{3}) quits ({4}) from channel: {6}",
"* {1} ({2}@{3}) quits ({4}) from {5} channels: {6}",
vChans.size())(
Nick.GetNick(), Nick.GetIdent(), Nick.GetHost(), sMessage,
vChans.size(), CString(", ").Join(vChans.begin(), vChans.end())));
}
EModRet OnTimerAutoJoin(CChan& Channel) override {
PutModule("Attempting to join " + Channel.GetName());
PutModule(t_f("Attempting to join {1}")(Channel.GetName()));
return CONTINUE;
}
void OnJoin(const CNick& Nick, CChan& Channel) override {
PutModule("* Joins: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" +
Nick.GetHost() + ")");
PutModule(t_f("* {1} ({2}@{3}) joins {4}")(
Nick.GetNick(), Nick.GetIdent(), Nick.GetHost(),
Channel.GetName()));
}
void OnPart(const CNick& Nick, CChan& Channel,
const CString& sMessage) override {
PutModule("* Parts: " + Nick.GetNick() + " (" + Nick.GetIdent() + "!" +
Nick.GetHost() + ")");
PutModule(t_f("* {1} ({2}@{3}) parts {4}")(
Nick.GetNick(), Nick.GetIdent(), Nick.GetHost(),
Channel.GetName()));
}
EModRet OnInvite(const CNick& Nick, const CString& sChan) override {
if (sChan.Equals("#test")) {
PutModule(Nick.GetNick() + " invited us to " + sChan +
", ignoring invites to " + sChan);
PutModule(t_f("{1} invited us to {2}, ignoring invites to {2}")(
Nick.GetNick(), sChan));
return HALT;
}
PutModule(Nick.GetNick() + " invited us to " + sChan);
PutModule(t_f("{1} invited us to {2}")(Nick.GetNick(), sChan));
return CONTINUE;
}
void OnNick(const CNick& OldNick, const CString& sNewNick,
const vector<CChan*>& vChans) override {
PutModule("* " + OldNick.GetNick() + " is now known as " + sNewNick);
PutModule(t_f("{1} is now known as {2}")(OldNick.GetNick(), sNewNick));
}
EModRet OnUserCTCPReply(CString& sTarget, CString& sMessage) override {
@@ -261,15 +266,15 @@ class CSampleMod : public CModule {
}
EModRet OnTopic(CNick& Nick, CChan& Channel, CString& sTopic) override {
PutModule("* " + Nick.GetNick() + " changes topic on " +
Channel.GetName() + " to '" + sTopic + "'");
PutModule(t_f("{1} changes topic on {2} to {3}")(
Nick.GetNick(), Channel.GetName(), sTopic));
return CONTINUE;
}
EModRet OnUserTopic(CString& sTarget, CString& sTopic) override {
PutModule("* " + GetClient()->GetNick() + " changed topic on " +
sTarget + " to '" + sTopic + "'");
PutModule(t_f("{1} changes topic on {2} to {3}")(GetClient()->GetNick(),
sTarget, sTopic));
return CONTINUE;
}
@@ -309,7 +314,7 @@ class CSampleMod : public CModule {
EModRet OnStatusCommand(CString& sCommand) override {
if (sCommand.Equals("SAMPLE")) {
PutModule("Hi, I'm your friendly sample module.");
PutModule(t_s("Hi, I'm your friendly sample module."));
return HALT;
}
@@ -321,7 +326,8 @@ template <>
void TModInfo<CSampleMod>(CModInfo& Info) {
Info.SetWikiPage("sample");
Info.SetHasArgs(true);
Info.SetArgsHelpText("Description of module arguments goes here.");
Info.SetArgsHelpText(
Info.t_s("Description of module arguments goes here."));
}
MODULEDEFS(CSampleMod, "To be used as a sample for writing modules")
MODULEDEFS(CSampleMod, t_s("To be used as a sample for writing modules"))

View File

@@ -30,7 +30,7 @@ class CSampleWebAPIMod : public CModule {
}
if (WebSock.IsPost()) {
// print the text we just recieved
// print the text we just received
CString text = WebSock.GetRawParam("text", true);
WebSock.PrintHeader(text.length(), "text/plain; charset=UTF-8");
WebSock.Write(text);
@@ -56,4 +56,4 @@ void TModInfo<CSampleWebAPIMod>(CModInfo& Info) {
Info.SetWikiPage("samplewebapi");
}
GLOBALMODULEDEFS(CSampleWebAPIMod, "Sample Web API module.")
GLOBALMODULEDEFS(CSampleWebAPIMod, t_s("Sample Web API module."))

View File

@@ -18,17 +18,6 @@
#include <znc/IRCSock.h>
#include <algorithm>
static const struct {
const char* szName;
const char* szDescription;
const bool bDefault;
} SupportedMechanisms[] = {
{"EXTERNAL", "TLS certificate, for use with the *cert module", true},
{"PLAIN",
"Plain text negotiation, this should work always if the network "
"supports SASL",
true}};
#define NV_REQUIRE_AUTH "require_auth"
#define NV_MECHANISMS "mechanisms"
@@ -57,29 +46,37 @@ class Mechanisms : public VCString {
};
class CSASLMod : public CModule {
const struct {
const char* szName;
CDelayedTranslation sDescription;
bool bDefault;
} SupportedMechanisms[2] = {
{"EXTERNAL", t_d("TLS certificate, for use with the *cert module"),
true},
{"PLAIN", t_d("Plain text negotiation, this should work always if the "
"network supports SASL"),
true}};
public:
MODCONSTRUCTOR(CSASLMod) {
AddCommand("Help",
static_cast<CModCommand::ModCmdFunc>(&CSASLMod::PrintHelp),
"search", "Generate this output");
AddCommand("Set", static_cast<CModCommand::ModCmdFunc>(&CSASLMod::Set),
"[<username> [<password>]]",
"Set username and password for the mechanisms that need "
"them. Password is optional. Without parameters, returns "
"information about current settings.");
AddCommand("Mechanism", static_cast<CModCommand::ModCmdFunc>(
&CSASLMod::SetMechanismCommand),
"[mechanism[ ...]]",
"Set the mechanisms to be attempted (in order)");
AddCommand(
"RequireAuth",
static_cast<CModCommand::ModCmdFunc>(&CSASLMod::RequireAuthCommand),
"[yes|no]", "Don't connect unless SASL authentication succeeds");
AddCommand("Help", t_d("search"), t_d("Generate this output"),
[=](const CString& sLine) { PrintHelp(sLine); });
AddCommand("Set", t_d("[<username> [<password>]]"),
t_d("Set username and password for the mechanisms that need "
"them. Password is optional. Without parameters, "
"returns information about current settings."),
[=](const CString& sLine) { Set(sLine); });
AddCommand("Mechanism", t_d("[mechanism[ ...]]"),
t_d("Set the mechanisms to be attempted (in order)"),
[=](const CString& sLine) { SetMechanismCommand(sLine); });
AddCommand("RequireAuth", t_d("[yes|no]"),
t_d("Don't connect unless SASL authentication succeeds"),
[=](const CString& sLine) { RequireAuthCommand(sLine); });
AddCommand("Verbose", "yes|no", "Set verbosity level, useful to debug",
[&](const CString& sLine) {
m_bVerbose = sLine.Token(1, true).ToBool();
PutModule("Verbose: " + CString(m_bVerbose));
});
m_bVerbose = sLine.Token(1, true).ToBool();
PutModule("Verbose: " + CString(m_bVerbose));
});
m_bAuthenticated = false;
}
@@ -88,16 +85,16 @@ class CSASLMod : public CModule {
HandleHelpCommand(sLine);
CTable Mechanisms;
Mechanisms.AddColumn("Mechanism");
Mechanisms.AddColumn("Description");
Mechanisms.AddColumn(t_s("Mechanism"));
Mechanisms.AddColumn(t_s("Description"));
for (const auto& it : SupportedMechanisms) {
Mechanisms.AddRow();
Mechanisms.SetCell("Mechanism", it.szName);
Mechanisms.SetCell("Description", it.szDescription);
Mechanisms.SetCell(t_s("Mechanism"), it.szName);
Mechanisms.SetCell(t_s("Description"), it.sDescription.Resolve());
}
PutModule("The following mechanisms are available:");
PutModule(t_s("The following mechanisms are available:"));
PutModule(Mechanisms);
}
@@ -106,16 +103,24 @@ class CSASLMod : public CModule {
CString sUsername = GetNV("username");
CString sPassword = GetNV("password");
PutModule("Username is currently " + (sUsername.empty() ? "not set" : "set to '" + sUsername + "'") +
", a password was " + (sPassword.empty() ? "not " : "") + "supplied.");
if (sUsername.empty()) {
PutModule(t_s("Username is currently not set"));
} else {
PutModule(t_f("Username is currently set to '{1}'")(sUsername));
}
if (sPassword.empty()) {
PutModule(t_s("Password was not supplied"));
} else {
PutModule(t_s("Password was supplied"));
}
return;
}
SetNV("username", sLine.Token(1));
SetNV("password", sLine.Token(2));
PutModule("Username has been set to [" + GetNV("username") + "]");
PutModule("Password has been set to [" + GetNV("password") + "]");
PutModule(t_f("Username has been set to [{1}]")(GetNV("username")));
PutModule(t_f("Password has been set to [{1}]")(GetNV("password")));
}
void SetMechanismCommand(const CString& sLine) {
@@ -135,7 +140,7 @@ class CSASLMod : public CModule {
SetNV(NV_MECHANISMS, sMechanisms);
}
PutModule("Current mechanisms set: " + GetMechanismsString());
PutModule(t_f("Current mechanisms set: {1}")(GetMechanismsString()));
}
void RequireAuthCommand(const CString& sLine) {
@@ -144,9 +149,9 @@ class CSASLMod : public CModule {
}
if (GetNV(NV_REQUIRE_AUTH).ToBool()) {
PutModule("We require SASL negotiation to connect");
PutModule(t_s("We require SASL negotiation to connect"));
} else {
PutModule("We will connect even if SASL fails");
PutModule(t_s("We will connect even if SASL fails"));
}
}
@@ -183,8 +188,8 @@ class CSASLMod : public CModule {
void CheckRequireAuth() {
if (!m_bAuthenticated && GetNV(NV_REQUIRE_AUTH).ToBool()) {
GetNetwork()->SetIRCConnectEnabled(false);
PutModule("Disabling network, we require authentication.");
PutModule("Use 'RequireAuth no' to disable.");
PutModule(t_s("Disabling network, we require authentication."));
PutModule(t_s("Use 'RequireAuth no' to disable."));
}
}
@@ -236,7 +241,8 @@ class CSASLMod : public CModule {
if (msg.GetCode() == 903) {
/* SASL success! */
if (m_bVerbose) {
PutModule(m_Mechanisms.GetCurrent() + " mechanism succeeded.");
PutModule(
t_f("{1} mechanism succeeded.")(m_Mechanisms.GetCurrent()));
}
GetNetwork()->GetIRCSock()->ResumeCap();
m_bAuthenticated = true;
@@ -247,7 +253,8 @@ class CSASLMod : public CModule {
DEBUG("sasl: Mechanism [" << m_Mechanisms.GetCurrent()
<< "] failed.");
if (m_bVerbose) {
PutModule(m_Mechanisms.GetCurrent() + " mechanism failed.");
PutModule(
t_f("{1} mechanism failed.")(m_Mechanisms.GetCurrent()));
}
if (m_Mechanisms.HasNext()) {
@@ -280,7 +287,7 @@ class CSASLMod : public CModule {
void OnIRCDisconnected() override { m_bAuthenticated = false; }
CString GetWebMenuTitle() override { return "SASL"; }
CString GetWebMenuTitle() override { return t_s("SASL"); }
bool OnWebRequest(CWebSock& WebSock, const CString& sPageName,
CTemplate& Tmpl) override {
@@ -308,7 +315,7 @@ class CSASLMod : public CModule {
CTemplate& Row = Tmpl.AddRow("MechanismLoop");
CString sName(it.szName);
Row["Name"] = sName;
Row["Description"] = CString(it.szDescription);
Row["Description"] = it.sDescription.Resolve();
}
return true;
@@ -325,6 +332,5 @@ void TModInfo<CSASLMod>(CModInfo& Info) {
Info.SetWikiPage("sasl");
}
NETWORKMODULEDEFS(CSASLMod,
"Adds support for sasl authentication capability to "
"authenticate to an IRC server")
NETWORKMODULEDEFS(CSASLMod, t_s("Adds support for sasl authentication "
"capability to authenticate to an IRC server"))

View File

@@ -62,15 +62,12 @@ class CSaveBuff : public CModule {
m_bBootError = false;
AddHelpCommand();
AddCommand("SetPass", static_cast<CModCommand::ModCmdFunc>(
&CSaveBuff::OnSetPassCommand),
"<password>", "Sets the password");
AddCommand("Replay", static_cast<CModCommand::ModCmdFunc>(
&CSaveBuff::OnReplayCommand),
"<buffer>", "Replays the buffer");
AddCommand("Save", static_cast<CModCommand::ModCmdFunc>(
&CSaveBuff::OnSaveCommand),
"", "Saves all buffers");
AddCommand("SetPass", t_d("<password>"), t_d("Sets the password"),
[=](const CString& sLine) { OnSetPassCommand(sLine); });
AddCommand("Replay", t_d("<buffer>"), t_d("Replays the buffer"),
[=](const CString& sLine) { OnReplayCommand(sLine); });
AddCommand("Save", "", t_d("Saves all buffers"),
[=](const CString& sLine) { OnSaveCommand(sLine); });
}
~CSaveBuff() override {
if (!m_bBootError) {
@@ -220,10 +217,10 @@ class CSaveBuff : public CModule {
}
}
} else {
PutModule(
PutModule(t_s(
"Password is unset usually meaning the decryption failed. You "
"can setpass to the appropriate pass and things should start "
"working, or setpass to a new pass and save to reinstantiate");
"working, or setpass to a new pass and save to reinstantiate"));
}
}
@@ -232,7 +229,7 @@ class CSaveBuff : public CModule {
if (sArgs.empty()) sArgs = CRYPT_LAME_PASS;
PutModule("Password set to [" + sArgs + "]");
PutModule(t_f("Password set to [{1}]")(sArgs));
m_sPassword = CBlowfish::MD5(sArgs);
}
@@ -262,7 +259,7 @@ class CSaveBuff : public CModule {
CString sArgs = sCmdLine.Token(1, true);
Replay(sArgs);
PutModule("Replayed " + sArgs);
PutModule(t_f("Replayed {1}")(sArgs));
}
void OnSaveCommand(const CString& sCmdLine) {
@@ -341,7 +338,7 @@ class CSaveBuff : public CModule {
if (sBuffer.TrimLeft(sName + "\n")) return QueryBuffer;
}
PutModule("Unable to decode Encrypted file [" + sPath + "]");
PutModule(t_f("Unable to decode Encrypted file {1}")(sPath));
return InvalidBuffer;
}
return EmptyBuffer;
@@ -357,10 +354,10 @@ template <>
void TModInfo<CSaveBuff>(CModInfo& Info) {
Info.SetWikiPage("savebuff");
Info.SetHasArgs(true);
Info.SetArgsHelpText(
Info.SetArgsHelpText(Info.t_s(
"This user module takes up to one arguments. Either --ask-pass or the "
"password itself (which may contain spaces) or nothing");
"password itself (which may contain spaces) or nothing"));
}
NETWORKMODULEDEFS(CSaveBuff,
"Stores channel and query buffers to disk, encrypted")
t_s("Stores channel and query buffers to disk, encrypted"))

View File

@@ -29,14 +29,15 @@ class CSendRaw_Mod : public CModule {
if (pNetwork) {
pNetwork->PutUser(sLine.Token(3, true));
PutModule("Sent [" + sLine.Token(3, true) + "] to " +
pUser->GetUserName() + "/" + pNetwork->GetName());
PutModule(t_f("Sent [{1}] to {2}/{3}")(sLine.Token(3, true),
pUser->GetUserName(),
pNetwork->GetName()));
} else {
PutModule("Network [" + sLine.Token(2) +
"] not found for user [" + sLine.Token(1) + "]");
PutModule(t_f("Network {1} not found for user {2}")(
sLine.Token(2), sLine.Token(1)));
}
} else {
PutModule("User [" + sLine.Token(1) + "] not found");
PutModule(t_f("User {1} not found")(sLine.Token(1)));
}
}
@@ -48,15 +49,15 @@ class CSendRaw_Mod : public CModule {
if (pNetwork) {
pNetwork->PutIRC(sLine.Token(3, true));
PutModule("Sent [" + sLine.Token(3, true) +
"] to IRC Server of " + pUser->GetUserName() + "/" +
pNetwork->GetName());
PutModule(t_f("Sent [{1}] to IRC server of {2}/{3}")(
sLine.Token(3, true), pUser->GetUserName(),
pNetwork->GetName()));
} else {
PutModule("Network [" + sLine.Token(2) +
"] not found for user [" + sLine.Token(1) + "]");
PutModule(t_f("Network {1} not found for user {2}")(
sLine.Token(2), sLine.Token(1)));
}
} else {
PutModule("User [" + sLine.Token(1) + "] not found");
PutModule(t_f("User {1} not found")(sLine.Token(1)));
}
}
@@ -70,14 +71,15 @@ class CSendRaw_Mod : public CModule {
bool OnLoad(const CString& sArgs, CString& sErrorMsg) override {
if (!GetUser()->IsAdmin()) {
sErrorMsg = "You must have admin privileges to load this module";
sErrorMsg =
t_s("You must have admin privileges to load this module");
return false;
}
return true;
}
CString GetWebMenuTitle() override { return "Send Raw"; }
CString GetWebMenuTitle() override { return t_s("Send Raw"); }
bool WebRequiresAdmin() override { return true; }
bool OnWebRequest(CWebSock& WebSock, const CString& sPageName,
@@ -87,14 +89,14 @@ class CSendRaw_Mod : public CModule {
CUser* pUser = CZNC::Get().FindUser(
WebSock.GetParam("network").Token(0, false, "/"));
if (!pUser) {
WebSock.GetSession()->AddError("User not found");
WebSock.GetSession()->AddError(t_s("User not found"));
return true;
}
CIRCNetwork* pNetwork = pUser->FindNetwork(
WebSock.GetParam("network").Token(1, false, "/"));
if (!pNetwork) {
WebSock.GetSession()->AddError("Network not found");
WebSock.GetSession()->AddError(t_s("Network not found"));
return true;
}
@@ -111,7 +113,7 @@ class CSendRaw_Mod : public CModule {
pNetwork->PutUser(sLine);
}
WebSock.GetSession()->AddSuccess("Line sent");
WebSock.GetSession()->AddSuccess(t_s("Line sent"));
}
const map<CString, CUser*>& msUsers = CZNC::Get().GetUserMap();
@@ -135,19 +137,16 @@ class CSendRaw_Mod : public CModule {
MODCONSTRUCTOR(CSendRaw_Mod) {
AddHelpCommand();
AddCommand("Client", static_cast<CModCommand::ModCmdFunc>(
&CSendRaw_Mod::SendClient),
"[user] [network] [data to send]",
"The data will be sent to the user's IRC client(s)");
AddCommand(
"Server",
static_cast<CModCommand::ModCmdFunc>(&CSendRaw_Mod::SendServer),
"[user] [network] [data to send]",
"The data will be sent to the IRC server the user is connected to");
AddCommand(
"Current",
static_cast<CModCommand::ModCmdFunc>(&CSendRaw_Mod::CurrentClient),
"[data to send]", "The data will be sent to your current client");
AddCommand("Client", t_d("[user] [network] [data to send]"),
t_d("The data will be sent to the user's IRC client(s)"),
[=](const CString& sLine) { SendClient(sLine); });
AddCommand("Server", t_d("[user] [network] [data to send]"),
t_d("The data will be sent to the IRC server the user is "
"connected to"),
[=](const CString& sLine) { SendServer(sLine); });
AddCommand("Current", t_d("[data to send]"),
t_d("The data will be sent to your current client"),
[=](const CString& sLine) { CurrentClient(sLine); });
}
};
@@ -157,4 +156,4 @@ void TModInfo<CSendRaw_Mod>(CModInfo& Info) {
}
USERMODULEDEFS(CSendRaw_Mod,
"Lets you send some raw IRC lines as/to someone else")
t_s("Lets you send some raw IRC lines as/to someone else"))

View File

@@ -33,9 +33,8 @@ class CShellSock : public CExecSock {
m_pClient = pClient;
if (Execute(sExec) == -1) {
CString s = "Failed to execute: ";
s += strerror(errno);
ReadLine(s);
auto e = errno;
ReadLine(t_f("Failed to execute: {1}")(strerror(e)));
return;
}
@@ -73,7 +72,7 @@ class CShellMod : public CModule {
bool OnLoad(const CString& sArgs, CString& sMessage) override {
#ifndef MOD_SHELL_ALLOW_EVERYONE
if (!GetUser()->IsAdmin()) {
sMessage = "You must be admin to use the shell module";
sMessage = t_s("You must be admin to use the shell module");
return false;
}
#endif
@@ -167,7 +166,8 @@ void TModInfo<CShellMod>(CModInfo& Info) {
}
#ifdef MOD_SHELL_ALLOW_EVERYONE
USERMODULEDEFS(CShellMod, "Gives shell access")
USERMODULEDEFS(CShellMod, t_s("Gives shell access"))
#else
USERMODULEDEFS(CShellMod, "Gives shell access. Only ZNC admins can use it.")
USERMODULEDEFS(CShellMod,
t_s("Gives shell access. Only ZNC admins can use it."))
#endif

View File

@@ -53,27 +53,25 @@ class CSimpleAway : public CModule {
m_bWeSetAway = false;
AddHelpCommand();
AddCommand("Reason", static_cast<CModCommand::ModCmdFunc>(
&CSimpleAway::OnReasonCommand),
"[<text>]",
"Prints or sets the away reason (%awaytime% is replaced "
"with the time you were set away, supports substitutions "
"using ExpandString)");
AddCommand("Reason", t_d("[<text>]"),
t_d("Prints or sets the away reason (%awaytime% is replaced "
"with the time you were set away, supports "
"substitutions using ExpandString)"),
[=](const CString& sLine) { OnReasonCommand(sLine); });
AddCommand(
"Timer",
static_cast<CModCommand::ModCmdFunc>(&CSimpleAway::OnTimerCommand),
"", "Prints the current time to wait before setting you away");
AddCommand("SetTimer", static_cast<CModCommand::ModCmdFunc>(
&CSimpleAway::OnSetTimerCommand),
"<seconds>",
"Sets the time to wait before setting you away");
AddCommand("DisableTimer", static_cast<CModCommand::ModCmdFunc>(
&CSimpleAway::OnDisableTimerCommand),
"", "Disables the wait time before setting you away");
"Timer", "",
t_d("Prints the current time to wait before setting you away"),
[=](const CString& sLine) { OnTimerCommand(sLine); });
AddCommand("SetTimer", t_d("<seconds>"),
t_d("Sets the time to wait before setting you away"),
[=](const CString& sLine) { OnSetTimerCommand(sLine); });
AddCommand("DisableTimer", "",
t_d("Disables the wait time before setting you away"),
[=](const CString& sLine) { OnDisableTimerCommand(sLine); });
AddCommand(
"MinClients", static_cast<CModCommand::ModCmdFunc>(
&CSimpleAway::OnMinClientsCommand),
"", "Get or set the minimum number of clients before going away");
"MinClients", "",
t_d("Get or set the minimum number of clients before going away"),
[=](const CString& sLine) { OnMinClientsCommand(sLine); });
}
~CSimpleAway() override {}
@@ -135,38 +133,40 @@ class CSimpleAway : public CModule {
if (!sReason.empty()) {
SetReason(sReason);
PutModule("Away reason set");
PutModule(t_s("Away reason set"));
} else {
PutModule("Away reason: " + m_sReason);
PutModule("Current away reason would be: " + ExpandReason());
PutModule(t_f("Away reason: {1}")(m_sReason));
PutModule(t_f("Current away reason would be: {1}")(ExpandReason()));
}
}
void OnTimerCommand(const CString& sLine) {
PutModule("Current timer setting: " + CString(m_iAwayWait) +
" seconds");
PutModule(t_p("Current timer setting: 1 second",
"Current timer setting: {1} seconds",
m_iAwayWait)(m_iAwayWait));
}
void OnSetTimerCommand(const CString& sLine) {
SetAwayWait(sLine.Token(1).ToUInt());
if (m_iAwayWait == 0)
PutModule("Timer disabled");
PutModule(t_s("Timer disabled"));
else
PutModule("Timer set to " + CString(m_iAwayWait) + " seconds");
PutModule(t_p("Timer set to 1 second", "Timer set to: {1} seconds",
m_iAwayWait)(m_iAwayWait));
}
void OnDisableTimerCommand(const CString& sLine) {
SetAwayWait(0);
PutModule("Timer disabled");
PutModule(t_s("Timer disabled"));
}
void OnMinClientsCommand(const CString& sLine) {
if (sLine.Token(1).empty()) {
PutModule("Current MinClients setting: " + CString(m_iMinClients));
PutModule(t_f("Current MinClients setting: {1}")(m_iMinClients));
} else {
SetMinClients(sLine.Token(1).ToUInt());
PutModule("MinClients set to " + CString(m_iMinClients));
PutModule(t_f("MinClients set to {1}")(m_iMinClients));
}
}
@@ -250,10 +250,10 @@ void TModInfo<CSimpleAway>(CModInfo& Info) {
Info.SetWikiPage("simple_away");
Info.SetHasArgs(true);
Info.SetArgsHelpText(
"You might enter up to 3 arguments, like -notimer awaymessage or "
"-timer 5 awaymessage.");
Info.t_s("You might enter up to 3 arguments, like -notimer awaymessage "
"or -timer 5 awaymessage."));
}
NETWORKMODULEDEFS(CSimpleAway,
"This module will automatically set you away on IRC while "
"you are disconnected from the bouncer.")
t_s("This module will automatically set you away on IRC "
"while you are disconnected from the bouncer."))

View File

@@ -25,15 +25,12 @@ class CStickyChan : public CModule {
public:
MODCONSTRUCTOR(CStickyChan) {
AddHelpCommand();
AddCommand("Stick", static_cast<CModCommand::ModCmdFunc>(
&CStickyChan::OnStickCommand),
"<#channel> [key]", "Sticks a channel");
AddCommand("Unstick", static_cast<CModCommand::ModCmdFunc>(
&CStickyChan::OnUnstickCommand),
"<#channel>", "Unsticks a channel");
AddCommand("List", static_cast<CModCommand::ModCmdFunc>(
&CStickyChan::OnListCommand),
"", "Lists sticky channels");
AddCommand("Stick", t_d("<#channel> [key]"), t_d("Sticks a channel"),
[=](const CString& sLine) { OnStickCommand(sLine); });
AddCommand("Unstick", t_d("<#channel>"), t_d("Unsticks a channel"),
[=](const CString& sLine) { OnUnstickCommand(sLine); });
AddCommand("List", "", t_d("Lists sticky channels"),
[=](const CString& sLine) { OnListCommand(sLine); });
}
~CStickyChan() override {}
@@ -75,21 +72,21 @@ class CStickyChan : public CModule {
void OnStickCommand(const CString& sCommand) {
CString sChannel = sCommand.Token(1).AsLower();
if (sChannel.empty()) {
PutModule("Usage: Stick <#channel> [key]");
PutModule(t_s("Usage: Stick <#channel> [key]"));
return;
}
SetNV(sChannel, sCommand.Token(2), true);
PutModule("Stuck " + sChannel);
PutModule(t_f("Stuck {1}")(sChannel));
}
void OnUnstickCommand(const CString& sCommand) {
CString sChannel = sCommand.Token(1);
if (sChannel.empty()) {
PutModule("Usage: Unstick <#channel>");
PutModule(t_s("Usage: Unstick <#channel>"));
return;
}
DelNV(sChannel, true);
PutModule("Unstuck " + sChannel);
PutModule(t_f("Unstuck {1}")(sChannel));
}
void OnListCommand(const CString& sCommand) {
@@ -101,7 +98,7 @@ class CStickyChan : public CModule {
PutModule(CString(i) + ": " + it->first + " (" + it->second +
")");
}
PutModule(" -- End of List");
PutModule(t_s(" -- End of List"));
}
void RunJob() {
@@ -115,8 +112,8 @@ class CStickyChan : public CModule {
if (!it->second.empty()) pChan->SetKey(it->second);
if (!pNetwork->AddChan(pChan)) {
/* AddChan() deleted that channel */
PutModule("Could not join [" + it->first +
"] (# prefix missing?)");
PutModule(t_f("Could not join {1} (# prefix missing?)")(
it->first));
continue;
}
}
@@ -128,7 +125,7 @@ class CStickyChan : public CModule {
}
}
CString GetWebMenuTitle() override { return "Sticky Chans"; }
CString GetWebMenuTitle() override { return t_s("Sticky Channels"); }
bool OnWebRequest(CWebSock& WebSock, const CString& sPageName,
CTemplate& Tmpl) override {
@@ -159,7 +156,8 @@ class CStickyChan : public CModule {
}
if (bSubmitted) {
WebSock.GetSession()->AddSuccess("Changes have been saved!");
WebSock.GetSession()->AddSuccess(
t_s("Changes have been saved!"));
}
return true;
@@ -183,11 +181,12 @@ class CStickyChan : public CModule {
// no password support for now unless chansaver is active
// too
SetNV(sChan, "");
WebSock.GetSession()->AddSuccess("Channel become sticky!");
WebSock.GetSession()->AddSuccess(
t_s("Channel became sticky!"));
} else if (!bNewStick && bStick) {
DelNV(sChan);
WebSock.GetSession()->AddSuccess(
"Channel stopped being sticky!");
t_s("Channel stopped being sticky!"));
}
}
return true;
@@ -208,9 +207,9 @@ class CStickyChan : public CModule {
CString sChannel = sLine.Token(3);
for (MCString::iterator it = BeginNV(); it != EndNV(); ++it) {
if (sChannel.Equals(it->first)) {
PutModule("Channel [" + sChannel +
"] cannot be joined, it is an illegal channel "
"name. Unsticking.");
PutModule(
t_f("Channel {1} cannot be joined, it is an illegal "
"channel name. Unsticking.")(sChannel));
OnUnstickCommand("unstick " + sChannel);
return CONTINUE;
}
@@ -246,8 +245,9 @@ template <>
void TModInfo<CStickyChan>(CModInfo& Info) {
Info.SetWikiPage("stickychan");
Info.SetHasArgs(true);
Info.SetArgsHelpText("List of channels, separated by comma.");
Info.SetArgsHelpText(Info.t_s("List of channels, separated by comma."));
}
NETWORKMODULEDEFS(CStickyChan,
"configless sticky chans, keeps you there very stickily even")
NETWORKMODULEDEFS(
CStickyChan,
t_s("configless sticky chans, keeps you there very stickily even"))

View File

@@ -60,5 +60,5 @@ void TModInfo<CStripControlsMod>(CModInfo& Info) {
}
NETWORKMODULEDEFS(CStripControlsMod,
"Strips control codes (Colors, Bold, ..) from channel and "
"private messages.")
t_s("Strips control codes (Colors, Bold, ..) from channel "
"and private messages."))

View File

@@ -331,7 +331,7 @@ class CWatcherMod : public CModule {
SetSources(sCommand.Token(1).ToUInt(), sCommand.Token(2, true));
} else if (sCmdName.Equals("CLEAR")) {
m_lsWatchers.clear();
PutModule("All entries cleared.");
PutModule(t_s("All entries cleared."));
Save();
} else if (sCmdName.Equals("BUFFER")) {
CString sCount = sCommand.Token(1);
@@ -340,12 +340,12 @@ class CWatcherMod : public CModule {
m_Buffer.SetLineCount(sCount.ToUInt());
}
PutModule("Buffer count is set to [" +
CString(m_Buffer.GetLineCount()) + "]");
PutModule(
t_f("Buffer count is set to {1}")(m_Buffer.GetLineCount()));
} else if (sCmdName.Equals("DEL")) {
Remove(sCommand.Token(1).ToUInt());
} else {
PutModule("Unknown command: [" + sCmdName + "]");
PutModule(t_f("Unknown command: {1}")(sCmdName));
}
}
@@ -394,15 +394,15 @@ class CWatcherMod : public CModule {
(*it).SetDisabled(bDisabled);
}
PutModule(((bDisabled) ? "Disabled all entries."
: "Enabled all entries."));
PutModule(bDisabled ? t_s("Disabled all entries.")
: t_s("Enabled all entries."));
Save();
return;
}
uIdx--; // "convert" index to zero based
if (uIdx >= m_lsWatchers.size()) {
PutModule("Invalid Id");
PutModule(t_s("Invalid Id"));
return;
}
@@ -410,8 +410,10 @@ class CWatcherMod : public CModule {
for (unsigned int a = 0; a < uIdx; a++) ++it;
(*it).SetDisabled(bDisabled);
PutModule("Id " + CString(uIdx + 1) +
((bDisabled) ? " Disabled" : " Enabled"));
if (bDisabled)
PutModule(t_f("Id {1} disabled")(uIdx + 1));
else
PutModule(t_f("Id {1} enabled")(uIdx + 1));
Save();
}
@@ -422,15 +424,17 @@ class CWatcherMod : public CModule {
(*it).SetDetachedClientOnly(bDetachedClientOnly);
}
PutModule(CString("Set DetachedClientOnly for all entries to: ") +
((bDetachedClientOnly) ? "Yes" : "No"));
if (bDetachedClientOnly)
PutModule(t_s("Set DetachedClientOnly for all entries to Yes"));
else
PutModule(t_s("Set DetachedClientOnly for all entries to No"));
Save();
return;
}
uIdx--; // "convert" index to zero based
if (uIdx >= m_lsWatchers.size()) {
PutModule("Invalid Id");
PutModule(t_s("Invalid Id"));
return;
}
@@ -438,8 +442,10 @@ class CWatcherMod : public CModule {
for (unsigned int a = 0; a < uIdx; a++) ++it;
(*it).SetDetachedClientOnly(bDetachedClientOnly);
PutModule("Id " + CString(uIdx + 1) + " set to: " +
((bDetachedClientOnly) ? "Yes" : "No"));
if (bDetachedClientOnly)
PutModule(t_f("Id {1} set to Yes")(uIdx + 1));
else
PutModule(t_f("Id {1} set to No")(uIdx + 1));
Save();
}
@@ -450,15 +456,18 @@ class CWatcherMod : public CModule {
(*it).SetDetachedChannelOnly(bDetachedChannelOnly);
}
PutModule(CString("Set DetachedChannelOnly for all entries to: ") +
((bDetachedChannelOnly) ? "Yes" : "No"));
if (bDetachedChannelOnly)
PutModule(
t_s("Set DetachedChannelOnly for all entries to Yes"));
else
PutModule(t_s("Set DetachedChannelOnly for all entries to No"));
Save();
return;
}
uIdx--; // "convert" index to zero based
if (uIdx >= m_lsWatchers.size()) {
PutModule("Invalid Id");
PutModule(t_s("Invalid Id"));
return;
}
@@ -466,21 +475,23 @@ class CWatcherMod : public CModule {
for (unsigned int a = 0; a < uIdx; a++) ++it;
(*it).SetDetachedChannelOnly(bDetachedChannelOnly);
PutModule("Id " + CString(uIdx + 1) + " set to: " +
((bDetachedChannelOnly) ? "Yes" : "No"));
if (bDetachedChannelOnly)
PutModule(t_f("Id {1} set to Yes")(uIdx + 1));
else
PutModule(t_f("Id {1} set to No")(uIdx + 1));
Save();
}
void List() {
CTable Table;
Table.AddColumn("Id");
Table.AddColumn("HostMask");
Table.AddColumn("Target");
Table.AddColumn("Pattern");
Table.AddColumn("Sources");
Table.AddColumn("Off");
Table.AddColumn("DetachedClientOnly");
Table.AddColumn("DetachedChannelOnly");
Table.AddColumn(t_s("Id"));
Table.AddColumn(t_s("HostMask"));
Table.AddColumn(t_s("Target"));
Table.AddColumn(t_s("Pattern"));
Table.AddColumn(t_s("Sources"));
Table.AddColumn(t_s("Off"));
Table.AddColumn(t_s("DetachedClientOnly"));
Table.AddColumn(t_s("DetachedChannelOnly"));
unsigned int uIdx = 1;
@@ -489,28 +500,31 @@ class CWatcherMod : public CModule {
CWatchEntry& WatchEntry = *it;
Table.AddRow();
Table.SetCell("Id", CString(uIdx));
Table.SetCell("HostMask", WatchEntry.GetHostMask());
Table.SetCell("Target", WatchEntry.GetTarget());
Table.SetCell("Pattern", WatchEntry.GetPattern());
Table.SetCell("Sources", WatchEntry.GetSourcesStr());
Table.SetCell("Off", (WatchEntry.IsDisabled()) ? "Off" : "");
Table.SetCell("DetachedClientOnly",
(WatchEntry.IsDetachedClientOnly()) ? "Yes" : "No");
Table.SetCell("DetachedChannelOnly",
(WatchEntry.IsDetachedChannelOnly()) ? "Yes" : "No");
Table.SetCell(t_s("Id"), CString(uIdx));
Table.SetCell(t_s("HostMask"), WatchEntry.GetHostMask());
Table.SetCell(t_s("Target"), WatchEntry.GetTarget());
Table.SetCell(t_s("Pattern"), WatchEntry.GetPattern());
Table.SetCell(t_s("Sources"), WatchEntry.GetSourcesStr());
Table.SetCell(t_s("Off"),
(WatchEntry.IsDisabled()) ? t_s("Off") : "");
Table.SetCell(
t_s("DetachedClientOnly"),
WatchEntry.IsDetachedClientOnly() ? t_s("Yes") : t_s("No"));
Table.SetCell(
t_s("DetachedChannelOnly"),
WatchEntry.IsDetachedChannelOnly() ? t_s("Yes") : t_s("No"));
}
if (Table.size()) {
PutModule(Table);
} else {
PutModule("You have no entries.");
PutModule(t_s("You have no entries."));
}
}
void Dump() {
if (m_lsWatchers.empty()) {
PutModule("You have no entries.");
PutModule(t_s("You have no entries."));
return;
}
@@ -553,7 +567,7 @@ class CWatcherMod : public CModule {
void SetSources(unsigned int uIdx, const CString& sSources) {
uIdx--; // "convert" index to zero based
if (uIdx >= m_lsWatchers.size()) {
PutModule("Invalid Id");
PutModule(t_s("Invalid Id"));
return;
}
@@ -561,14 +575,14 @@ class CWatcherMod : public CModule {
for (unsigned int a = 0; a < uIdx; a++) ++it;
(*it).SetSources(sSources);
PutModule("Sources set for Id " + CString(uIdx + 1) + ".");
PutModule(t_f("Sources set for Id {1}.")(uIdx + 1));
Save();
}
void Remove(unsigned int uIdx) {
uIdx--; // "convert" index to zero based
if (uIdx >= m_lsWatchers.size()) {
PutModule("Invalid Id");
PutModule(t_s("Invalid Id"));
return;
}
@@ -576,71 +590,79 @@ class CWatcherMod : public CModule {
for (unsigned int a = 0; a < uIdx; a++) ++it;
m_lsWatchers.erase(it);
PutModule("Id " + CString(uIdx + 1) + " Removed.");
PutModule(t_f("Id {1} removed.")(uIdx + 1));
Save();
}
void Help() {
CTable Table;
Table.AddColumn("Command");
Table.AddColumn("Description");
Table.AddColumn(t_s("Command"));
Table.AddColumn(t_s("Description"));
Table.AddRow();
Table.SetCell("Command", "Add <HostMask> [Target] [Pattern]");
Table.SetCell("Description", "Used to add an entry to watch for.");
Table.SetCell(t_s("Command"), t_s("Add <HostMask> [Target] [Pattern]"));
Table.SetCell(t_s("Description"),
t_s("Used to add an entry to watch for."));
Table.AddRow();
Table.SetCell("Command", "List");
Table.SetCell("Description", "List all entries being watched.");
Table.SetCell(t_s("Command"), t_s("List"));
Table.SetCell(t_s("Description"),
t_s("List all entries being watched."));
Table.AddRow();
Table.SetCell("Command", "Dump");
Table.SetCell("Description",
"Dump a list of all current entries to be used later.");
Table.SetCell(t_s("Command"), t_s("Dump"));
Table.SetCell(
t_s("Description"),
t_s("Dump a list of all current entries to be used later."));
Table.AddRow();
Table.SetCell("Command", "Del <Id>");
Table.SetCell("Description",
"Deletes Id from the list of watched entries.");
Table.SetCell(t_s("Command"), t_s("Del <Id>"));
Table.SetCell(t_s("Description"),
t_s("Deletes Id from the list of watched entries."));
Table.AddRow();
Table.SetCell("Command", "Clear");
Table.SetCell("Description", "Delete all entries.");
Table.SetCell(t_s("Command"), t_s("Clear"));
Table.SetCell(t_s("Description"), t_s("Delete all entries."));
Table.AddRow();
Table.SetCell("Command", "Enable <Id | *>");
Table.SetCell("Description", "Enable a disabled entry.");
Table.SetCell(t_s("Command"), t_s("Enable <Id | *>"));
Table.SetCell(t_s("Description"), t_s("Enable a disabled entry."));
Table.AddRow();
Table.SetCell("Command", "Disable <Id | *>");
Table.SetCell("Description", "Disable (but don't delete) an entry.");
Table.SetCell(t_s("Command"), t_s("Disable <Id | *>"));
Table.SetCell(t_s("Description"),
t_s("Disable (but don't delete) an entry."));
Table.AddRow();
Table.SetCell("Command",
"SetDetachedClientOnly <Id | *> <True | False>");
Table.SetCell("Description",
"Enable or disable detached client only for an entry.");
Table.SetCell(t_s("Command"),
t_s("SetDetachedClientOnly <Id | *> <True | False>"));
Table.SetCell(
t_s("Description"),
t_s("Enable or disable detached client only for an entry."));
Table.AddRow();
Table.SetCell("Command",
"SetDetachedChannelOnly <Id | *> <True | False>");
Table.SetCell("Description",
"Enable or disable detached channel only for an entry.");
Table.SetCell(t_s("Command"),
t_s("SetDetachedChannelOnly <Id | *> <True | False>"));
Table.SetCell(
t_s("Description"),
t_s("Enable or disable detached channel only for an entry."));
Table.AddRow();
Table.SetCell("Command", "Buffer [Count]");
Table.SetCell("Description",
"Show/Set the amount of buffered lines while detached.");
Table.SetCell(t_s("Command"), t_s("Buffer [Count]"));
Table.SetCell(
t_s("Description"),
t_s("Show/Set the amount of buffered lines while detached."));
Table.AddRow();
Table.SetCell("Command", "SetSources <Id> [#chan priv #foo* !#bar]");
Table.SetCell("Description",
"Set the source channels that you care about.");
Table.SetCell(t_s("Command"),
t_s("SetSources <Id> [#chan priv #foo* !#bar]"));
Table.SetCell(t_s("Description"),
t_s("Set the source channels that you care about."));
Table.AddRow();
Table.SetCell("Command", "Help");
Table.SetCell("Description", "This help.");
Table.SetCell(t_s("Command"), t_s("Help"));
Table.SetCell(t_s("Description"), t_s("This help."));
PutModule(Table);
}
@@ -656,23 +678,21 @@ class CWatcherMod : public CModule {
for (list<CWatchEntry>::iterator it = m_lsWatchers.begin();
it != m_lsWatchers.end(); ++it) {
if (*it == WatchEntry) {
sMessage = "Entry for [" + WatchEntry.GetHostMask() +
"] already exists.";
sMessage = t_f("Entry for {1} already exists.")(
WatchEntry.GetHostMask());
bExists = true;
break;
}
}
if (!bExists) {
sMessage = "Adding entry: [" + WatchEntry.GetHostMask() +
"] watching for "
"[" +
WatchEntry.GetPattern() + "] -> [" +
WatchEntry.GetTarget() + "]";
sMessage = t_f("Adding entry: {1} watching for [{2}] -> {3}")(
WatchEntry.GetHostMask(), WatchEntry.GetPattern(),
WatchEntry.GetTarget());
m_lsWatchers.push_back(WatchEntry);
}
} else {
sMessage = "Watch: Not enough arguments. Try Help";
sMessage = t_s("Watch: Not enough arguments. Try Help");
}
if (bNotice) {
@@ -740,7 +760,8 @@ class CWatcherMod : public CModule {
m_lsWatchers.push_back(WatchEntry);
}
if (bWarn) PutModule("WARNING: malformed entry found while loading");
if (bWarn)
PutModule(t_s("WARNING: malformed entry found while loading"));
}
list<CWatchEntry> m_lsWatchers;
@@ -752,5 +773,6 @@ void TModInfo<CWatcherMod>(CModInfo& Info) {
Info.SetWikiPage("watch");
}
NETWORKMODULEDEFS(CWatcherMod,
"Copy activity from a specific user into a separate window")
NETWORKMODULEDEFS(
CWatcherMod,
t_s("Copy activity from a specific user into a separate window"))