mirror of
https://github.com/znc/znc.git
synced 2026-05-06 13:32:36 +02:00
Let a user filter the result of help CModule::HandleHelpCommand
This commit is contained in:
11
Modules.cpp
11
Modules.cpp
@@ -414,7 +414,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)
|
||||
@@ -448,12 +448,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