本文整理汇总了C++中nickserv::Nick::SetLastRealname方法的典型用法代码示例。如果您正苦于以下问题:C++ Nick::SetLastRealname方法的具体用法?C++ Nick::SetLastRealname怎么用?C++ Nick::SetLastRealname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nickserv::Nick
的用法示例。
在下文中一共展示了Nick::SetLastRealname方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: SetRealname
void User::SetRealname(const Anope::string &srealname)
{
if (srealname.empty())
throw CoreException("realname empty in SetRealname");
this->realname = srealname;
//XXX event
NickServ::Nick *na = NickServ::FindNick(this->nick);
if (na && (this->IsIdentified(true) || this->IsRecognized()))
na->SetLastRealname(srealname);
Log(this, "realname") << "changed realname to " << srealname;
}
示例3: OnResult
void OnResult(const LDAPResult &r) override
{
if (!ii->lprov)
return;
switch (r.type)
{
case QUERY_SEARCH:
{
if (!r.empty())
{
try
{
const LDAPAttributes &attr = r.get(0);
ii->dn = attr.get("dn");
Log(LOG_DEBUG) << "m_ldap_authenticationn: binding as " << ii->dn;
ii->lprov->Bind(new IdentifyInterface(this->owner, ii), ii->dn, ii->req->GetPassword());
ii = NULL;
}
catch (const LDAPException &ex)
{
Log(this->owner) << "Error binding after search: " << ex.GetReason();
}
}
break;
}
case QUERY_BIND:
{
if (ii->admin_bind)
{
Anope::string sf = search_filter.replace_all_cs("%account", ii->req->GetAccount()).replace_all_cs("%object_class", object_class);
try
{
Log(LOG_DEBUG) << "m_ldap_authentication: searching for " << sf;
ii->lprov->Search(new IdentifyInterface(this->owner, ii), basedn, sf);
ii->admin_bind = false;
ii = NULL;
}
catch (const LDAPException &ex)
{
Log(this->owner) << "Unable to search for " << sf << ": " << ex.GetReason();
}
}
else
{
NickServ::Nick *na = NickServ::FindNick(ii->req->GetAccount());
if (na == NULL)
{
na = new NickServ::Nick(ii->req->GetAccount(), new NickServ::Account(ii->req->GetAccount()));
na->SetLastRealname(ii->user ? ii->user->realname : ii->req->GetAccount());
NickServ::Event::OnNickRegister(&NickServ::Event::NickRegister::OnNickRegister, ii->user, na, ii->req->GetPassword());;
ServiceBot *NickServ = Config->GetClient("NickServ");
if (ii->user && NickServ)
ii->user->SendMessage(NickServ, _("Your account \002%s\002 has been successfully created."), na->GetNick().c_str());
}
// encrypt and store the password in the nickcore
Anope::Encrypt(ii->req->GetPassword(), na->GetAccount()->pass);
na->GetAccount()->Extend<Anope::string>("m_ldap_authentication_dn", ii->dn);
ii->req->Success(me);
}
break;
}
default:
break;
}
}