本文整理汇总了C++中chanserv::Channel::HasFieldS方法的典型用法代码示例。如果您正苦于以下问题:C++ Channel::HasFieldS方法的具体用法?C++ Channel::HasFieldS怎么用?C++ Channel::HasFieldS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chanserv::Channel
的用法示例。
在下文中一共展示了Channel::HasFieldS方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
const Anope::string &chan = params[0];
if (Anope::ReadOnly && !source.HasPriv("chanserv/administration"))
{
source.Reply(_("Sorry, channel de-registration is temporarily disabled."));
return;
}
ChanServ::Channel *ci = ChanServ::Find(chan);
if (ci == NULL)
{
source.Reply(_("Channel \002{0}\002 isn't registered."), chan);
return;
}
if (params.size() < 2 || !chan.equals_ci(params[1]))
{
source.Reply(_("You must enter the channel name twice as a confirmation that you wish to drop \002{0}\002."), ci->GetName());
return;
}
if ((ci->HasFieldS("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER")) && !source.HasCommand("chanserv/drop"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "FOUNDER", ci->GetName());
return;
}
EventReturn MOD_RESULT = this->onchandrop(&Event::ChanDrop::OnChanDrop, source, ci);
if (MOD_RESULT == EVENT_STOP)
return;
bool override = (ci->HasFieldS("SECUREFOUNDER") ? !source.IsFounder(ci) : !source.AccessFor(ci).HasPriv("FOUNDER"));
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "(founder was: " << (ci->GetFounder() ? ci->GetFounder()->GetDisplay() : "none") << ")";
Reference<Channel> c = ci->c;
ci->Delete();
source.Reply(_("Channel \002{0}\002 has been dropped."), chan);
if (c)
c->CheckModes();
}
示例2: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
const Anope::string &chan = params[0];
const Anope::string &nick = params[1];
if (Anope::ReadOnly)
{
source.Reply(_("Sorry, bot assignment is temporarily disabled."));
return;
}
ChanServ::Channel *ci = ChanServ::Find(chan);
if (ci == NULL)
{
source.Reply(_("Channel \002{0}\002 isn't registered."), chan);
return;
}
ServiceBot *bi = ServiceBot::Find(nick, true);
if (!bi)
{
source.Reply(_("Bot \002{0}\002 does not exist."), nick);
return;
}
ChanServ::AccessGroup access = source.AccessFor(ci);
if (!access.HasPriv("ASSIGN") && !source.HasPriv("botserv/administration"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "ASSIGN", ci->GetName());
return;
}
if (ci->HasFieldS("BS_NOBOT"))
{
source.Reply(_("Access denied. \002{0}\002 may not have a bot assigned to it because a Services Operator has disallowed it."), ci->GetName());
return;
}
if (bi->bi->GetOperOnly() && !source.HasPriv("botserv/administration"))
{
source.Reply(_("Access denied. Bot \002{0}\002 is for operators only."), bi->nick);
return;
}
if (ci->GetBot() == bi)
{
source.Reply(_("Bot \002{0}\002 is already assigned to \002{1}\002."), ci->GetBot()->nick, ci->GetName());
return;
}
bool override = !access.HasPriv("ASSIGN");
Log(override ? LOG_OVERRIDE : LOG_COMMAND, source, this, ci) << "for " << bi->nick;
bi->Assign(source.GetUser(), ci);
source.Reply(_("Bot \002{0}\002 has been assigned to \002{1}\002."), bi->nick, ci->GetName());
}
示例3: DoLimit
void DoLimit(CommandSource &source, const std::vector<Anope::string> ¶ms, MemoServ::MemoInfo *mi)
{
Anope::string p1 = params[1];
Anope::string p2 = params.size() > 2 ? params[2] : "";
Anope::string p3 = params.size() > 3 ? params[3] : "";
Anope::string user, chan;
int16_t limit;
NickServ::Account *nc = source.nc;
ChanServ::Channel *ci = NULL;
bool is_servadmin = source.HasPriv("memoserv/set-limit");
if (p1[0] == '#')
{
chan = p1;
p1 = p2;
p2 = p3;
p3 = params.size() > 4 ? params[4] : "";
ci = ChanServ::Find(chan);
if (!ci)
{
source.Reply(_("Channel \002{0}\002 isn't registered."), chan);
return;
}
if (!is_servadmin && !source.AccessFor(ci).HasPriv("MEMO"))
{
source.Reply(_("Access denied. You do not have privilege \002{0}\002 on \002{1}\002."), "MEMO", ci->GetName());
return;
}
mi = ci->GetMemos();
}
if (is_servadmin)
{
if (!p2.empty() && !p2.equals_ci("HARD") && chan.empty())
{
NickServ::Nick *na;
if (!(na = NickServ::FindNick(p1)))
{
source.Reply(_("\002{0}\002 isn't registered."), p1);
return;
}
user = p1;
mi = na->GetAccount()->GetMemos();
nc = na->GetAccount();
p1 = p2;
p2 = p3;
}
else if (p1.empty() || (!p1.is_pos_number_only() && !p1.equals_ci("NONE")) || (!p2.empty() && !p2.equals_ci("HARD")))
{
this->OnSyntaxError(source, "");
return;
}
if (!chan.empty())
{
if (!p2.empty())
ci->SetS<bool>("MEMO_HARDMAX", true);
else
ci->UnsetS<bool>("MEMO_HARDMAX");
}
else
{
if (!p2.empty())
nc->SetS<bool>("MEMO_HARDMAX", true);
else
nc->UnsetS<bool>("MEMO_HARDMAX");
}
limit = -1;
try
{
limit = convertTo<int16_t>(p1);
}
catch (const ConvertException &) { }
}
else
{
if (p1.empty() || !p2.empty() || !isdigit(p1[0]))
{
this->OnSyntaxError(source, "");
return;
}
if (!chan.empty() && ci->HasFieldS("MEMO_HARDMAX"))
{
source.Reply(_("The memo limit for \002{0}\002 may not be changed."), chan);
return;
}
if (chan.empty() && nc->HasFieldS("MEMO_HARDMAX"))
{
source.Reply(_("You are not permitted to change your memo limit."));
return;
}
int max_memos = Config->GetModule("memoserv")->Get<int>("maxmemos");
limit = -1;
try
{
limit = convertTo<int16_t>(p1);
}
catch (const ConvertException &) { }
/* The first character is a digit, but we could still go negative
//.........这里部分代码省略.........
示例4: 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);
}
}