bool Del(bool bNegated, const CString& sChan, const CString& sHost) { VAttachIter it = FindEntry(sChan, sHost); if (it == m_vMatches.end() || it->IsNegated() != bNegated) return false; DelNV(it->ToString()); m_vMatches.erase(it); return true; }
void TryAttach(const CNick& Nick, CChan& Channel, CString& Message) { const CString& sChan = Channel.GetName(); const CString& sHost = Nick.GetHostMask(); const CString& sMessage = Message; VAttachIter it; if (!Channel.IsDetached()) return; // Any negated match? for (it = m_vMatches.begin(); it != m_vMatches.end(); ++it) { if (it->IsNegated() && it->IsMatch(sChan, sHost, sMessage)) return; } // Now check for a positive match for (it = m_vMatches.begin(); it != m_vMatches.end(); ++it) { if (!it->IsNegated() && it->IsMatch(sChan, sHost, sMessage)) { Channel.AttachUser(); return; } } }
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."); } }