mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Improve *autoreply responses to Show and Set commands.
Also make it translatable (#1354)
This commit is contained in:
@@ -22,12 +22,10 @@ class CAutoReplyMod : public CModule {
|
||||
public:
|
||||
MODCONSTRUCTOR(CAutoReplyMod) {
|
||||
AddHelpCommand();
|
||||
AddCommand("Set", static_cast<CModCommand::ModCmdFunc>(
|
||||
&CAutoReplyMod::OnSetCommand),
|
||||
"<reply>", "Sets a new reply");
|
||||
AddCommand("Show", static_cast<CModCommand::ModCmdFunc>(
|
||||
&CAutoReplyMod::OnShowCommand),
|
||||
"", "Displays the current query reply");
|
||||
AddCommand("Set", t_d("<reply>"), t_d("Sets a new reply"),
|
||||
[=](const CString& sLine) { OnSetCommand(sLine); });
|
||||
AddCommand("Show", "", t_d("Displays the current query reply"),
|
||||
[=](const CString& sLine) { OnShowCommand(sLine); });
|
||||
m_Messaged.SetTTL(1000 * 120);
|
||||
}
|
||||
|
||||
@@ -73,13 +71,14 @@ class CAutoReplyMod : public CModule {
|
||||
}
|
||||
|
||||
void OnShowCommand(const CString& sCommand) {
|
||||
PutModule("Current reply is: " + GetNV("Reply") + " (" + GetReply() +
|
||||
")");
|
||||
CString sReply = GetReply();
|
||||
PutModule(t_f("Current reply is: {1} ({2})")(GetNV("Reply"), sReply));
|
||||
}
|
||||
|
||||
void OnSetCommand(const CString& sCommand) {
|
||||
SetReply(sCommand.Token(1, true));
|
||||
PutModule("New reply set");
|
||||
PutModule(
|
||||
t_f("New reply set to: {1} ({2})")(GetNV("Reply"), GetReply()));
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -91,9 +90,9 @@ void TModInfo<CAutoReplyMod>(CModInfo& Info) {
|
||||
Info.SetWikiPage("autoreply");
|
||||
Info.AddType(CModInfo::NetworkModule);
|
||||
Info.SetHasArgs(true);
|
||||
Info.SetArgsHelpText(
|
||||
Info.SetArgsHelpText(Info.t_s(
|
||||
"You might specify a reply text. It is used when automatically "
|
||||
"answering queries, if you are not connected to ZNC.");
|
||||
"answering queries, if you are not connected to ZNC."));
|
||||
}
|
||||
|
||||
USERMODULEDEFS(CAutoReplyMod, "Reply to queries when you are away")
|
||||
USERMODULEDEFS(CAutoReplyMod, t_s("Reply to queries when you are away"))
|
||||
|
||||
Reference in New Issue
Block a user