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


C++ message::content方法代码示例

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


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

示例1: if

bool
connection_base::print_message(message const &msg, std::streambuf &buf) {

	formatter const *fmt_ptr = NULL;
	if (NULL != fmt_data_.get()) {
		fmt_ptr = fmt_data_->find_formatter(msg);
	}

	std::string const &content = msg.content();
	if (NULL != fmt_ptr) {
		if (!print_message_content(fmt_ptr->wrap_message(content), buf)) {
			return false;
		}
	}
	else if (!print_message_content(content, buf)) {
		return false;
	}

	if (NULL != fmt_data_.get()) {
		fmt_data_->update(msg);
	}
	return true;
}
开发者ID:GunioRobot,项目名称:xiva,代码行数:23,代码来源:connection_base.cpp

示例2: incoming_message

	void dcc_send_connection::incoming_message(irc::connection& aConnection, const message& aMessage)
	{
		if (&aConnection != iConnection)
			return;
		if (aMessage.command() != message::PRIVMSG)
			return;
		typedef std::vector<std::pair<std::string::const_iterator, std::string::const_iterator> > bits_t;
		bits_t bits;
		neolib::tokens(aMessage.content(), std::string("\001 "), bits);
		if (neolib::to_upper(neolib::to_string(bits[0])) != "DCC")
			return;
		if (iSendType == Download && neolib::to_upper(neolib::to_string(bits[1])) == "ACCEPT" && bits.size() >= 5)
		{
			if (*bits[2].first == '\"')
			{
				for (bits_t::size_type i = 3; i < bits.size(); ++i)
					if (*(bits[i].second - 1) == '\"')
					{
						bits[2].second = bits[i].second;
						bits.erase(bits.begin() + 3, bits.begin() + i + 1);
						break;
					}
			}
			std::string fileName = neolib::to_string(bits[2]);
			if (fileName == iResumeData->iFileName && 
				neolib::string_to_unsigned_integer(neolib::to_string(bits[3])) == iResumeData->iPort &&
				neolib::string_to_unsigned_integer(neolib::to_string(bits[4])) == iResumeData->iResumeFileSize)
			{
				u_long address = iResumeData->iAddress;
				u_short port = iResumeData->iPort;
				iBytesTransferred = iResumeData->iResumeFileSize;
				iLastBytesTransferred = iBytesTransferred;
				if (!connect(address, port))
				{
					close();
					return;
				}
				neolib::observable<dcc_send_connection_observer>::notify_observers(dcc_send_connection_observer::NotifyTransferStarted);
				if (!open_file())
					return;
			}
		}
		else if (iSendType == Listen && neolib::to_upper(neolib::to_string(bits[1])) == "RESUME" && bits.size() >= 5)
		{
			if (*bits[2].first == '\"')
			{
				for (bits_t::size_type i = 3; i < bits.size(); ++i)
					if (*(bits[i].second - 1) == '\"')
					{
						bits[2].second = bits[i].second;
						bits.erase(bits.begin() + 3, bits.begin() + i + 1);
						break;
					}
			}
			std::string fileName = neolib::to_string(bits[2]);
			if (fileName == iName && 
				neolib::string_to_unsigned_integer(neolib::to_string(bits[3])) == stream_server().local_port())
			{
				iResumeData = resume_data_t(0, stream_server().local_port(), name(), neolib::string_to_unsigned_integer(neolib::to_string(bits[4])));
				message newMessage(*iConnection, message::OUTGOING);
				newMessage.set_command(message::PRIVMSG);
				newMessage.parameters().push_back(iRemoteUser.nick_name());
				newMessage.parameters().push_back("\001DCC ACCEPT "); 
				newMessage.parameters().back() += iResumeData->iFileName + " ";
				newMessage.parameters().back() += neolib::unsigned_integer_to_string<char>(iResumeData->iPort) + " ";
				newMessage.parameters().back() += neolib::unsigned_integer_to_string<char>(iResumeData->iResumeFileSize) + "\001";
				iConnection->send_message(newMessage);
			}
		}
	}
开发者ID:FlibbleMr,项目名称:neoirc,代码行数:70,代码来源:dcc_send_connection.cpp


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