Esempio n. 1
0
 VAttachIter FindEntry(const CString& sChan, const CString& sSearch,
                       const CString& sHost) {
     VAttachIter it = m_vMatches.begin();
     for (; it != m_vMatches.end(); ++it) {
         if (sHost.empty() || it->GetHostMask() != sHost) continue;
         if (sSearch.empty() || it->GetSearch() != sSearch) continue;
         if (sChan.empty() || it->GetChans() != sChan) continue;
         return it;
     }
     return m_vMatches.end();
 }
Esempio n. 2
0
	bool Add(bool bNegated, const CString& sChan, const CString& sSearch, const CString& sHost) {
		CAttachMatch attach(this, sChan, sSearch, 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()
					&& it->GetSearch() == attach.GetSearch())
				return false;
		}

		m_vMatches.push_back(attach);

		// Also save it for next module load
		SetNV(attach.ToString(), "");

		return true;
	}
Esempio n. 3
0
	void HandleList(const CString& sLine) {
		CTable Table;
		Table.AddColumn("Neg");
		Table.AddColumn("Chan");
		Table.AddColumn("Search");
		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("Search", it->GetSearch());
			Table.SetCell("Host", it->GetHostMask());
		}

		if (Table.size()) {
			PutModule(Table);
		} else {
			PutModule("You have no entries.");
		}
	}