summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-12-09 21:57:09 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-12-09 21:57:09 (GMT)
commit08cc79dfe35b0735ef49108b82c52f94aab02e84 (patch)
tree6592881a96f7298ed6b1fc28073da4395d7ac368
parent6c9ab286f209266e627bd011847c3b5d6476ddab (diff)
downloadswift-contrib-08cc79dfe35b0735ef49108b82c52f94aab02e84.zip
swift-contrib-08cc79dfe35b0735ef49108b82c52f94aab02e84.tar.bz2
Upgraded stream errors to new RFC3920bis.
-rw-r--r--Swiften/Elements/StreamError.h3
-rw-r--r--Swiften/Parser/StreamErrorParser.cpp9
-rw-r--r--Swiften/Serializer/StreamErrorSerializer.cpp3
3 files changed, 10 insertions, 5 deletions
diff --git a/Swiften/Elements/StreamError.h b/Swiften/Elements/StreamError.h
index a480d5a..4311055 100644
--- a/Swiften/Elements/StreamError.h
+++ b/Swiften/Elements/StreamError.h
@@ -30,8 +30,10 @@ namespace Swift {
InvalidNamespace,
InvalidXML,
NotAuthorized,
+ NotWellFormed,
PolicyViolation,
RemoteConnectionFailed,
+ Reset,
ResourceConstraint,
RestrictedXML,
SeeOtherHost,
@@ -40,7 +42,6 @@ namespace Swift {
UnsupportedEncoding,
UnsupportedStanzaType,
UnsupportedVersion,
- XMLNotWellFormed,
};
StreamError(Type type = UndefinedCondition, const String& text = String()) : type_(type), text_(text) { }
diff --git a/Swiften/Parser/StreamErrorParser.cpp b/Swiften/Parser/StreamErrorParser.cpp
index 3d30d77..d222c40 100644
--- a/Swiften/Parser/StreamErrorParser.cpp
+++ b/Swiften/Parser/StreamErrorParser.cpp
@@ -60,12 +60,18 @@ void StreamErrorParser::handleEndElement(const String& element, const String& ns
else if(element == "not-authorized") {
getElementGeneric()->setType(StreamError::NotAuthorized);
}
+ else if(element == "not-well-formed") {
+ getElementGeneric()->setType(StreamError::NotWellFormed);
+ }
else if(element == "policy-violation") {
getElementGeneric()->setType(StreamError::PolicyViolation);
}
else if(element == "remote-connection-failed") {
getElementGeneric()->setType(StreamError::RemoteConnectionFailed);
}
+ else if(element == "reset") {
+ getElementGeneric()->setType(StreamError::Reset);
+ }
else if(element == "resource-constraint") {
getElementGeneric()->setType(StreamError::ResourceConstraint);
}
@@ -90,9 +96,6 @@ void StreamErrorParser::handleEndElement(const String& element, const String& ns
else if(element == "unsupported-version") {
getElementGeneric()->setType(StreamError::UnsupportedVersion);
}
- else if(element == "xml-not-well-formed") {
- getElementGeneric()->setType(StreamError::XMLNotWellFormed);
- }
else {
getElementGeneric()->setType(StreamError::UndefinedCondition);
}
diff --git a/Swiften/Serializer/StreamErrorSerializer.cpp b/Swiften/Serializer/StreamErrorSerializer.cpp
index 14dd13f..b88f5c4 100644
--- a/Swiften/Serializer/StreamErrorSerializer.cpp
+++ b/Swiften/Serializer/StreamErrorSerializer.cpp
@@ -34,8 +34,10 @@ String StreamErrorSerializer::serialize(boost::shared_ptr<Element> element) con
case StreamError::InvalidNamespace: typeTag = "invalid-namespace"; break;
case StreamError::InvalidXML: typeTag = "invalid-xml"; break;
case StreamError::NotAuthorized: typeTag = "not-authorized"; break;
+ case StreamError::NotWellFormed: typeTag = "not-well-formed"; break;
case StreamError::PolicyViolation: typeTag = "policy-violation"; break;
case StreamError::RemoteConnectionFailed: typeTag = "remote-connection-failed"; break;
+ case StreamError::Reset: typeTag = "reset"; break;
case StreamError::ResourceConstraint: typeTag = "resource-constraint"; break;
case StreamError::RestrictedXML: typeTag = "restricted-xml"; break;
case StreamError::SeeOtherHost: typeTag = "see-other-host"; break;
@@ -44,7 +46,6 @@ String StreamErrorSerializer::serialize(boost::shared_ptr<Element> element) con
case StreamError::UnsupportedEncoding: typeTag = "unsupported-encoding"; break;
case StreamError::UnsupportedStanzaType: typeTag = "unsupported-stanza-type"; break;
case StreamError::UnsupportedVersion: typeTag = "unsupported-version"; break;
- case StreamError::XMLNotWellFormed: typeTag = "xml-not-well-formed"; break;
}
errorElement.addNode(boost::make_shared<XMLElement>(typeTag, "urn:ietf:params:xml:ns:xmpp-streams"));