diff options
Diffstat (limited to 'Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp')
-rw-r--r-- | Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp b/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp new file mode 100644 index 0000000..ffa24ad --- /dev/null +++ b/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp @@ -0,0 +1,27 @@ +#include "Swiften/Parser/PayloadParsers/DiscoInfoParser.h" + +namespace Swift { + +DiscoInfoParser::DiscoInfoParser() : level_(TopLevel) { +} + +void DiscoInfoParser::handleStartElement(const String& element, const String&, const AttributeMap& attributes) { + if (level_ == PayloadLevel) { + if (element == "identity") { + getPayloadInternal()->addIdentity(DiscoInfo::Identity(attributes.getAttribute("name"), attributes.getAttribute("category"), attributes.getAttribute("type"), attributes.getAttribute("lang"))); + } + else if (element == "feature") { + getPayloadInternal()->addFeature(attributes.getAttribute("var")); + } + } + ++level_; +} + +void DiscoInfoParser::handleEndElement(const String&, const String&) { + --level_; +} + +void DiscoInfoParser::handleCharacterData(const String&) { +} + +} |