blob: 71ae57156aa854c8884dd808a244a44a6251795a (
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
|
/*
* Copyright (c) 2010 Kevin Smith
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#include <Swiften/Parser/PayloadParsers/MUCUserPayloadParser.h>
#include <boost/lexical_cast.hpp>
#include <Swiften/Base/foreach.h>
#include <Swiften/Elements/MUCOccupant.h>
namespace Swift {
void MUCUserPayloadParser::handleTree(ParserElement::ref root) {
foreach (ParserElement::ref itemElement, root->getChildren("item", "http://jabber.org/protocol/muc#user")) {
MUCItem item = MUCItemParser::itemFromTree(itemElement);
getPayloadInternal()->addItem(item);
}
foreach (ParserElement::ref statusElement, root->getChildren("item", "http://jabber.org/protocol/muc#user")) {
MUCUserPayload::StatusCode status;
try {
status.code = boost::lexical_cast<int>(statusElement->getAttributes().getAttribute("code").c_str());
getPayloadInternal()->addStatusCode(status);
} catch (boost::bad_lexical_cast&) {
}
}
}
}
|