Skip to content

Commit

Permalink
Add a Disablechan to match the Enablechan command
Browse files Browse the repository at this point in the history
  • Loading branch information
Cork committed May 2, 2013
1 parent f73d766 commit a3c6684
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/ClientCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,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");
Expand Down Expand Up @@ -1558,6 +1586,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>");
Expand Down

0 comments on commit a3c6684

Please sign in to comment.