本文整理汇总了C++中LocalUser::GetClass方法的典型用法代码示例。如果您正苦于以下问题:C++ LocalUser::GetClass方法的具体用法?C++ LocalUser::GetClass怎么用?C++ LocalUser::GetClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalUser
的用法示例。
在下文中一共展示了LocalUser::GetClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Handle
CmdResult Handle (const std::vector<std::string> ¶meters, User *user)
{
if (parameters.size() > 1 && parameters[1] != ServerInstance->Config->ServerName.c_str())
return CMD_SUCCESS;
User *targuser;
Channel *targchan;
std::string checkstr;
std::string chliststr;
checkstr = ":" + ServerInstance->Config->ServerName + " 304 " + user->nick + " :CHECK";
targuser = ServerInstance->FindNick(parameters[0]);
targchan = ServerInstance->FindChan(parameters[0]);
/*
* Syntax of a /check reply:
* :server.name 304 target :CHECK START <target>
* :server.name 304 target :CHECK <field> <value>
* :server.name 304 target :CHECK END
*/
user->SendText(checkstr + " START " + parameters[0]);
if (targuser)
{
LocalUser* loctarg = IS_LOCAL(targuser);
/* /check on a user */
user->SendText(checkstr + " nuh " + targuser->GetFullHost());
user->SendText(checkstr + " realnuh " + targuser->GetFullRealHost());
user->SendText(checkstr + " realname " + targuser->fullname);
user->SendText(checkstr + " modes +" + targuser->FormatModes());
user->SendText(checkstr + " snomasks " + GetSnomasks(targuser));
user->SendText(checkstr + " server " + targuser->server->GetName());
user->SendText(checkstr + " uid " + targuser->uuid);
user->SendText(checkstr + " signon " + timestring(targuser->signon));
user->SendText(checkstr + " nickts " + timestring(targuser->age));
if (loctarg)
user->SendText(checkstr + " lastmsg " + timestring(loctarg->idle_lastmsg));
if (targuser->IsAway())
{
/* user is away */
user->SendText(checkstr + " awaytime " + timestring(targuser->awaytime));
user->SendText(checkstr + " awaymsg " + targuser->awaymsg);
}
if (targuser->IsOper())
{
OperInfo* oper = targuser->oper;
/* user is an oper of type ____ */
user->SendText(checkstr + " opertype " + oper->name);
if (loctarg)
{
std::string umodes;
std::string cmodes;
for(char c='A'; c < 'z'; c++)
{
ModeHandler* mh = ServerInstance->Modes->FindMode(c, MODETYPE_USER);
if (mh && mh->NeedsOper() && loctarg->HasModePermission(c, MODETYPE_USER))
umodes.push_back(c);
mh = ServerInstance->Modes->FindMode(c, MODETYPE_CHANNEL);
if (mh && mh->NeedsOper() && loctarg->HasModePermission(c, MODETYPE_CHANNEL))
cmodes.push_back(c);
}
user->SendText(checkstr + " modeperms user=" + umodes + " channel=" + cmodes);
std::string opcmds;
for(std::set<std::string>::iterator i = oper->AllowedOperCommands.begin(); i != oper->AllowedOperCommands.end(); i++)
{
opcmds.push_back(' ');
opcmds.append(*i);
}
std::stringstream opcmddump(opcmds);
user->SendText(checkstr + " commandperms", opcmddump);
std::string privs;
for(std::set<std::string>::iterator i = oper->AllowedPrivs.begin(); i != oper->AllowedPrivs.end(); i++)
{
privs.push_back(' ');
privs.append(*i);
}
std::stringstream privdump(privs);
user->SendText(checkstr + " permissions", privdump);
}
}
if (loctarg)
{
user->SendText(checkstr + " clientaddr " + loctarg->client_sa.str());
user->SendText(checkstr + " serveraddr " + loctarg->server_sa.str());
std::string classname = loctarg->GetClass()->name;
if (!classname.empty())
user->SendText(checkstr + " connectclass " + classname);
}
else
user->SendText(checkstr + " onip " + targuser->GetIPString());
for (UCListIter i = targuser->chans.begin(); i != targuser->chans.end(); i++)
{
Channel* c = (*i)->chan;
//.........这里部分代码省略.........