From 8baf0e407b3b4914654a6036a16ac81b7a2e7414 Mon Sep 17 00:00:00 2001 From: Edwin Mons <edwin.mons@isode.com> Date: Wed, 30 Oct 2019 09:05:07 +0100 Subject: Bring StreamError enum to spec RFC 6120 no longer defines invalid-id, and adds unsupported-feature. The StreamError enum was derived from the schema in section A.2, which erroneously had these two deviations from 4.9.3. Test-Information: Unit tests pass on Debian 9 Change-Id: I2bb3d0b09448877bbd4618fa852baab87bfa1abc diff --git a/Swiften/Elements/StreamError.h b/Swiften/Elements/StreamError.h index aa294fd..6dda15c 100644 --- a/Swiften/Elements/StreamError.h +++ b/Swiften/Elements/StreamError.h @@ -27,7 +27,6 @@ namespace Swift { ImproperAddressing, InternalServerError, InvalidFrom, - InvalidID, InvalidNamespace, InvalidXML, NotAuthorized, @@ -41,6 +40,7 @@ namespace Swift { SystemShutdown, UndefinedCondition, UnsupportedEncoding, + UnsupportedFeature, UnsupportedStanzaType, UnsupportedVersion }; diff --git a/Swiften/Parser/StreamErrorParser.cpp b/Swiften/Parser/StreamErrorParser.cpp index 64e0681..e89af58 100644 --- a/Swiften/Parser/StreamErrorParser.cpp +++ b/Swiften/Parser/StreamErrorParser.cpp @@ -48,9 +48,6 @@ void StreamErrorParser::handleEndElement(const std::string& element, const std:: else if(element == "invalid-from") { getElementGeneric()->setType(StreamError::InvalidFrom); } - else if(element == "invalid-id") { - getElementGeneric()->setType(StreamError::InvalidID); - } else if(element == "invalid-namespace") { getElementGeneric()->setType(StreamError::InvalidNamespace); } @@ -90,6 +87,9 @@ void StreamErrorParser::handleEndElement(const std::string& element, const std:: else if(element == "unsupported-encoding") { getElementGeneric()->setType(StreamError::UnsupportedEncoding); } + else if(element == "unsupported-feature") { + getElementGeneric()->setType(StreamError::UnsupportedFeature); + } else if(element == "unsupported-stanza-type") { getElementGeneric()->setType(StreamError::UnsupportedStanzaType); } diff --git a/Swiften/Serializer/StreamErrorSerializer.cpp b/Swiften/Serializer/StreamErrorSerializer.cpp index 66a71ca..684e8fe 100644 --- a/Swiften/Serializer/StreamErrorSerializer.cpp +++ b/Swiften/Serializer/StreamErrorSerializer.cpp @@ -30,7 +30,6 @@ SafeByteArray StreamErrorSerializer::serialize(std::shared_ptr<ToplevelElement> case StreamError::ImproperAddressing: typeTag = "improper-addressing"; break; case StreamError::InternalServerError: typeTag = "internal-server-error"; break; case StreamError::InvalidFrom: typeTag = "invalid-from"; break; - case StreamError::InvalidID: typeTag = "invalid-id"; break; case StreamError::InvalidNamespace: typeTag = "invalid-namespace"; break; case StreamError::InvalidXML: typeTag = "invalid-xml"; break; case StreamError::NotAuthorized: typeTag = "not-authorized"; break; @@ -44,6 +43,7 @@ SafeByteArray StreamErrorSerializer::serialize(std::shared_ptr<ToplevelElement> case StreamError::SystemShutdown: typeTag = "system-shutdown"; break; case StreamError::UndefinedCondition: typeTag = "undefined-condition"; break; case StreamError::UnsupportedEncoding: typeTag = "unsupported-encoding"; break; + case StreamError::UnsupportedFeature: typeTag = "unsupported-feature"; break; case StreamError::UnsupportedStanzaType: typeTag = "unsupported-stanza-type"; break; case StreamError::UnsupportedVersion: typeTag = "unsupported-version"; break; } -- cgit v0.10.2-6-g49f6