blob: ef1f930f7772f32b7c3ecb7c508b401c6bb6c301 (
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
38
39
40
41
|
/*
* Copyright (c) 2010 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include "Swiften/Parser/PayloadParsers/ChatStateParser.h"
namespace Swift {
ChatStateParser::ChatStateParser() : level_(0) {
}
void ChatStateParser::handleStartElement(const String& element, const String&, const AttributeMap&) {
if (level_ == 0) {
ChatState::ChatStateType state = ChatState::Active;
if (element == "active") {
state = ChatState::Active;
} else if (element == "composing") {
state = ChatState::Composing;
} else if (element == "inactive") {
state = ChatState::Inactive;
} else if (element == "paused") {
state = ChatState::Paused;
} else if (element == "gone") {
state = ChatState::Gone;
}
getPayloadInternal()->setChatState(state);
}
++level_;
}
void ChatStateParser::handleEndElement(const String&, const String&) {
--level_;
}
void ChatStateParser::handleCharacterData(const String&) {
}
}
|