mirror of
https://github.com/znc/znc.git
synced 2026-05-07 13:54:47 +02:00
Let a user filter the result of help CModule::HandleHelpCommand
This commit is contained in:
committed by
Uli Schlachter
parent
7474c43902
commit
39f97a887d
+8
-3
@@ -411,7 +411,7 @@ bool CModule::AddCommand(const CString& sCmd, CModCommand::ModCmdFunc func, cons
|
||||
|
||||
void CModule::AddHelpCommand()
|
||||
{
|
||||
AddCommand("Help", &CModule::HandleHelpCommand, "", "Generate this output");
|
||||
AddCommand("Help", &CModule::HandleHelpCommand, "search", "Generate this output");
|
||||
}
|
||||
|
||||
bool CModule::RemCommand(const CString& sCmd)
|
||||
@@ -445,12 +445,17 @@ bool CModule::HandleCommand(const CString& sLine) {
|
||||
}
|
||||
|
||||
void CModule::HandleHelpCommand(const CString& sLine) {
|
||||
CString sFilter = sLine.Token(1, true);
|
||||
unsigned int iFilterLength = sFilter.size();
|
||||
CTable Table;
|
||||
map<CString, CModCommand>::const_iterator it;
|
||||
|
||||
CModCommand::InitHelp(Table);
|
||||
for (it = m_mCommands.begin(); it != m_mCommands.end(); ++it)
|
||||
it->second.AddHelp(Table);
|
||||
for (it = m_mCommands.begin(); it != m_mCommands.end(); ++it) {
|
||||
if (sFilter.empty() || (it->second.GetCommand().Equals(sFilter, false, iFilterLength))) {
|
||||
it->second.AddHelp(Table);
|
||||
}
|
||||
}
|
||||
PutModule(Table);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user