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

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

namespace Swift {

ClientStateParser::ClientStateParser() {
}

void ClientStateParser::handleStartElement(const std::string& element, const std::string&, const AttributeMap&) {
    if (level_ == 0) {
        auto state = ClientState::ClientStateType::Active;
        if (element == "active") {
            state = ClientState::ClientStateType::Active;
        } else if (element == "inactive") {
            state = ClientState::ClientStateType::Inactive;
        }
        getPayloadInternal()->setClientState(state);
    }
    ++level_;
}

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

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

}

}