Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

controlpanel: make delchan support wildcards (resolves #609)

  • Loading branch information...
commit e48fe0a4fc194c6fa1c1270412c1c73b15b8ed13 1 parent 700c899
@jpnurmi jpnurmi authored
Showing with 11 additions and 6 deletions.
  1. +11 −6 modules/controlpanel.cpp
View
17 modules/controlpanel.cpp
@@ -620,16 +620,21 @@ class CAdminMod : public CModule {
return;
}
- CChan* pChan = pNetwork->FindChan(sChan);
- if (!pChan) {
- PutModule("Error: User [" + sUsername + "] does not have a channel named [" + sChan + "].");
+ std::vector<CChan*> vChans = pNetwork->FindChans(sChan);
+ if (vChans.empty()) {
+ PutModule("Error: User [" + sUsername + "] does not have any channel matching [" + sChan + "].");
return;
}
- pNetwork->DelChan(sChan);
- pNetwork->PutIRC("PART " + sChan);
+ VCString vsNames;
+ for (const CChan* pChan : vChans) {
+ const CString& sName = pChan->GetName();
+ vsNames.push_back(sName);
+ pNetwork->PutIRC("PART " + sName);
+ pNetwork->DelChan(sName);
+ }
- PutModule("Channel [" + sChan + "] for user [" + sUsername + "] deleted.");
+ PutModule("Channel(s) [" + CString(",").Join(vsNames.begin(), vsNames.end()) + "] for user [" + sUsername + "] deleted.");
}
void GetChan(const CString& sLine) {
Please sign in to comment.
Something went wrong with that request. Please try again.