/* * Copyright (c) 2011 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #include #include #include #include #include #include namespace Swift { MUCDestroyPayloadSerializer::MUCDestroyPayloadSerializer() : GenericPayloadSerializer() { } std::string MUCDestroyPayloadSerializer::serializePayload(boost::shared_ptr payload) const { XMLElement mucElement("destroy", ""); if (!payload->getReason().empty()) { XMLElement::ref reason = boost::make_shared("reason", ""); reason->addNode(boost::make_shared(payload->getReason())); mucElement.addNode(reason); } if (payload->getNewVenue().isValid()) { mucElement.setAttribute("jid", payload->getNewVenue().toString()); } return mucElement.serialize(); } }