diff options
Diffstat (limited to 'Swiften')
3 files changed, 17 insertions, 2 deletions
diff --git a/Swiften/Elements/InBandRegistrationPayload.h b/Swiften/Elements/InBandRegistrationPayload.h index 6dafa04..1a293ba 100644 --- a/Swiften/Elements/InBandRegistrationPayload.h +++ b/Swiften/Elements/InBandRegistrationPayload.h @@ -18,7 +18,7 @@ namespace Swift { public: typedef boost::shared_ptr<InBandRegistrationPayload> ref; - InBandRegistrationPayload() : registered(false) {} + InBandRegistrationPayload() : registered(false), remove(false) {} Form::ref getForm() const { return form; } void setForm(Form::ref f) { form = f; } @@ -31,6 +31,14 @@ namespace Swift { registered = b; } + bool isRemove() const { + return remove; + } + + void setRemove(bool b) { + remove = b; + } + const boost::optional<String>& getInstructions() const { return instructions; } @@ -175,10 +183,10 @@ namespace Swift { this->key = v; } - private: Form::ref form; bool registered; + bool remove; boost::optional<String> instructions; boost::optional<String> username; boost::optional<String> nick; diff --git a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp index 0e1b593..5a9b3d8 100644 --- a/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp +++ b/Swiften/Parser/PayloadParsers/InBandRegistrationPayloadParser.cpp @@ -56,6 +56,9 @@ void InBandRegistrationPayloadParser::handleEndElement(const String& element, co else if (element == "registered") { getPayloadInternal()->setRegistered(true); } + else if (element == "remove") { + getPayloadInternal()->setRemove(true); + } else if (element == "instructions") { getPayloadInternal()->setInstructions(currentText); } diff --git a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp index 8e8bcf2..5729df6 100644 --- a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp @@ -25,6 +25,10 @@ String InBandRegistrationPayloadSerializer::serializePayload(boost::shared_ptr<I registerElement.addNode(XMLElement::ref(new XMLElement("registered"))); } + if (registration->isRemove()) { + registerElement.addNode(XMLElement::ref(new XMLElement("remove"))); + } + if (registration->getInstructions()) { registerElement.addNode(XMLElement::ref(new XMLElement("instructions", "", *registration->getInstructions()))); } |