本文整理汇总了C++中nickserv::Nick::HasFieldS方法的典型用法代码示例。如果您正苦于以下问题:C++ Nick::HasFieldS方法的具体用法?C++ Nick::HasFieldS怎么用?C++ Nick::HasFieldS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nickserv::Nick
的用法示例。
在下文中一共展示了Nick::HasFieldS方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSuccess
void OnSuccess(NickServ::IdentifyRequest *) override
{
User *u = User::Find(user, true);
if (!source.GetUser() || !source.service)
return;
NickServ::Nick *na = NickServ::FindNick(user);
if (!na)
return;
Log(LOG_COMMAND, source, cmd) << "for " << na->GetNick();
/* Nick is being held by us, release it */
if (na->HasFieldS("HELD"))
{
NickServ::service->Release(na);
source.Reply(_("Service's hold on \002{0}\002 has been released."), na->GetNick());
}
else if (!u)
{
source.Reply(_("No one is using your nick, and services are not holding it."));
}
// If the user being recovered is identified for the account of the nick then the user is the
// same person that is executing the command, so kill them off (old GHOST command).
else if (u->Account() == na->GetAccount())
{
if (!source.GetAccount() && na->GetAccount()->HasFieldS("NS_SECURE"))
{
source.GetUser()->Login(u->Account());
Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << u->Account()->GetDisplay();
}
if (Config->GetModule("ns_recover")->Get<bool>("restoreonrecover"))
{
if (!u->chans.empty())
{
NSRecoverInfo i;
for (User::ChanUserList::iterator it = u->chans.begin(), it_end = u->chans.end(); it != it_end; ++it)
i[it->first->name] = it->second->status;
source.GetUser()->Extend<NSRecoverInfo>("recover", i);
}
}
u->SendMessage(*source.service, _("This nickname has been recovered by \002{0}\002. If you did not do this, then \002{0}\002 may have your password, and you should change it."),
source.GetNick());
Anope::string buf = source.command.upper() + " command used by " + source.GetNick();
u->Kill(*source.service, buf);
source.Reply(_("Ghost with your nick has been killed."));
if (IRCD->CanSVSNick)
IRCD->SendForceNickChange(source.GetUser(), user, Anope::CurTime);
}
/* User is not identified or not identified to the same account as the person using this command */
else
{
if (!source.GetAccount() && na->GetAccount()->HasFieldS("NS_SECURE"))
{
source.GetUser()->Login(na->GetAccount()); // Identify the user using the command if they arent identified
Log(LOG_COMMAND, source, cmd) << "and was automatically identified to " << na->GetNick() << " (" << na->GetAccount()->GetDisplay() << ")";
}
u->SendMessage(*source.service, _("This nickname has been recovered by \002{0}\002."), source.GetNick());
if (NickServ::service)
NickServ::service->Collide(u, na);
if (IRCD->CanSVSNick)
{
/* If we can svsnick then release our hold and svsnick the user using the command */
if (NickServ::service)
NickServ::service->Release(na);
IRCD->SendForceNickChange(source.GetUser(), user, Anope::CurTime);
source.Reply(_("You have regained control of \002%s\002 and are now identified as \002%s\002."), user, na->GetAccount()->GetDisplay().c_str());
}
else
source.Reply(_("The user with your nick has been removed. Use this command again to release services's hold on your nick."));
}
}