diff options
author | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-07-13 18:18:37 (GMT) |
---|---|---|
committer | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-07-13 18:18:37 (GMT) |
commit | 0ba890e7e8c7e09c1257a7c3b1018f396e6896d1 (patch) | |
tree | 13dc4658023e89d48d4e7ae1854f70e827bf9cf6 /Swiften/Serializer | |
parent | 4dc0788b78da3fe5a9daed5ab4593ba6423600ec (diff) | |
download | swift-contrib-0ba890e7e8c7e09c1257a7c3b1018f396e6896d1.zip swift-contrib-0ba890e7e8c7e09c1257a7c3b1018f396e6896d1.tar.bz2 |
Integrated WhiteboardClient and WhiteboardServer into rest of the code
Diffstat (limited to 'Swiften/Serializer')
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp index a15d7ae..0cd4779 100644 --- a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp @@ -9,6 +9,7 @@ #include <boost/smart_ptr/make_shared.hpp> #include <boost/lexical_cast.hpp> #include <Swiften/Serializer/XML/XMLTextNode.h> +#include <Swiften/Whiteboard/Operations/WhiteboardInsertOperation.h> namespace Swift { void WhiteboardElementSerializingVisitor::visit(WhiteboardLineElement& line) { @@ -135,9 +136,22 @@ namespace Swift { std::string WhiteboardSerializer::serializePayload(boost::shared_ptr<WhiteboardPayload> payload) const { XMLElement element("wb"); if (payload->getType() == WhiteboardPayload::Data) { + XMLElement::ref operationNode = boost::make_shared<XMLElement>("operation"); WhiteboardElementSerializingVisitor visitor; - payload->getElement()->accept(visitor); - element.addNode(visitor.getResult()); +// payload->getElement()->accept(visitor); + WhiteboardInsertOperation::ref insertOp = boost::dynamic_pointer_cast<WhiteboardInsertOperation>(payload->getOperation()); + if (insertOp) { + try { + operationNode->setAttribute("type", "insert"); + operationNode->setAttribute("pos", boost::lexical_cast<std::string>(insertOp->getPos())); + operationNode->setAttribute("id", insertOp->getID()); + operationNode->setAttribute("parentid", insertOp->getParentID()); + } catch (boost::bad_lexical_cast&) { + } + insertOp->getElement()->accept(visitor); + operationNode->addNode(visitor.getResult()); + } + element.addNode(operationNode); } element.setAttribute("type", typeToString(payload->getType())); return element.serialize(); |