diff --git a/include/Swiften/Parser/PayloadParsers/HintPayloadParser.cpp b/include/Swiften/Parser/PayloadParsers/HintPayloadParser.cpp new file mode 100644 index 0000000000000000000000000000000000000000..bdecf6eae57966fc4c9bffa68843671d18b7d36c --- /dev/null +++ b/include/Swiften/Parser/PayloadParsers/HintPayloadParser.cpp @@ -0,0 +1,38 @@ +/* + * Implements XEP-0334: Message Processing Hints + * Licensed under the Simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include + +namespace Swift { + +HintPayloadParser::HintPayloadParser() : level_(0) { +} + +void HintPayloadParser::handleStartElement(const std::string& element, const std::string& /*ns*/, const AttributeMap& /*attributes*/) { + if (level_ == 0) { + HintPayload::Type type = HintPayload::NoCopy; + if (element == "no-permanent-store") { + type = HintPayload::NoPermanentStore; + } else if (element == "no-store") { + type = HintPayload::NoStore; + } else if (element == "no-copy") { + type = HintPayload::NoCopy; + } else if (element == "store") { + type = HintPayload::Store; + } + getPayloadInternal()->setType(type); + } + ++level_; +} + +void HintPayloadParser::handleEndElement(const std::string&, const std::string&) { + --level_; +} + +void HintPayloadParser::handleCharacterData(const std::string&) { +} + +}