Permalink
Browse files

Merge branch 'master' of github.com:znc/znc

  • Loading branch information...
2 parents 412bdb7 + 19de8d3 commit 02504626bc35a333559ccb1768541331a25616e5 @DarthGandalf DarthGandalf committed Dec 24, 2012
Showing with 26 additions and 9 deletions.
  1. +3 −0 .gitignore
  2. +18 −7 src/Client.cpp
  3. +5 −2 src/ClientCommand.cpp
View
@@ -38,3 +38,6 @@ __pycache__
# Compiled Dynamic libraries
*.so
+# Makefile generates this
+.version_extra
+
View
@@ -380,20 +380,31 @@ void CClient::ReadLine(const CString& sData) {
}
if (sCommand.Equals("DETACH")) {
- CString sChan = sLine.Token(1);
+ CString sChannels = sLine.Token(1).TrimPrefix_n();
- if (sChan.empty()) {
+ if (sChannels.empty()) {
PutStatusNotice("Usage: /detach <#chan>");
return;
}
- CChan* pChan = m_pNetwork->FindChan(sChan);
- if (!pChan) {
- PutStatusNotice("You are not on [" + sChan + "]");
- return;
+ VCString vChans;
+ sChannels.Split(",", vChans, false);
+ sChannels.clear();
+
+ for (VCString::const_iterator channelIterator = vChans.begin();
+ channelIterator != vChans.end();
+ ++channelIterator)
+ {
+ CString sChannel = *channelIterator;
+
+ CChan *pChannel = m_pNetwork->FindChan(sChannel);
+ if (pChannel) {
+ pChannel->DetachUser();
+ } else {
+ PutStatusNotice("You are not on [" + sChannel + "]");
+ }
}
- pChan->DetachUser();
return;
} else if (sCommand.Equals("JOIN")) {
CString sChans = sLine.Token(1).TrimPrefix_n();
View
@@ -106,7 +106,7 @@ void CClient::UserCommand(CString& sLine) {
return;
}
- CString sChan = sLine.Token(1);
+ CString sChan = sLine.Token(1).MakeLower();
if (sChan.empty()) {
PutStatus("Usage: Detach <#chan>");
@@ -117,7 +117,10 @@ void CClient::UserCommand(CString& sLine) {
vector<CChan*>::const_iterator it;
unsigned int uMatches = 0, uDetached = 0;
for (it = vChans.begin(); it != vChans.end(); ++it) {
- if (!(*it)->GetName().WildCmp(sChan))
+ CChan *pChannel = *it;
+ CString channelName = pChannel->GetName().AsLower();
+
+ if (!channelName.WildCmp(sChan))
continue;
uMatches++;

0 comments on commit 0250462

Please sign in to comment.