//... 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); } }
void handleMessageReceived(Message::ref message) { // Echo back the incoming message message->setTo(message->getFrom()); message->setFrom(JID()); client->sendMessage(message); }
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); }