diff options
Diffstat (limited to 'Swiften/Parser/XMPPParser.cpp')
-rw-r--r-- | Swiften/Parser/XMPPParser.cpp | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/Swiften/Parser/XMPPParser.cpp b/Swiften/Parser/XMPPParser.cpp index 2b45a12..d2a5a98 100644 --- a/Swiften/Parser/XMPPParser.cpp +++ b/Swiften/Parser/XMPPParser.cpp @@ -33,61 +33,60 @@ #include <Swiften/Parser/StreamManagementEnabledParser.h> #include <Swiften/Parser/StreamManagementFailedParser.h> #include <Swiften/Parser/StreamResumeParser.h> #include <Swiften/Parser/StreamResumedParser.h> #include <Swiften/Parser/TLSProceedParser.h> #include <Swiften/Parser/UnknownElementParser.h> #include <Swiften/Parser/XMLParser.h> #include <Swiften/Parser/XMLParserFactory.h> #include <Swiften/Parser/XMPPParserClient.h> // TODO: Whenever an error occurs in the handlers, stop the parser by returing // a bool value, and stopping the XML parser namespace Swift { XMPPParser::XMPPParser( XMPPParserClient* client, PayloadParserFactoryCollection* payloadParserFactories, XMLParserFactory* xmlParserFactory) : xmlParser_(nullptr), client_(client), payloadParserFactories_(payloadParserFactories), level_(0), currentElementParser_(nullptr), parseErrorOccurred_(false) { xmlParser_ = xmlParserFactory->createXMLParser(this); } XMPPParser::~XMPPParser() { delete currentElementParser_; - delete xmlParser_; } bool XMPPParser::parse(const std::string& data) { bool xmlParseResult = xmlParser_->parse(data); return xmlParseResult && !parseErrorOccurred_; } void XMPPParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) { if (!parseErrorOccurred_) { if (level_ == TopLevel) { if (element == "stream" && ns == "http://etherx.jabber.org/streams") { ProtocolHeader header; header.setFrom(attributes.getAttribute("from")); header.setTo(attributes.getAttribute("to")); header.setID(attributes.getAttribute("id")); header.setVersion(attributes.getAttribute("version")); client_->handleStreamStart(header); } else { parseErrorOccurred_ = true; } } else { if (level_ == StreamLevel) { assert(!currentElementParser_); currentElementParser_ = createElementParser(element, ns); } currentElementParser_->handleStartElement(element, ns, attributes); } } |