diff options
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp')
-rw-r--r-- | Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp | 140 |
1 files changed, 69 insertions, 71 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp index 2fdcab2..04b7c56 100644 --- a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp +++ b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp @@ -1,113 +1,111 @@ /* - * Copyright (c) 2010 Isode Limited. + * Copyright (c) 2010-2016 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ #include <Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h> -#include <boost/shared_ptr.hpp> -#include <boost/smart_ptr/make_shared.hpp> +#include <memory> -#include <Swiften/Base/foreach.h> +#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> #include <Swiften/Serializer/XML/XMLElement.h> #include <Swiften/Serializer/XML/XMLRawTextNode.h> -#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h> namespace Swift { InBandRegistrationPayloadSerializer::InBandRegistrationPayloadSerializer() { } -std::string InBandRegistrationPayloadSerializer::serializePayload(boost::shared_ptr<InBandRegistrationPayload> registration) const { - XMLElement registerElement("query", "jabber:iq:register"); +std::string InBandRegistrationPayloadSerializer::serializePayload(std::shared_ptr<InBandRegistrationPayload> registration) const { + XMLElement registerElement("query", "jabber:iq:register"); - if (registration->isRegistered()) { - registerElement.addNode(XMLElement::ref(new XMLElement("registered"))); - } + if (registration->isRegistered()) { + registerElement.addNode(XMLElement::ref(new XMLElement("registered"))); + } - if (registration->isRemove()) { - registerElement.addNode(XMLElement::ref(new XMLElement("remove"))); - } + if (registration->isRemove()) { + registerElement.addNode(XMLElement::ref(new XMLElement("remove"))); + } - if (registration->getInstructions()) { - registerElement.addNode(XMLElement::ref(new XMLElement("instructions", "", *registration->getInstructions()))); - } + if (registration->getInstructions()) { + registerElement.addNode(XMLElement::ref(new XMLElement("instructions", "", *registration->getInstructions()))); + } - if (registration->getUsername()) { - registerElement.addNode(XMLElement::ref(new XMLElement("username", "", *registration->getUsername()))); - } + if (registration->getUsername()) { + registerElement.addNode(XMLElement::ref(new XMLElement("username", "", *registration->getUsername()))); + } - if (registration->getNick()) { - registerElement.addNode(XMLElement::ref(new XMLElement("nick", "", *registration->getNick()))); - } + if (registration->getNick()) { + registerElement.addNode(XMLElement::ref(new XMLElement("nick", "", *registration->getNick()))); + } - if (registration->getPassword()) { - registerElement.addNode(XMLElement::ref(new XMLElement("password", "", *registration->getPassword()))); - } + if (registration->getPassword()) { + registerElement.addNode(XMLElement::ref(new XMLElement("password", "", *registration->getPassword()))); + } - if (registration->getName()) { - registerElement.addNode(XMLElement::ref(new XMLElement("name", "", *registration->getName()))); - } + if (registration->getName()) { + registerElement.addNode(XMLElement::ref(new XMLElement("name", "", *registration->getName()))); + } - if (registration->getFirst()) { - registerElement.addNode(XMLElement::ref(new XMLElement("first", "", *registration->getFirst()))); - } + if (registration->getFirst()) { + registerElement.addNode(XMLElement::ref(new XMLElement("first", "", *registration->getFirst()))); + } - if (registration->getLast()) { - registerElement.addNode(XMLElement::ref(new XMLElement("last", "", *registration->getLast()))); - } + if (registration->getLast()) { + registerElement.addNode(XMLElement::ref(new XMLElement("last", "", *registration->getLast()))); + } - if (registration->getEMail()) { - registerElement.addNode(XMLElement::ref(new XMLElement("email", "", *registration->getEMail()))); - } + if (registration->getEMail()) { + registerElement.addNode(XMLElement::ref(new XMLElement("email", "", *registration->getEMail()))); + } - if (registration->getAddress()) { - registerElement.addNode(XMLElement::ref(new XMLElement("address", "", *registration->getAddress()))); - } + if (registration->getAddress()) { + registerElement.addNode(XMLElement::ref(new XMLElement("address", "", *registration->getAddress()))); + } - if (registration->getCity()) { - registerElement.addNode(XMLElement::ref(new XMLElement("city", "", *registration->getCity()))); - } + if (registration->getCity()) { + registerElement.addNode(XMLElement::ref(new XMLElement("city", "", *registration->getCity()))); + } - if (registration->getState()) { - registerElement.addNode(XMLElement::ref(new XMLElement("state", "", *registration->getState()))); - } + if (registration->getState()) { + registerElement.addNode(XMLElement::ref(new XMLElement("state", "", *registration->getState()))); + } - if (registration->getZip()) { - registerElement.addNode(XMLElement::ref(new XMLElement("zip", "", *registration->getZip()))); - } + if (registration->getZip()) { + registerElement.addNode(XMLElement::ref(new XMLElement("zip", "", *registration->getZip()))); + } - if (registration->getPhone()) { - registerElement.addNode(XMLElement::ref(new XMLElement("phone", "", *registration->getPhone()))); - } + if (registration->getPhone()) { + registerElement.addNode(XMLElement::ref(new XMLElement("phone", "", *registration->getPhone()))); + } - if (registration->getURL()) { - registerElement.addNode(XMLElement::ref(new XMLElement("url", "", *registration->getURL()))); - } + if (registration->getURL()) { + registerElement.addNode(XMLElement::ref(new XMLElement("url", "", *registration->getURL()))); + } - if (registration->getDate()) { - registerElement.addNode(XMLElement::ref(new XMLElement("date", "", *registration->getDate()))); - } + if (registration->getDate()) { + registerElement.addNode(XMLElement::ref(new XMLElement("date", "", *registration->getDate()))); + } - if (registration->getMisc()) { - registerElement.addNode(XMLElement::ref(new XMLElement("misc", "", *registration->getMisc()))); - } + if (registration->getMisc()) { + registerElement.addNode(XMLElement::ref(new XMLElement("misc", "", *registration->getMisc()))); + } - if (registration->getText()) { - registerElement.addNode(XMLElement::ref(new XMLElement("text", "", *registration->getText()))); - } + if (registration->getText()) { + registerElement.addNode(XMLElement::ref(new XMLElement("text", "", *registration->getText()))); + } - if (registration->getKey()) { - registerElement.addNode(XMLElement::ref(new XMLElement("key", "", *registration->getKey()))); - } + if (registration->getKey()) { + registerElement.addNode(XMLElement::ref(new XMLElement("key", "", *registration->getKey()))); + } - if (Form::ref form = registration->getForm()) { - registerElement.addNode(boost::make_shared<XMLRawTextNode>(FormSerializer().serialize(form))); - } + if (Form::ref form = registration->getForm()) { + registerElement.addNode(std::make_shared<XMLRawTextNode>(FormSerializer().serialize(form))); + } - return registerElement.serialize(); + return registerElement.serialize(); } } |