summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Piekos <mateuszpiekos@gmail.com>2012-07-13 18:18:37 (GMT)
committerMateusz Piekos <mateuszpiekos@gmail.com>2012-07-13 18:18:37 (GMT)
commit0ba890e7e8c7e09c1257a7c3b1018f396e6896d1 (patch)
tree13dc4658023e89d48d4e7ae1854f70e827bf9cf6 /Swiften/Serializer
parent4dc0788b78da3fe5a9daed5ab4593ba6423600ec (diff)
downloadswift-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.cpp18
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();