diff --git a/include/znc/Modules.h b/include/znc/Modules.h index 36638d57..9dc5bc85 100644 --- a/include/znc/Modules.h +++ b/include/znc/Modules.h @@ -352,7 +352,8 @@ class CModCommand { */ CModCommand(const CString& sCmd, CModule* pMod, ModCmdFunc func, const CString& sArgs, const CString& sDesc); - CModCommand(const CString& sCmd, CmdFunc func, const CString& sArgs, + CModCommand(const CString& sCmd, CmdFunc func, + const COptionalTranslation& Args, const COptionalTranslation& Desc); /** Copy constructor, needed so that this can be saved in a std::map. @@ -378,7 +379,7 @@ class CModCommand { const CString& GetCommand() const { return m_sCmd; } CmdFunc GetFunction() const { return m_pFunc; } - const CString& GetArgs() const { return m_sArgs; } + CString GetArgs() const { return m_Args.Resolve(); } CString GetDescription() const { return m_Desc.Resolve(); } void Call(const CString& sLine) const { m_pFunc(sLine); } @@ -386,7 +387,7 @@ class CModCommand { private: CString m_sCmd; CmdFunc m_pFunc; - CString m_sArgs; + COptionalTranslation m_Args; COptionalTranslation m_Desc; }; @@ -1150,8 +1151,8 @@ class CModule { const CString& sArgs = "", const CString& sDesc = ""); /// @param dDesc Either a string "", or the result of t_d() /// @return True if the command was successfully added. - bool AddCommand(const CString& sCmd, const CString& sArgs, - const COptionalTranslation& dDesc, + bool AddCommand(const CString& sCmd, const COptionalTranslation& Args, + const COptionalTranslation& Desc, std::function func); /// @return True if the command was successfully removed. bool RemCommand(const CString& sCmd); diff --git a/modules/adminlog.cpp b/modules/adminlog.cpp index dfbf54fb..f5b17836 100644 --- a/modules/adminlog.cpp +++ b/modules/adminlog.cpp @@ -28,7 +28,7 @@ class CAdminLogMod : public CModule { AddHelpCommand(); AddCommand("Show", "", t_d("Show the logging target"), [=](const CString& sLine) { OnShowCommand(sLine); }); - AddCommand("Target", " [path]", + AddCommand("Target", t_d(" [path]"), t_d("Set the logging target"), [=](const CString& sLine) { OnTargetCommand(sLine); }); openlog("znc", LOG_PID, LOG_DAEMON); diff --git a/modules/alias.cpp b/modules/alias.cpp index 3ad5e4be..85b69de5 100644 --- a/modules/alias.cpp +++ b/modules/alias.cpp @@ -335,26 +335,26 @@ class CAliasMod : public CModule { MODCONSTRUCTOR(CAliasMod), sending_lines(false) { AddHelpCommand(); - AddCommand("Create", "", + AddCommand("Create", t_d(""), t_d("Creates a new, blank alias called name."), [=](const CString& sLine) { CreateCommand(sLine); }); - AddCommand("Delete", "", t_d("Deletes an existing alias."), + AddCommand("Delete", t_d(""), t_d("Deletes an existing alias."), [=](const CString& sLine) { DeleteCommand(sLine); }); - AddCommand("Add", " ", + AddCommand("Add", t_d(" "), t_d("Adds a line to an existing alias."), [=](const CString& sLine) { AddCmd(sLine); }); - AddCommand("Insert", " ", + AddCommand("Insert", t_d(" "), t_d("Inserts a line into an existing alias."), [=](const CString& sLine) { InsertCommand(sLine); }); - AddCommand("Remove", " ", + AddCommand("Remove", t_d(" "), t_d("Removes a line from an existing alias."), [=](const CString& sLine) { RemoveCommand(sLine); }); - AddCommand("Clear", "", + AddCommand("Clear", t_d(""), t_d("Removes all lines from an existing alias."), [=](const CString& sLine) { ClearCommand(sLine); }); AddCommand("List", "", t_d("Lists all aliases by name."), [=](const CString& sLine) { ListCommand(sLine); }); - AddCommand("Info", "", + AddCommand("Info", t_d(""), t_d("Reports the actions performed by an alias."), [=](const CString& sLine) { InfoCommand(sLine); }); AddCommand( diff --git a/modules/po/adminlog.pot b/modules/po/adminlog.pot index 4977d589..8136074a 100644 --- a/modules/po/adminlog.pot +++ b/modules/po/adminlog.pot @@ -2,6 +2,10 @@ msgid "Show the logging target" msgstr "" +#: adminlog.cpp:31 +msgid " [path]" +msgstr "" + #: adminlog.cpp:32 msgid "Set the logging target" msgstr "" diff --git a/modules/po/alias.pot b/modules/po/alias.pot index 37211c0a..c0a54a9e 100644 --- a/modules/po/alias.pot +++ b/modules/po/alias.pot @@ -15,7 +15,7 @@ msgid "Deleted alias: {1}" msgstr "" #: alias.cpp:213 alias.cpp:224 alias.cpp:246 alias.cpp:265 alias.cpp:276 -#: alias.cpp:332 +#: alias.cpp:333 msgid "Alias does not exist." msgstr "" @@ -44,50 +44,66 @@ msgstr "" msgid "Actions for alias {1}:" msgstr "" -#: alias.cpp:330 +#: alias.cpp:331 msgid "End of actions for alias {1}." msgstr "" -#: alias.cpp:338 +#: alias.cpp:338 alias.cpp:341 alias.cpp:352 alias.cpp:357 +msgid "" +msgstr "" + +#: alias.cpp:339 msgid "Creates a new, blank alias called name." msgstr "" -#: alias.cpp:340 +#: alias.cpp:341 msgid "Deletes an existing alias." msgstr "" #: alias.cpp:343 +msgid " " +msgstr "" + +#: alias.cpp:344 msgid "Adds a line to an existing alias." msgstr "" #: alias.cpp:346 +msgid " " +msgstr "" + +#: alias.cpp:347 msgid "Inserts a line into an existing alias." msgstr "" #: alias.cpp:349 +msgid " " +msgstr "" + +#: alias.cpp:350 msgid "Removes a line from an existing alias." msgstr "" -#: alias.cpp:352 +#: alias.cpp:353 msgid "Removes all lines from an existing alias." msgstr "" -#: alias.cpp:354 +#: alias.cpp:355 msgid "Lists all aliases by name." msgstr "" -#: alias.cpp:357 +#: alias.cpp:358 msgid "Reports the actions performed by an alias." msgstr "" -#: alias.cpp:361 +#: alias.cpp:362 msgid "Generate a list of commands to copy your alias config." msgstr "" -#: alias.cpp:373 +#: alias.cpp:374 msgid "Clearing all of them!" msgstr "" -#: alias.cpp:408 +#: alias.cpp:409 msgid "Provides bouncer-side command alias support." msgstr "" diff --git a/src/Modules.cpp b/src/Modules.cpp index 588a7178..7e7dd8bd 100644 --- a/src/Modules.cpp +++ b/src/Modules.cpp @@ -517,10 +517,10 @@ bool CModule::AddCommand(const CString& sCmd, CModCommand::ModCmdFunc func, return AddCommand(cmd); } -bool CModule::AddCommand(const CString& sCmd, const CString& sArgs, +bool CModule::AddCommand(const CString& sCmd, const COptionalTranslation& Args, const COptionalTranslation& Desc, std::function func) { - CModCommand cmd(sCmd, std::move(func), sArgs, Desc); + CModCommand cmd(sCmd, std::move(func), Args, Desc); return AddCommand(std::move(cmd)); } @@ -1958,18 +1958,19 @@ ModHandle CModules::OpenModule(const CString& sModule, const CString& sModPath, } CModCommand::CModCommand() - : m_sCmd(), m_pFunc(nullptr), m_sArgs(), m_Desc("") {} + : m_sCmd(), m_pFunc(nullptr), m_Args(""), m_Desc("") {} CModCommand::CModCommand(const CString& sCmd, CModule* pMod, ModCmdFunc func, const CString& sArgs, const CString& sDesc) : m_sCmd(sCmd), m_pFunc([pMod, func](const CString& sLine) { (pMod->*func)(sLine); }), - m_sArgs(sArgs), + m_Args(sArgs), m_Desc(sDesc) {} CModCommand::CModCommand(const CString& sCmd, CmdFunc func, - const CString& sArgs, const COptionalTranslation& Desc) - : m_sCmd(sCmd), m_pFunc(std::move(func)), m_sArgs(sArgs), m_Desc(Desc) {} + const COptionalTranslation& Args, + const COptionalTranslation& Desc) + : m_sCmd(sCmd), m_pFunc(std::move(func)), m_Args(Args), m_Desc(Desc) {} void CModCommand::InitHelp(CTable& Table) { Table.AddColumn("Command");