blob: 52d860ad50f8fc155fbdf4c1edf06f8aea296854 (
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
|
#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&) {
}
}
|