summaryrefslogtreecommitdiffstats
blob: 51aa34b666bd7fea82a5681e341572c4784e6e2d (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
/*
 * Copyright (c) 2013 Tobias Markmann
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

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

#include <Swiften/Base/DateTime.h>

namespace Swift {

IdleParser::IdleParser() : level_(0) {
}

void IdleParser::handleStartElement(const std::string& /*element*/, const std::string& /*ns*/, const AttributeMap& attributes) {
	if (level_ == 0) {
		boost::posix_time::ptime since = stringToDateTime(attributes.getAttribute("since"));
		getPayloadInternal()->setSince(since);
	}
	++level_;
}

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

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

}

}