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


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

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


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

示例1: Run

	/*
	 * CHANINFO is used by servers to inform each other about a channel: its
	 * modes, channel key, user limits and its topic. The parameter combination
	 * <key> and <limit> is optional, as well as the <topic> parameter, so that
	 * there are three possible forms of this command:
	 *
	 * CHANINFO <chan> +<modes>
	 * CHANINFO <chan> +<modes> :<topic>
	 * CHANINFO <chan> +<modes> <key> <limit> :<topic>
	 *
	 * The parameter <key> must be ignored if a channel has no key (the parameter
	 * <modes> doesn't list the "k" channel mode). In this case <key> should
	 * contain "*" because the parameter <key> is required by the CHANINFO syntax
	 * and therefore can't be omitted. The parameter <limit> must be ignored when
	 * a channel has no user limit (the parameter <modes> doesn't list the "l"
	 * channel mode). In this case <limit> should be "0".
	 */
	void Run(MessageSource &source, const std::vector<Anope::string> &params) override
	{
		bool created;
		Channel *c = Channel::FindOrCreate(params[0], created);

		Anope::string modes = params[1];

		if (params.size() == 3)
		{
			c->ChangeTopicInternal(NULL, source.GetName(), params[2], Anope::CurTime);
		}
		else if (params.size() == 5)
		{
			for (size_t i = 0, end = params[1].length(); i < end; ++i)
			{
				switch(params[1][i])
				{
					case 'k':
						modes += " " + params[2];
						continue;
					case 'l':
						modes += " " + params[3];
						continue;
				}
			}
			c->ChangeTopicInternal(NULL, source.GetName(), params[4], Anope::CurTime);
		}

		c->SetModesInternal(source, modes);
	}
开发者ID:bonnedav,项目名称:anope,代码行数:47,代码来源:ngircd.cpp

示例2: Run

void Topic::Run(MessageSource &source, const std::vector<Anope::string> &params)
{
	Channel *c = Channel::Find(params[0]);
	if (c)
		c->ChangeTopicInternal(source.GetUser(), source.GetSource(), params[1], Anope::CurTime);

	return;
}
开发者ID:SaberUK,项目名称:anope,代码行数:8,代码来源:messages.cpp

示例3:

void hybrid::TBurst::Run(MessageSource &source, const std::vector<Anope::string> &params)
{
	Anope::string setter;
	sepstream(params[3], '!').GetToken(setter, 0);
	time_t topic_time = Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime;
	Channel *c = Channel::Find(params[1]);

	if (c)
		c->ChangeTopicInternal(NULL, setter, params[4], topic_time);
}
开发者ID:SaberUK,项目名称:anope,代码行数:10,代码来源:hybrid.cpp

示例4:

/*
 * params[0] = channel
 * params[1] = ts
 * params[2] = topic OR who set the topic
 * params[3] = topic if params[2] isn't the topic
 */
void ratbox::TB::Run(MessageSource &source, const std::vector<Anope::string> &params)
{
	time_t topic_time = Anope::string(params[1]).is_pos_number_only() ? convertTo<time_t>(params[1]) : Anope::CurTime;
	Channel *c = Channel::Find(params[0]);

	if (!c)
		return;

	const Anope::string &setter = params.size() == 4 ? params[2] : "",
		topic = params.size() == 4 ? params[3] : params[2];

	c->ChangeTopicInternal(NULL, setter, topic, topic_time);
}
开发者ID:SaberUK,项目名称:anope,代码行数:19,代码来源:ratbox.cpp

示例5: OnTopic

	bool OnTopic(const Anope::string &, const std::vector<Anope::string> &params)
	{
		if (params.size() < 4)
			return true;

		Channel *c = findchan(params[0]);
		if (!c)
		{
			Log() << "TOPIC for nonexistant channel " << params[0];
			return true;
		}

		c->ChangeTopicInternal(params[1], params[3], Anope::string(params[2]).is_pos_number_only() ? convertTo<time_t>(params[2]) : Anope::CurTime);

		return true;
	}
开发者ID:xxgrunge,项目名称:anope196,代码行数:16,代码来源:bahamut.cpp


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