summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Piekos <mateuszpiekos@gmail.com>2012-07-17 14:36:22 (GMT)
committerMateusz Piekos <mateuszpiekos@gmail.com>2012-07-17 14:36:22 (GMT)
commit7a14385acccd599438a274d421735a7d0c4bc9fa (patch)
treecfdb97325d00cd552fa03d80cc882aebaf3b5424 /Swiften/Serializer
parent1f8e319e256ac15438d63080d11a860dfa16431c (diff)
downloadswift-contrib-7a14385acccd599438a274d421735a7d0c4bc9fa.zip
swift-contrib-7a14385acccd599438a274d421735a7d0c4bc9fa.tar.bz2
Added handling of items deletions
Diffstat (limited to 'Swiften/Serializer')
-rw-r--r--Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp
index d22d4ce..c5e3d4f 100644
--- a/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/WhiteboardSerializer.cpp
@@ -11,6 +11,7 @@
#include <Swiften/Serializer/XML/XMLTextNode.h>
#include <Swiften/Whiteboard/Operations/WhiteboardInsertOperation.h>
#include <Swiften/Whiteboard/Operations/WhiteboardUpdateOperation.h>
+#include <Swiften/Whiteboard/Operations/WhiteboardDeleteOperation.h>
namespace Swift {
void WhiteboardElementSerializingVisitor::visit(WhiteboardLineElement& line) {
@@ -165,6 +166,17 @@ namespace Swift {
operationNode->addNode(visitor.getResult());
}
+
+ WhiteboardDeleteOperation::ref deleteOp = boost::dynamic_pointer_cast<WhiteboardDeleteOperation>(payload->getOperation());
+ if (deleteOp) {
+ try {
+ operationNode->setAttribute("type", "delete");
+ operationNode->setAttribute("pos", boost::lexical_cast<std::string>(deleteOp->getPos()));
+ operationNode->setAttribute("id", deleteOp->getID());
+ operationNode->setAttribute("parentid", deleteOp->getParentID());
+ } catch (boost::bad_lexical_cast&) {
+ }
+ }
element.addNode(operationNode);
}
element.setAttribute("type", typeToString(payload->getType()));