summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMateusz Piekos <mateuszpiekos@gmail.com>2012-07-18 10:36:42 (GMT)
committerMateusz Piekos <mateuszpiekos@gmail.com>2012-07-18 10:36:42 (GMT)
commite6389d9be9135d5648033abea8bdb75959f64070 (patch)
tree922afb6a5e2e916cbbb033fcb311dee13b9cac22 /Swiften/Parser
parent7a14385acccd599438a274d421735a7d0c4bc9fa (diff)
downloadswift-contrib-e6389d9be9135d5648033abea8bdb75959f64070.zip
swift-contrib-e6389d9be9135d5648033abea8bdb75959f64070.tar.bz2
Modified code to send TextItem updates
Diffstat (limited to 'Swiften/Parser')
-rw-r--r--Swiften/Parser/PayloadParsers/WhiteboardParser.cpp23
1 files changed, 7 insertions, 16 deletions
diff --git a/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp b/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp
index ea00335..cdcbb8c 100644
--- a/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp
+++ b/Swiften/Parser/PayloadParsers/WhiteboardParser.cpp
@@ -21,6 +21,7 @@
namespace Swift {
WhiteboardParser::WhiteboardParser() : actualIsText(false), level_(0) {
+ operation = NULL;
}
void WhiteboardParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap& attributes) {
@@ -30,31 +31,21 @@ namespace Swift {
std::string type = attributes.getAttributeValue("type").get_value_or("");
if (type == "insert") {
WhiteboardInsertOperation::ref insertOp = boost::make_shared<WhiteboardInsertOperation>();
- try {
- insertOp->setID(attributes.getAttributeValue("id").get_value_or(""));
- insertOp->setParentID(attributes.getAttributeValue("parentid").get_value_or(""));
- insertOp->setPos(boost::lexical_cast<int>(attributes.getAttributeValue("pos").get_value_or("0")));
- } catch (boost::bad_lexical_cast&) {
- }
operation = insertOp;
} else if (type == "update") {
WhiteboardUpdateOperation::ref updateOp = boost::make_shared<WhiteboardUpdateOperation>();
- try {
- updateOp->setID(attributes.getAttributeValue("id").get_value_or(""));
- updateOp->setParentID(attributes.getAttributeValue("parentid").get_value_or(""));
- updateOp->setPos(boost::lexical_cast<int>(attributes.getAttributeValue("pos").get_value_or("0")));
- } catch (boost::bad_lexical_cast&) {
- }
operation = updateOp;
} else if (type == "delete") {
WhiteboardDeleteOperation::ref deleteOp = boost::make_shared<WhiteboardDeleteOperation>();
+ operation = deleteOp;
+ }
+ if (operation) {
try {
- deleteOp->setID(attributes.getAttributeValue("id").get_value_or(""));
- deleteOp->setParentID(attributes.getAttributeValue("parentid").get_value_or(""));
- deleteOp->setPos(boost::lexical_cast<int>(attributes.getAttributeValue("pos").get_value_or("0")));
+ operation->setID(attributes.getAttributeValue("id").get_value_or(""));
+ operation->setParentID(attributes.getAttributeValue("parentid").get_value_or(""));
+ operation->setPos(boost::lexical_cast<int>(attributes.getAttributeValue("pos").get_value_or("0")));
} catch (boost::bad_lexical_cast&) {
}
- operation = deleteOp;
}
} else if (level_ == 2) {