summaryrefslogtreecommitdiffstats
blob: 63309250f67c439406cd2e62859ea05ca4cf2c70 (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
37
/*
 * Copyright (c) 2017 Tarun Gupta
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

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

#include <boost/optional.hpp>

namespace Swift {

MIXLeaveParser::MIXLeaveParser() : level_(0) {
}

MIXLeaveParser::~MIXLeaveParser() {
}

void MIXLeaveParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
    if (level_ == 0) {
        if (auto attributeValue = attributes.getAttributeValue("channel")) {
            if (auto jid = JID::parse(*attributeValue)) {
                getPayloadInternal()->setChannel(*jid);
            }
        }
    }
    ++level_;
}

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

void MIXLeaveParser::handleCharacterData(const std::string&) {

}
}