mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Merge pull request #341 from cork/master
Add irc command to allow disabling channel
This commit is contained in:
@@ -383,6 +383,34 @@ void CClient::UserCommand(CString& sLine) {
|
||||
PutStatus("There were [" + CString(uMatches) + "] channels matching [" + sChan + "]");
|
||||
PutStatus("Enabled [" + CString(uEnabled) + "] channels");
|
||||
}
|
||||
} else if (sCommand.Equals("DISABLECHAN")) {
|
||||
if (!m_pNetwork) {
|
||||
PutStatus("You must be connected with a network to use this command");
|
||||
return;
|
||||
}
|
||||
|
||||
CString sChan = sLine.Token(1, true);
|
||||
|
||||
if (sChan.empty()) {
|
||||
PutStatus("Usage: DisableChan <channel>");
|
||||
} else {
|
||||
const vector<CChan*>& vChans = m_pNetwork->GetChans();
|
||||
vector<CChan*>::const_iterator it;
|
||||
unsigned int uMatches = 0, uDisabled = 0;
|
||||
for (it = vChans.begin(); it != vChans.end(); ++it) {
|
||||
if (!(*it)->GetName().WildCmp(sChan))
|
||||
continue;
|
||||
uMatches++;
|
||||
|
||||
if ((*it)->IsDisabled())
|
||||
continue;
|
||||
uDisabled++;
|
||||
(*it)->Disable();
|
||||
}
|
||||
|
||||
PutStatus("There were [" + CString(uMatches) + "] channels matching [" + sChan + "]");
|
||||
PutStatus("Disabled [" + CString(uDisabled) + "] channels");
|
||||
}
|
||||
} else if (sCommand.Equals("LISTCHANS")) {
|
||||
if (!m_pNetwork) {
|
||||
PutStatus("You must be connected with a network to use this command");
|
||||
@@ -1572,6 +1600,11 @@ void CClient::HelpUser() {
|
||||
Table.SetCell("Arguments", "<#chan>");
|
||||
Table.SetCell("Description", "Enable the channel");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Disablechan");
|
||||
Table.SetCell("Arguments", "<#chan>");
|
||||
Table.SetCell("Description", "Disable the channel");
|
||||
|
||||
Table.AddRow();
|
||||
Table.SetCell("Command", "Detach");
|
||||
Table.SetCell("Arguments", "<#chan>");
|
||||
|
||||
Reference in New Issue
Block a user