本文整理汇总了C++中Channel::MatchesList方法的典型用法代码示例。如果您正苦于以下问题:C++ Channel::MatchesList方法的具体用法?C++ Channel::MatchesList怎么用?C++ Channel::MatchesList使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Channel
的用法示例。
在下文中一共展示了Channel::MatchesList方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnUserLogin
void OnUserLogin(User *u) override
{
ServiceBot *NickServ = Config->GetClient("NickServ");
if (!NickServ)
return;
std::vector<AutoJoin *> channels = u->Account()->GetRefs<AutoJoin *>();
if (channels.empty())
return;
/* Set +r now, so we can ajoin users into +R channels */
ModeManager::ProcessModes();
for (AutoJoin *entry : channels)
{
Channel *c = Channel::Find(entry->GetChannel());
ChanServ::Channel *ci;
if (c)
ci = c->ci;
else
ci = ChanServ::Find(entry->GetChannel());
bool need_invite = false;
Anope::string key = entry->GetKey();
ChanServ::AccessGroup u_access;
if (ci != NULL)
{
if (ci->HasFieldS("CS_SUSPENDED"))
continue;
u_access = ci->AccessFor(u);
}
if (c != NULL)
{
if (c->FindUser(u) != NULL)
continue;
else if (c->HasMode("OPERONLY") && !u->HasMode("OPER"))
continue;
else if (c->HasMode("ADMINONLY") && !u->HasMode("ADMIN"))
continue;
else if (c->HasMode("SSL") && !(u->HasMode("SSL") || u->HasExtOK("ssl")))
continue;
else if (c->MatchesList(u, "BAN") == true && c->MatchesList(u, "EXCEPT") == false)
need_invite = true;
else if (c->HasMode("INVITE") && c->MatchesList(u, "INVITEOVERRIDE") == false)
need_invite = true;
if (c->HasMode("KEY"))
{
Anope::string k;
if (c->GetParam("KEY", k))
{
if (u_access.HasPriv("GETKEY"))
key = k;
else if (key != k)
need_invite = true;
}
}
if (c->HasMode("LIMIT"))
{
Anope::string l;
if (c->GetParam("LIMIT", l))
{
try
{
unsigned limit = convertTo<unsigned>(l);
if (c->users.size() >= limit)
need_invite = true;
}
catch (const ConvertException &) { }
}
}
}
if (need_invite && c != NULL)
{
if (!u_access.HasPriv("INVITE"))
continue;
IRCD->SendInvite(NickServ, c, u);
}
IRCD->SendSVSJoin(NickServ, u, entry->GetChannel(), key);
}
}