Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a Disablechan to match the Enablechan command

  • Loading branch information...
commit a3c6684d49d2b0cdc0cc0d5d25f65c4d07afd8b9 1 parent f73d766
Cork authored
Showing with 33 additions and 0 deletions.
  1. +33 −0 src/ClientCommand.cpp
View
33 src/ClientCommand.cpp
@@ -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");
@@ -1559,6 +1587,11 @@ void CClient::HelpUser() {
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>");
Table.SetCell("Description", "Detach from the channel");
Please sign in to comment.
Something went wrong with that request. Please try again.