Пример #1
0
		//...
		void handleMessageReceived(Message::ref message) {
			//...
			// Echo back the incoming message
			message->setTo(message->getFrom());
			message->setFrom(JID());
			//...
			if (!message->getPayload<EchoPayload>()) {
				boost::shared_ptr<EchoPayload> echoPayload = boost::make_shared<EchoPayload>();
				echoPayload->setMessage("This is an echoed message");
				message->addPayload(echoPayload);
				client->sendMessage(message);
			}
		}
Пример #2
0
		void handleMessageReceived(Message::ref message) {
			// Echo back the incoming message
			message->setTo(message->getFrom());
			message->setFrom(JID());
			client->sendMessage(message);
		}
Пример #3
0
		void sendMessage(const JID& to, const std::string& body) {
			Message::ref message = boost::make_shared<Message>();
			message->setTo(to);
			message->setBody(body);
			client->sendMessage(message);
		}