summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Smith <git@kismith.co.uk>2012-12-04 13:01:36 (GMT)
committerKevin Smith <git@kismith.co.uk>2012-12-04 13:34:42 (GMT)
commita6f8c4e4579b93b3e004229dcdeb098bd5b356a4 (patch)
treeecf3908d57917505234c636e6836b0d4d31ce277 /Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp
parent3b2a5153a79ec627113223222ed61190bcb3a7e3 (diff)
downloadswift-a6f8c4e4579b93b3e004229dcdeb098bd5b356a4.zip
swift-a6f8c4e4579b93b3e004229dcdeb098bd5b356a4.tar.bz2
Add parsing for disco#info nodes
Change-Id: Icf9a526183650add0b5b42243fb1c78757c960c7
Diffstat (limited to 'Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp')
-rw-r--r--Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp b/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp
index 14ff79d..aeb0db8 100644
--- a/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp
+++ b/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp
@@ -5,6 +5,8 @@
*/
#include <Swiften/Parser/PayloadParsers/DiscoInfoParser.h>
+
+#include <boost/optional.hpp>
#include <Swiften/Parser/PayloadParsers/FormParser.h>
namespace Swift {
@@ -13,7 +15,12 @@ DiscoInfoParser::DiscoInfoParser() : level_(TopLevel), formParser_(NULL) {
}
void DiscoInfoParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
- if (level_ == PayloadLevel) {
+ if (level_ == TopLevel) {
+ if (attributes.getAttributeValue("node")) {
+ getPayloadInternal()->setNode(*attributes.getAttributeValue("node"));
+ }
+ }
+ else if (level_ == PayloadLevel) {
if (element == "identity") {
getPayloadInternal()->addIdentity(DiscoInfo::Identity(attributes.getAttribute("name"), attributes.getAttribute("category"), attributes.getAttribute("type"), attributes.getAttribute("lang", "http://www.w3.org/XML/1998/namespace")));
}