本文整理汇总了C++中CommandSource::IsServicesOper方法的典型用法代码示例。如果您正苦于以下问题:C++ CommandSource::IsServicesOper方法的具体用法?C++ CommandSource::IsServicesOper怎么用?C++ CommandSource::IsServicesOper使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CommandSource
的用法示例。
在下文中一共展示了CommandSource::IsServicesOper方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnHelp
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
{
if (source.IsServicesOper())
source.Reply(_("Without a parameter, lists all nicknames that are in your group.\n"
"\n"
"With a parameter, lists all nicknames that are in the group of the given nick.\n"
"Specifying a nick is limited to \002Services Operators\002."),
source.command);
else
source.Reply(_("Lists all nicknames in your group."));
return true;
}
示例2: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
const Anope::string &nick = !params.empty() ? params[0] : "";
NickServ::Account *nc;
if (!nick.empty() && source.IsServicesOper())
{
NickServ::Nick *na = NickServ::FindNick(nick);
if (!na)
{
source.Reply(_("\002{0}\002 isn't registered."), nick);
return;
}
nc = na->GetAccount();
}
else
nc = source.GetAccount();
ListFormatter list(source.GetAccount());
list.AddColumn(_("Nick")).AddColumn(_("Expires"));
time_t nickserv_expire = Config->GetModule("nickserv")->Get<time_t>("expire", "21d"),
unconfirmed_expire = Config->GetModule("nickserv")->Get<time_t>("unconfirmedexpire", "1d");
for (NickServ::Nick *na2 : nc->GetRefs<NickServ::Nick *>())
{
Anope::string expires;
if (na2->HasFieldS("NS_NO_EXPIRE"))
expires = _("Does not expire");
else if (!nickserv_expire || Anope::NoExpire)
;
else if (na2->GetAccount()->HasFieldS("UNCONFIRMED") && unconfirmed_expire)
expires = Anope::strftime(na2->GetTimeRegistered() + unconfirmed_expire, source.GetAccount());
else
expires = Anope::strftime(na2->GetLastSeen() + nickserv_expire, source.GetAccount());
ListFormatter::ListEntry entry;
entry["Nick"] = na2->GetNick();
entry["Expires"] = expires;
list.AddEntry(entry);
}
source.Reply(nc != source.GetAccount() ? _("List of nicknames in the group of \002%s\002:") : _("List of nicknames in your group:"), nc->GetDisplay().c_str());
std::vector<Anope::string> replies;
list.Process(replies);
for (unsigned i = 0; i < replies.size(); ++i)
source.Reply(replies[i]);
source.Reply(_("%d nickname(s) in the group."), replies.size());
}
示例3: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
const Anope::string &nick = !params.empty() ? params[0] : "";
const Anope::string ¶m = params.size() > 1 ? params[1] : "";
if (!source.IsServicesOper() && !nick.empty())
{
this->OnSyntaxError(source);
return;
}
User *u2 = !nick.empty() ? User::Find(nick, true) : source.GetUser();
if (!u2)
{
source.Reply(_("\002{0}\002 isn't currently online."), !nick.empty() ? nick : source.GetNick());
return;
}
if (!nick.empty() && u2->IsServicesOper())
{
source.Reply(_("You can't logout \002{0}\002, they are a Services Operator."), nick);
return;
}
#warning "revalidate"
#if 0
if (!nick.empty() && !param.empty() && param.equals_ci("REVALIDATE") && NickServ::service)
NickServ::service->Validate(u2);
#endif
u2->super_admin = false; /* Dont let people logout and remain a SuperAdmin */
// XXX show account name here?
logger.Command(LogType::COMMAND, source, _("{source} used {command} to logout {0}"), u2->nick);
if (!nick.empty())
source.Reply(_("\002{0}\002 has been logged out."), nick);
else
source.Reply(_("You have been logged out."));
IRCD->Send<messages::Logout>(u2);
u2->RemoveMode(source.service, "REGISTERED");
u2->Logout();
/* Send out an event */
EventManager::Get()->Dispatch(&Event::NickLogout::OnNickLogout, u2);
}
示例4: OnHelp
bool OnHelp(CommandSource &source, const Anope::string &subcommand) override
{
if (subcommand.empty())
{
CommandInfo *help = source.service->FindCommand("generic/help");
if (!help)
return false;
source.Reply(_("Sets various memo options. \037option\037 can be one of:\n"
"\n"
" NOTIFY Changes when you will be notified about\n"
" new memos (only for nicknames)\n"
" LIMIT Sets the maximum number of memos you can\n"
" receive\n"
"\n"
"Type \002{0}{1} {2} {3} \037option\037\002 for more information on a specific option."),
Config->StrictPrivmsg, source.service->nick, help->cname, source.command);
}
else if (subcommand.equals_ci("NOTIFY"))
source.Reply(_("Syntax: \002NOTIFY {ON | LOGON | NEW | MAIL | NOMAIL | OFF}\002\n"
"\n"
"Changes when you will be notified about new memos:\n"
"\n"
" ON You will be notified of memos when you log on,\n"
" when you unset /AWAY, and when they are sent\n"
" to you.\n"
"\n"
" LOGON You will only be notified of memos when you log\n"
" on or when you unset /AWAY.\n"
"\n"
" NEW You will only be notified of memos when they\n"
" are sent to you.\n"
"\n"
" MAIL You will be notified of memos by email as well as\n"
" any other settings you have.\n"
"\n"
" NOMAIL You will not be notified of memos by email.\n"
"\n"
" OFF You will not receive any notification of memos.\n"
"\n"
"\002ON\002 is essentially \002LOGON\002 and \002NEW\002 combined."));
else if (subcommand.equals_ci("LIMIT"))
{
int max_memos = Config->GetModule("memoserv")->Get<int>("maxmemos");
if (source.IsServicesOper())
source.Reply(_("Syntax: \002LIMIT [\037user\037 | \037channel\037] {\037limit\037 | NONE} [HARD]\002\n"
"\n"
"Sets the maximum number of memos a user or channel is allowed to have."
" Setting the limit to 0 prevents the user from receiving any memos; setting it to \002NONE\002 allows the user to receive and keep as many memos as they want."
" If you do not give a nickname or channel, your own limit is set.\n"
"\n"
"Adding \002HARD\002 prevents the user from changing the limit."
" Not adding \002HARD\002 has the opposite effect, allowing the user to change the limit, even if a previous limit was set.\n"
" \n"
"This use of the \002{0} LIMIT\002 command is limited to \002Services Operators\002."
" Other users may only enter a limit for themselves or a channel on which they have the \002MEMO\002 privilege on, may not remove their limit, may not set a limit above {1}, and may not set a hard limit."),
source.command, max_memos);
else
source.Reply(_("Syntax: \002LIMIT [\037channel\037] \037limit\037\002\n"
"\n"
"Sets the maximum number of memos you, or the given channel, are allowed to have."
" If you set this to 0, no one will be able to send any memos to you."
"However, you cannot set this any higher than {0}."), max_memos);
}
else
return false;
return true;
}