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

#include <Swiften/Serializer/PayloadSerializers/ClientStateSerializer.h>

namespace Swift {

ClientStateSerializer::ClientStateSerializer() : GenericPayloadSerializer<ClientState>() {
}

std::string ClientStateSerializer::serializePayload(std::shared_ptr<ClientState> clientState)  const {
    std::string result("<");
    switch (clientState->getClientState()) {
        case ClientState::ClientStateType::Active: result += "active"; break;
        case ClientState::ClientStateType::Inactive: result += "inactive"; break;
    }
    result += " xmlns=\"urn:xmpp:csi:0\"/>";
    return result;
}

}