示例#1
0
文件: opertype.cpp 项目: Robby-/anope
bool Oper::HasPriv(const Anope::string &cmdstr)
{
	OperType *type = GetType();
	if (type != nullptr)
		return type->HasPriv(cmdstr);
	return false;
}
示例#2
0
文件: opertype.cpp 项目: Robby-/anope
bool OperType::HasPriv(const Anope::string &privstr) const
{
	for (std::list<Anope::string>::const_iterator it = this->privs.begin(), it_end = this->privs.end(); it != it_end; ++it)
	{
		const Anope::string &s = *it;

		if (!s.find('~') && Anope::Match(privstr, s.substr(1)))
			return false;
		else if (Anope::Match(privstr, s))
			return true;
	}
	for (std::set<OperType *>::const_iterator iit = this->inheritances.begin(), iit_end = this->inheritances.end(); iit != iit_end; ++iit)
	{
		OperType *ot = *iit;

		if (ot->HasPriv(privstr))
			return true;
	}

	return false;
}