summaryrefslogtreecommitdiffstats
blob: ffa24ad4e1d9762e91edccaeecf283f98825ad22 (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
#include "Swiften/Parser/PayloadParsers/DiscoInfoParser.h"

namespace Swift {

DiscoInfoParser::DiscoInfoParser() : level_(TopLevel) {
}

void DiscoInfoParser::handleStartElement(const String& element, const String&, const AttributeMap& attributes) {
	if (level_ == PayloadLevel) {
		if (element == "identity") {
			getPayloadInternal()->addIdentity(DiscoInfo::Identity(attributes.getAttribute("name"), attributes.getAttribute("category"), attributes.getAttribute("type"), attributes.getAttribute("lang")));
		}
		else if (element == "feature") {
			getPayloadInternal()->addFeature(attributes.getAttribute("var"));
		}
	}
	++level_;
}

void DiscoInfoParser::handleEndElement(const String&, const String&) {
	--level_;
}

void DiscoInfoParser::handleCharacterData(const String&) {
}

}