summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-04-11 20:15:20 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-04-18 19:11:42 (GMT)
commit92af1a97f318f7f623df3183e90e7e828fa2eeb9 (patch)
tree886d66feead5ca3c1d04152b570f7712be4a86c0 /Swiften/Parser/StanzaParser.cpp
parenteda3475756f88098de69d5bea05b328b53d7ec04 (diff)
downloadswift-92af1a97f318f7f623df3183e90e7e828fa2eeb9.zip
swift-92af1a97f318f7f623df3183e90e7e828fa2eeb9.tar.bz2
Make parser infrastructure parser aware.
Resolves: #492
Diffstat (limited to 'Swiften/Parser/StanzaParser.cpp')
-rw-r--r--Swiften/Parser/StanzaParser.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/Swiften/Parser/StanzaParser.cpp b/Swiften/Parser/StanzaParser.cpp
index 64c4901..051f37e 100644
--- a/Swiften/Parser/StanzaParser.cpp
+++ b/Swiften/Parser/StanzaParser.cpp
@@ -7,6 +7,7 @@
#include "Swiften/Parser/StanzaParser.h"
#include <iostream>
+#include <boost/optional.hpp>
#include <cassert>
#include "Swiften/Parser/PayloadParser.h"
@@ -39,17 +40,17 @@ void StanzaParser::handleStartElement(const std::string& element, const std::str
currentPayloadParser_->handleStartElement(element, ns, attributes);
}
else {
- AttributeMap::const_iterator from = attributes.find("from");
- if (from != attributes.end()) {
- getStanza()->setFrom(JID(from->second));
+ boost::optional<std::string> from = attributes.getAttributeValue("from");
+ if (from) {
+ getStanza()->setFrom(JID(*from));
}
- AttributeMap::const_iterator to = attributes.find("to");
- if (to != attributes.end()) {
- getStanza()->setTo(JID(to->second));
+ boost::optional<std::string> to = attributes.getAttributeValue("to");
+ if (to) {
+ getStanza()->setTo(JID(*to));
}
- AttributeMap::const_iterator id = attributes.find("id");
- if (id != attributes.end()) {
- getStanza()->setID(id->second);
+ boost::optional<std::string> id = attributes.getAttributeValue("id");
+ if (id) {
+ getStanza()->setID(*id);
}
handleStanzaAttributes(attributes);
}