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


C++ Channel::ForceJoin方法代码示例

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


在下文中一共展示了Channel::ForceJoin方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: HandleRemote

CmdResult CommandIJoin::HandleRemote(RemoteUser* user, std::vector<std::string>& params)
{
	Channel* chan = ServerInstance->FindChan(params[0]);
	if (!chan)
	{
		// Desync detected, recover
		// Ignore the join and send RESYNC, this will result in the remote server sending all channel data to us
		ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Received IJOIN for non-existant channel: " + params[0]);

		CmdBuilder("RESYNC").push(params[0]).Unicast(user);

		return CMD_FAILURE;
	}

	bool apply_modes;
	if (params.size() > 2)
	{
		time_t RemoteTS = ServerCommand::ExtractTS(params[2]);
		if (RemoteTS < chan->age)
			throw ProtocolException("Attempted to lower TS via IJOIN. LocalTS=" + ConvToStr(chan->age));
		apply_modes = ((params.size() > 3) && (RemoteTS == chan->age));
	}
	else
		apply_modes = false;

	// Join the user and set the membership id to what they sent
	Membership* memb = chan->ForceJoin(user, apply_modes ? &params[3] : NULL);
	if (!memb)
		return CMD_FAILURE;

	memb->id = Membership::IdFromString(params[1]);
	return CMD_SUCCESS;
}
开发者ID:Canternet,项目名称:inspircd,代码行数:33,代码来源:ijoin.cpp

示例2: HandleRemote

CmdResult CommandIJoin::HandleRemote(RemoteUser* user, std::vector<std::string>& params)
{
	Channel* chan = ServerInstance->FindChan(params[0]);
	if (!chan)
	{
		// Desync detected, recover
		// Ignore the join and send RESYNC, this will result in the remote server sending all channel data to us
		ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "Received IJOIN for non-existant channel: " + params[0]);

		CmdBuilder("RESYNC").push(params[0]).Unicast(user);

		return CMD_FAILURE;
	}

	bool apply_modes;
	if (params.size() > 1)
	{
		time_t RemoteTS = ConvToInt(params[1]);
		if (!RemoteTS)
		{
			ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Invalid TS in IJOIN: " + params[1]);
			return CMD_INVALID;
		}

		if (RemoteTS < chan->age)
		{
			ServerInstance->Logs->Log(MODNAME, LOG_DEFAULT, "Attempted to lower TS via IJOIN. Channel=" + params[0] + " RemoteTS=" + params[1] + " LocalTS=" + ConvToStr(chan->age));
			return CMD_INVALID;
		}
		apply_modes = ((params.size() > 2) && (RemoteTS == chan->age));
	}
	else
		apply_modes = false;

	chan->ForceJoin(user, apply_modes ? &params[2] : NULL);
	return CMD_SUCCESS;
}
开发者ID:AliSharifi,项目名称:inspircd,代码行数:37,代码来源:ijoin.cpp


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