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/PayloadParsers
parenteda3475756f88098de69d5bea05b328b53d7ec04 (diff)
downloadswift-contrib-92af1a97f318f7f623df3183e90e7e828fa2eeb9.zip
swift-contrib-92af1a97f318f7f623df3183e90e7e828fa2eeb9.tar.bz2
Make parser infrastructure parser aware.
Resolves: #492
Diffstat (limited to 'Swiften/Parser/PayloadParsers')
-rw-r--r--Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp2
-rw-r--r--Swiften/Parser/PayloadParsers/RosterParser.cpp9
2 files changed, 7 insertions, 4 deletions
diff --git a/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp b/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp
index e1fcb20..2e9e87a 100644
--- a/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp
+++ b/Swiften/Parser/PayloadParsers/DiscoInfoParser.cpp
@@ -15,7 +15,7 @@ DiscoInfoParser::DiscoInfoParser() : level_(TopLevel), formParser_(NULL) {
void DiscoInfoParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
if (level_ == PayloadLevel) {
if (element == "identity") {
- getPayloadInternal()->addIdentity(DiscoInfo::Identity(attributes.getAttribute("name"), attributes.getAttribute("category"), attributes.getAttribute("type"), attributes.getAttribute("lang")));
+ getPayloadInternal()->addIdentity(DiscoInfo::Identity(attributes.getAttribute("name"), attributes.getAttribute("category"), attributes.getAttribute("type"), attributes.getAttribute("lang", "http://www.w3.org/XML/1998/namespace")));
}
else if (element == "feature") {
getPayloadInternal()->addFeature(attributes.getAttribute("var"));
diff --git a/Swiften/Parser/PayloadParsers/RosterParser.cpp b/Swiften/Parser/PayloadParsers/RosterParser.cpp
index 0da9f48..5fba30b 100644
--- a/Swiften/Parser/PayloadParsers/RosterParser.cpp
+++ b/Swiften/Parser/PayloadParsers/RosterParser.cpp
@@ -5,6 +5,9 @@
*/
#include "Swiften/Parser/PayloadParsers/RosterParser.h"
+
+#include <boost/optional.hpp>
+
#include "Swiften/Parser/SerializingParser.h"
namespace Swift {
@@ -14,9 +17,9 @@ RosterParser::RosterParser() : level_(TopLevel), inItem_(false), unknownContentP
void RosterParser::handleStartElement(const std::string& element, const std::string& ns, const AttributeMap& attributes) {
if (level_ == TopLevel) {
- AttributeMap::const_iterator i = attributes.find("ver");
- if (i != attributes.end()) {
- getPayloadInternal()->setVersion(i->second);
+ boost::optional<std::string> ver = attributes.getAttributeValue("ver");
+ if (ver) {
+ getPayloadInternal()->setVersion(*ver);
}
}
else if (level_ == PayloadLevel) {