VAttachIter FindEntry(const CString& sChan, const CString& sHost) { VAttachIter it = m_vMatches.begin(); for (; it != m_vMatches.end(); ++it) { if (sHost.empty() || it->GetHostMask() != sHost) continue; if (sChan.empty() || it->GetChans() != sChan) continue; return it; } return m_vMatches.end(); }
bool Add(bool bNegated, const CString& sChan, const CString& sHost) { CAttachMatch attach(sChan, sHost, bNegated); // Check for duplicates VAttachIter it = m_vMatches.begin(); for (; it != m_vMatches.end(); ++it) { if (it->GetHostMask() == attach.GetHostMask() && it->GetChans() == attach.GetChans()) return false; } m_vMatches.push_back(attach); // Also save it for next module load SetNV(attach.ToString(), ""); return true; }
void HandleList(const CString& sLine) { CTable Table; Table.AddColumn("Neg"); Table.AddColumn("Chan"); Table.AddColumn("Host"); VAttachIter it = m_vMatches.begin(); for (; it != m_vMatches.end(); ++it) { Table.AddRow(); Table.SetCell("Neg", it->IsNegated() ? "!" : ""); Table.SetCell("Chan", it->GetChans()); Table.SetCell("Host", it->GetHostMask()); } if (Table.size()) { PutModule(Table); } else { PutModule("You have no entries."); } }