本文整理汇总了C++中TreeServer::GetFullVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeServer::GetFullVersion方法的具体用法?C++ TreeServer::GetFullVersion怎么用?C++ TreeServer::GetFullVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeServer
的用法示例。
在下文中一共展示了TreeServer::GetFullVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleVersion
ModResult ModuleSpanningTree::HandleVersion(const CommandBase::Params& parameters, User* user)
{
// We've already confirmed that !parameters.empty(), so this is safe
TreeServer* found = Utils->FindServerMask(parameters[0]);
if (found)
{
if (found == Utils->TreeRoot)
{
// Pass to default VERSION handler.
return MOD_RES_PASSTHRU;
}
// If an oper wants to see the version then show the full version string instead of the normal,
// but only if it is non-empty.
// If it's empty it might be that the server is still syncing (full version hasn't arrived yet)
// or the server is a 2.0 server and does not send a full version.
bool showfull = ((user->IsOper()) && (!found->GetFullVersion().empty()));
Numeric::Numeric numeric(RPL_VERSION);
irc::tokenstream tokens(showfull ? found->GetFullVersion() : found->GetVersion());
for (std::string token; tokens.GetTrailing(token); )
numeric.push(token);
user->WriteNumeric(numeric);
}
else
{
user->WriteNumeric(ERR_NOSUCHSERVER, parameters[0], "No such server");
}
return MOD_RES_DENY;
}
示例2: HandleVersion
ModResult ModuleSpanningTree::HandleVersion(const std::vector<std::string>& parameters, User* user)
{
// we've already checked if pcnt > 0, so this is safe
TreeServer* found = Utils->FindServerMask(parameters[0]);
if (found)
{
if (found == Utils->TreeRoot)
{
// Pass to default VERSION handler.
return MOD_RES_PASSTHRU;
}
// If an oper wants to see the version then show the full version string instead of the normal,
// but only if it is non-empty.
// If it's empty it might be that the server is still syncing (full version hasn't arrived yet)
// or the server is a 2.0 server and does not send a full version.
bool showfull = ((user->IsOper()) && (!found->GetFullVersion().empty()));
const std::string& Version = (showfull ? found->GetFullVersion() : found->GetVersion());
user->WriteNumeric(RPL_VERSION, ":%s", Version.c_str());
}
else
{
user->WriteNumeric(ERR_NOSUCHSERVER, "%s :No such server", parameters[0].c_str());
}
return MOD_RES_DENY;
}