summaryrefslogtreecommitdiffstats
blob: 1500716a8ad14e222ca5bc23a2dd71c9397dd7ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 * Copyright (c) 2017 Tarun Gupta
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

#include <Swiften/Parser/PayloadParsers/MIXSubscribeParser.h>

#include <boost/optional.hpp>

#include <Swiften/Parser/PayloadParserFactory.h>
#include <Swiften/Parser/PayloadParserFactoryCollection.h>

using namespace Swift;

MIXSubscribeParser::MIXSubscribeParser() : level_(0) {
}

MIXSubscribeParser::~MIXSubscribeParser() {
}

void MIXSubscribeParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
    if (level_ == 0) {
        if (boost::optional<std::string> attributeValue = attributes.getAttributeValue("node")) {
            getPayloadInternal()->setNode(*attributeValue);
        }
    }
    ++level_;
}

void MIXSubscribeParser::handleEndElement(const std::string& , const std::string& ) {
    --level_;
}

void MIXSubscribeParser::handleCharacterData(const std::string& ) {
}