summaryrefslogtreecommitdiffstats
blob: 81f2ce872d4981bf9a3c0e05f4c964cc3ff3a7e4 (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
/*
 * 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/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&) {
}

}