Skip to content
Browse files

Merge pull request #500 from jpnurmi/find-chans

Add CIRCNetwork::FindChans()
  • Loading branch information...
2 parents 5237e89 + ed25ca2 commit 7d2f74acf407aab37b32a1fb02a230018afee31f @DarthGandalf DarthGandalf committed Mar 3, 2014
Showing with 11 additions and 0 deletions.
  1. +1 −0 include/znc/IRCNetwork.h
  2. +10 −0 src/IRCNetwork.cpp
View
1 include/znc/IRCNetwork.h
@@ -76,6 +76,7 @@ class CIRCNetwork {
const std::vector<CChan*>& GetChans() const;
CChan* FindChan(CString sName) const;
+ std::vector<CChan*> FindChans(const CString& sWild) const;
bool AddChan(CChan* pChan);
bool AddChan(const CString& sName, bool bInConfig);
bool DelChan(const CString& sName);
View
10 src/IRCNetwork.cpp
@@ -649,6 +649,16 @@ CChan* CIRCNetwork::FindChan(CString sName) const {
return NULL;
}
+std::vector<CChan*> CIRCNetwork::FindChans(const CString& sWild) const {
+ std::vector<CChan*> vChans;
+ vChans.reserve(m_vChans.size());
+ for (std::vector<CChan*>::const_iterator it = m_vChans.begin(); it != m_vChans.end(); ++it) {
+ if ((*it)->GetName().WildCmp(sWild))
+ vChans.push_back(*it);
+ }
+ return vChans;
+}
+
bool CIRCNetwork::AddChan(CChan* pChan) {
if (!pChan) {
return false;

0 comments on commit 7d2f74a

Please sign in to comment.
Something went wrong with that request. Please try again.