本文整理汇总了C++中LocalUser::ChangeDisplayedHost方法的典型用法代码示例。如果您正苦于以下问题:C++ LocalUser::ChangeDisplayedHost方法的具体用法?C++ LocalUser::ChangeDisplayedHost怎么用?C++ LocalUser::ChangeDisplayedHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalUser
的用法示例。
在下文中一共展示了LocalUser::ChangeDisplayedHost方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Oper
void User::Oper(OperInfo* info)
{
ModeHandler* opermh = ServerInstance->Modes->FindMode('o', MODETYPE_USER);
if (this->IsModeSet(opermh))
this->UnOper();
this->SetMode(opermh, true);
this->oper = info;
this->WriteCommand("MODE", "+o");
FOREACH_MOD(OnOper, (this, info->name));
std::string opername;
if (info->oper_block)
opername = info->oper_block->getString("name");
if (IS_LOCAL(this))
{
LocalUser* l = IS_LOCAL(this);
std::string vhost = oper->getConfig("vhost");
if (!vhost.empty())
l->ChangeDisplayedHost(vhost.c_str());
std::string opClass = oper->getConfig("class");
if (!opClass.empty())
l->SetClass(opClass);
}
ServerInstance->SNO->WriteToSnoMask('o',"%s (%[email protected]%s) is now an IRC operator of type %s (using oper '%s')",
nick.c_str(), ident.c_str(), host.c_str(), oper->name.c_str(), opername.c_str());
this->WriteNumeric(RPL_YOUAREOPER, ":You are now %s %s", strchr("aeiouAEIOU", oper->name[0]) ? "an" : "a", oper->name.c_str());
ServerInstance->Logs->Log("OPER", LOG_DEFAULT, "%s opered as type: %s", GetFullRealHost().c_str(), oper->name.c_str());
ServerInstance->Users->all_opers.push_back(this);
// Expand permissions from config for faster lookup
if (IS_LOCAL(this))
oper->init();
FOREACH_MOD(OnPostOper, (this, oper->name, opername));
}
示例2: Oper
void User::Oper(OperInfo* info)
{
if (this->IsModeSet('o'))
this->UnOper();
this->modes[UM_OPERATOR] = 1;
this->oper = info;
this->WriteServ("MODE %s :+o", this->nick.c_str());
FOREACH_MOD(I_OnOper, OnOper(this, info->name));
std::string opername;
if (info->oper_block)
opername = info->oper_block->getString("name");
if (IS_LOCAL(this))
{
LocalUser* l = IS_LOCAL(this);
std::string vhost = oper->getConfig("vhost");
if (!vhost.empty())
l->ChangeDisplayedHost(vhost.c_str());
std::string opClass = oper->getConfig("class");
if (!opClass.empty())
l->SetClass(opClass);
}
ServerInstance->SNO->WriteToSnoMask('o',"%s (%[email protected]%s) is now an IRC operator of type %s (using oper '%s')",
nick.c_str(), ident.c_str(), host.c_str(), oper->NameStr(), opername.c_str());
this->WriteNumeric(381, "%s :You are now %s %s", nick.c_str(), strchr("aeiouAEIOU", oper->name[0]) ? "an" : "a", oper->NameStr());
ServerInstance->Logs->Log("OPER", DEFAULT, "%s opered as type: %s", GetFullRealHost().c_str(), oper->NameStr());
ServerInstance->Users->all_opers.push_back(this);
// Expand permissions from config for faster lookup
if (IS_LOCAL(this))
oper->init();
FOREACH_MOD(I_OnPostOper,OnPostOper(this, oper->name, opername));
}
示例3: OnModeChange
ModeAction OnModeChange(User* source, User* dest, Channel* channel, std::string ¶meter, bool adding)
{
LocalUser* user = IS_LOCAL(dest);
/* For remote clients, we don't take any action, we just allow it.
* The local server where they are will set their cloak instead.
* This is fine, as we will receive it later.
*/
if (!user)
{
dest->SetMode(this, adding);
return MODEACTION_ALLOW;
}
if (user->uuid == debounce_uid && debounce_ts == ServerInstance->Time())
{
// prevent spamming using /mode user +x-x+x-x+x-x
if (++debounce_count > 2)
return MODEACTION_DENY;
}
else
{
debounce_uid = user->uuid;
debounce_count = 1;
debounce_ts = ServerInstance->Time();
}
if (adding == user->IsModeSet(this))
return MODEACTION_DENY;
/* don't allow this user to spam modechanges */
if (source == dest)
user->CommandFloodPenalty += 5000;
if (adding)
{
std::string* cloak = ext.get(user);
if (!cloak)
{
/* Force creation of missing cloak */
creator->OnUserConnect(user);
cloak = ext.get(user);
}
if (cloak)
{
user->ChangeDisplayedHost(*cloak);
user->SetMode(this, true);
return MODEACTION_ALLOW;
}
else
return MODEACTION_DENY;
}
else
{
/* User is removing the mode, so restore their real host
* and make it match the displayed one.
*/
user->SetMode(this, false);
user->ChangeDisplayedHost(user->host.c_str());
return MODEACTION_ALLOW;
}
}