diff options
Diffstat (limited to 'Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp')
-rw-r--r-- | Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp b/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp index 267c541..d6fb6be 100644 --- a/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp +++ b/Swiften/Parser/PayloadParsers/CarbonsReceivedParser.cpp @@ -7,39 +7,39 @@ #include <Swiften/Parser/PayloadParsers/CarbonsReceivedParser.h> namespace Swift { - CarbonsReceivedParser::CarbonsReceivedParser(PayloadParserFactoryCollection* factories) : GenericPayloadParser<CarbonsReceived>(), factories_(factories), level_(TopLevel) { - } + CarbonsReceivedParser::CarbonsReceivedParser(PayloadParserFactoryCollection* factories) : GenericPayloadParser<CarbonsReceived>(), factories_(factories), level_(TopLevel) { + } - CarbonsReceivedParser::~CarbonsReceivedParser() { - } + CarbonsReceivedParser::~CarbonsReceivedParser() { + } - void CarbonsReceivedParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { - if (level_ == PayloadLevel) { - if (element == "forwarded") { - forwardedParser_ = boost::dynamic_pointer_cast<ForwardedParser>(boost::make_shared<ForwardedParser>(factories_)); - } - } - if (forwardedParser_) { - forwardedParser_->handleStartElement(element, ns, attributes); - } - ++level_; - } + void CarbonsReceivedParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { + if (level_ == PayloadLevel) { + if (element == "forwarded") { + forwardedParser_ = boost::dynamic_pointer_cast<ForwardedParser>(boost::make_shared<ForwardedParser>(factories_)); + } + } + if (forwardedParser_) { + forwardedParser_->handleStartElement(element, ns, attributes); + } + ++level_; + } - void CarbonsReceivedParser::handleEndElement(const std::string& element, const std::string& ns) { - --level_; - if (forwardedParser_ && level_ >= PayloadLevel) { - forwardedParser_->handleEndElement(element, ns); - } - if (forwardedParser_ && level_ == PayloadLevel) { - /* done parsing nested stanza */ - getPayloadInternal()->setForwarded(forwardedParser_->getPayloadInternal()); - forwardedParser_.reset(); - } - } + void CarbonsReceivedParser::handleEndElement(const std::string& element, const std::string& ns) { + --level_; + if (forwardedParser_ && level_ >= PayloadLevel) { + forwardedParser_->handleEndElement(element, ns); + } + if (forwardedParser_ && level_ == PayloadLevel) { + /* done parsing nested stanza */ + getPayloadInternal()->setForwarded(forwardedParser_->getPayloadInternal()); + forwardedParser_.reset(); + } + } - void CarbonsReceivedParser::handleCharacterData(const std::string& data) { - if (forwardedParser_) { - forwardedParser_->handleCharacterData(data); - } - } + void CarbonsReceivedParser::handleCharacterData(const std::string& data) { + if (forwardedParser_) { + forwardedParser_->handleCharacterData(data); + } + } } |