diff options
Diffstat (limited to 'Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp')
-rw-r--r-- | Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp b/Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp new file mode 100644 index 0000000..0900354 --- /dev/null +++ b/Swiften/Parser/PayloadParsers/DiscoItemsParser.cpp @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2010 Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include "Swiften/Parser/PayloadParsers/DiscoItemsParser.h" + +namespace Swift { + +DiscoItemsParser::DiscoItemsParser() : level_(TopLevel) { +} + +void DiscoItemsParser::handleStartElement(const String& element, const String&, const AttributeMap& attributes) { + if (level_ == PayloadLevel) { + if (element == "item") { + getPayloadInternal()->addItem(DiscoItems::Item(attributes.getAttribute("name"), JID(attributes.getAttribute("jid")), attributes.getAttribute("node"))); + } + } + ++level_; +} + +void DiscoItemsParser::handleEndElement(const String&, const String&) { + --level_; +} + +void DiscoItemsParser::handleCharacterData(const String&) { +} + +} |