summaryrefslogtreecommitdiffstats
blob: d14036876fb286ec6aed95256dff586de5cecc8b (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
42
43
44
45
46
47
/*
 * Copyright (c) 2011 Tobias Markmann
 * Licensed under the simplified BSD license.
 * See Documentation/Licenses/BSD-simplified.txt for more information.
 */

/*
 * Copyright (c) 2013 Remko Tronçon
 * Licensed under the GNU General Public License.
 * See the COPYING file for more information.
 */

#include <boost/lexical_cast.hpp>
#include <boost/optional.hpp>

#include "JingleIBBTransportMethodPayloadParser.h"

#include <Swiften/Base/Log.h>

namespace Swift {
	JingleIBBTransportMethodPayloadParser::JingleIBBTransportMethodPayloadParser() : level(0) {
		
	}
	
	void JingleIBBTransportMethodPayloadParser::handleStartElement(const std::string&, const std::string&, const AttributeMap& attributes) {
		try {
			boost::optional<std::string> blockSize = attributes.getAttributeValue("block-size");
			if (blockSize) {
				getPayloadInternal()->setBlockSize(boost::lexical_cast<unsigned int>(*blockSize));
			}
		} 
		catch (boost::bad_lexical_cast &) {
		}
		getPayloadInternal()->setSessionID(attributes.getAttributeValue("sid").get_value_or(""));
		++level;
	}
	
	void JingleIBBTransportMethodPayloadParser::handleEndElement(const std::string&, const std::string&) {
		--level;
		

	}
	
	void JingleIBBTransportMethodPayloadParser::handleCharacterData(const std::string&) {

	}
}