diff options
author | Tobias Markmann <tm@ayena.de> | 2016-05-11 15:38:57 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2016-06-14 20:28:20 (GMT) |
commit | 9b1c1ec6922047fa30c19c0744619dc458a12b78 (patch) | |
tree | 230a96de2a104324b8ab179834a7b9914c0443f9 /Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp | |
parent | 0d5dcec01a396ab64c559a5b0cd04eb38f2f1954 (diff) | |
download | swift-9b1c1ec6922047fa30c19c0744619dc458a12b78.zip swift-9b1c1ec6922047fa30c19c0744619dc458a12b78.tar.bz2 |
Fix handling of notify attribute in PubSub retract elements
Test-Information:
Added serializer and parser unit tests. All tests pass on
Mac OS X 10.11.4.
Change-Id: I8550c76ba182a67613d55634c72c0f2979f8b80a
Diffstat (limited to 'Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp')
-rw-r--r-- | Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp b/Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp index b011b76..d5d5c0a 100644 --- a/Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp +++ b/Swiften/Parser/PayloadParsers/PubSubRetractParser.cpp @@ -4,15 +4,12 @@ * See the COPYING file for more information. */ -#pragma clang diagnostic ignored "-Wunused-private-field" - #include <Swiften/Parser/PayloadParsers/PubSubRetractParser.h> #include <boost/optional.hpp> - -#include <Swiften/Parser/PayloadParserFactoryCollection.h> #include <Swiften/Parser/PayloadParserFactory.h> +#include <Swiften/Parser/PayloadParserFactoryCollection.h> #include <Swiften/Parser/PayloadParsers/PubSubItemParser.h> using namespace Swift; @@ -29,7 +26,11 @@ void PubSubRetractParser::handleStartElement(const std::string& element, const s getPayloadInternal()->setNode(*attributeValue); } if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("notify")) { - getPayloadInternal()->setNotify(*attributeValue == "true" ? true : false); + boost::optional<bool> notify; + if (attributeValue.is_initialized()) { + notify = (attributeValue.get() == "true" || attributeValue.get() == "1") ? true : false; + } + getPayloadInternal()->setNotify(notify); } } |