当前位置: 首页>>代码示例>>C++>>正文


C++ TreeServer::GetVersion方法代码示例

本文整理汇总了C++中TreeServer::GetVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeServer::GetVersion方法的具体用法?C++ TreeServer::GetVersion怎么用?C++ TreeServer::GetVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TreeServer的用法示例。


在下文中一共展示了TreeServer::GetVersion方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
开发者ID:Adam-,项目名称:inspircd,代码行数:30,代码来源:main.cpp

示例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;
}
开发者ID:NikosPapakonstantinou,项目名称:inspircd,代码行数:26,代码来源:main.cpp

示例3: HandleVersion

int 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)
	{
		std::string Version = found->GetVersion();
		user->WriteNumeric(351, "%s :%s",user->nick.c_str(),Version.c_str());
		if (found == Utils->TreeRoot)
		{
			ServerInstance->Config->Send005(user);
		}
	}
	else
	{
		user->WriteNumeric(402, "%s %s :No such server",user->nick.c_str(),parameters[0].c_str());
	}
	return 1;
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例4: HandleVersion

int ModuleSpanningTree::HandleVersion(const char** parameters, int pcnt, userrec* user)
{
	// we've already checked if pcnt > 0, so this is safe
	TreeServer* found = Utils->FindServerMask(parameters[0]);
	if (found)
	{
		std::string Version = found->GetVersion();
		user->WriteServ("351 %s :%s",user->nick,Version.c_str());
		if (found == Utils->TreeRoot)
		{
			ServerInstance->Config->Send005(user);
		}
	}
	else
	{
		user->WriteServ("402 %s %s :No such server",user->nick,parameters[0]);
	}
	return 1;
}
开发者ID:TuSuNaMi,项目名称:ircd-sakura,代码行数:19,代码来源:main.cpp

示例5: 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;
		}
		std::string Version = found->GetVersion();
		user->WriteNumeric(351, "%s :%s",user->nick.c_str(),Version.c_str());
	}
	else
	{
		user->WriteNumeric(402, "%s %s :No such server",user->nick.c_str(),parameters[0].c_str());
	}
	return MOD_RES_DENY;
}
开发者ID:AliSharifi,项目名称:inspircd,代码行数:20,代码来源:main.cpp


注:本文中的TreeServer::GetVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。