本文整理汇总了C++中nickserv::Nick::SetAccount方法的典型用法代码示例。如果您正苦于以下问题:C++ Nick::SetAccount方法的具体用法?C++ Nick::SetAccount怎么用?C++ Nick::SetAccount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nickserv::Nick
的用法示例。
在下文中一共展示了Nick::SetAccount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnSuccess
void OnSuccess(NickServ::IdentifyRequest *) override
{
if (!source.GetUser() || source.GetUser()->nick != nick || !target)
return;
User *u = source.GetUser();
NickServ::Nick *na = NickServ::FindNick(nick);
/* If the nick is already registered, drop it. */
if (na)
{
EventManager::Get()->Dispatch(&Event::ChangeCoreDisplay::OnChangeCoreDisplay, na->GetAccount(), u->nick);
delete na;
}
na = Serialize::New<NickServ::Nick *>();
na->SetNick(nick);
na->SetAccount(target->GetAccount());
na->SetLastUsermask(u->GetIdent() + "@" + u->GetDisplayedHost());
na->SetLastRealname(u->realname);
na->SetLastSeen(Anope::CurTime);
na->SetTimeRegistered(Anope::CurTime);
u->Login(target->GetAccount());
EventManager::Get()->Dispatch(&Event::NickGroup::OnNickGroup, u, target);
Log(LOG_COMMAND, source, cmd) << "to make " << nick << " join group of " << target->GetNick() << " (" << target->GetAccount()->GetDisplay() << ") (email: " << (!target->GetAccount()->GetEmail().empty() ? target->GetAccount()->GetEmail() : "none") << ")";
source.Reply(_("You are now in the group of \002{0}\002."), target->GetNick());
u->lastnickreg = Anope::CurTime;
}
示例2: Execute
void Execute(CommandSource &source, const std::vector<Anope::string> ¶ms) override
{
User *u = source.GetUser();
Anope::string nick = !params.empty() ? params[0] : "";
NickServ::Nick *na = NickServ::FindNick(!nick.empty() ? nick : u->nick);
if (u->Account()->GetRefs<NickServ::Nick *>().size() == 1)
{
source.Reply(_("Your nickname is not grouped to anything, so you can't ungroup it."));
return;
}
if (!na)
{
source.Reply(_("\002{0}\002 isn't registered."), !nick.empty() ? nick : u->nick);
return;
}
if (na->GetAccount() != u->Account())
{
source.Reply(_("\002{0}\002 is not in your group."), na->GetNick());
return;
}
NickServ::Account *oldcore = na->GetAccount();
if (na->GetNick().equals_ci(oldcore->GetDisplay()))
oldcore->SetDisplay(oldcore->GetRef<NickServ::Nick *>());
NickServ::Account *nc = Serialize::New<NickServ::Account *>();
nc->SetDisplay(na->GetNick());
na->SetAccount(nc);
nc->SetPassword(oldcore->GetPassword());
if (!oldcore->GetEmail().empty())
nc->SetEmail(oldcore->GetEmail());
nc->SetLanguage(oldcore->GetLanguage());
source.Reply(_("\002{0}\002 has been ungrouped from \002{1}\002."), na->GetNick(), oldcore->GetDisplay());
User *user = User::Find(na->GetNick());
if (user)
/* The user on the nick who was ungrouped may be identified to the old group, set -r */
user->RemoveMode(source.service, "REGISTERED");
}