summaryrefslogtreecommitdiff
path: root/modules/pseudoclients/memoserv/memoinfo.cpp
blob: a51cd4e6a1b5646b5e7faf6b0687efedd66bac3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#include "memoinfo.h"

MemoServ::Memo *MemoInfoImpl::GetMemo(unsigned index) const
{
	if (index >= this->memos->size())
		return NULL;
	MemoServ::Memo *m = (*memos)[index];
	m->QueueUpdate();
	return m;
}

unsigned MemoInfoImpl::GetIndex(MemoServ::Memo *m) const
{
	for (unsigned i = 0; i < this->memos->size(); ++i)
		if (this->GetMemo(i) == m)
			return i;
	return -1;
}

void MemoInfoImpl::Del(unsigned index)
{
	if (index >= this->memos->size())
		return;
	delete this->GetMemo(index);
}

bool MemoInfoImpl::HasIgnore(User *u)
{
	for (unsigned i = 0; i < this->ignores.size(); ++i)
		if (u->nick.equals_ci(this->ignores[i]) || (u->Account() && u->Account()->display.equals_ci(this->ignores[i])) || Anope::Match(u->GetMask(), Anope::string(this->ignores[i])))
			return true;
	return false;
}