diff options
author | Remko Tronçon <git@el-tramo.be> | 2009-07-18 19:04:32 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2009-07-18 20:40:56 (GMT) |
commit | 4457bc810a326de8d7895b3f2ff36ade5f1ae1a0 (patch) | |
tree | 1556c4b0190453897d4799d23b05e651b0bb8a32 /Swiften/Serializer/XMPPSerializer.cpp | |
parent | 4052a822acd9da9dab6a8e2343c6170fb08dd8d6 (diff) | |
download | swift-contrib-4457bc810a326de8d7895b3f2ff36ade5f1ae1a0.zip swift-contrib-4457bc810a326de8d7895b3f2ff36ade5f1ae1a0.tar.bz2 |
Implement incoming linklocal connections.
Diffstat (limited to 'Swiften/Serializer/XMPPSerializer.cpp')
-rw-r--r-- | Swiften/Serializer/XMPPSerializer.cpp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Swiften/Serializer/XMPPSerializer.cpp b/Swiften/Serializer/XMPPSerializer.cpp index 6139586..660bb37 100644 --- a/Swiften/Serializer/XMPPSerializer.cpp +++ b/Swiften/Serializer/XMPPSerializer.cpp @@ -3,6 +3,7 @@ #include <boost/bind.hpp> #include <iostream> +#include "Swiften/Elements/ProtocolHeader.h" #include "Swiften/Base/foreach.h" #include "Swiften/Serializer/CompressRequestSerializer.h" #include "Swiften/Serializer/CompressFailureSerializer.h" @@ -34,16 +35,19 @@ XMPPSerializer::XMPPSerializer(PayloadSerializerCollection* payloadSerializers) serializers_.push_back(boost::shared_ptr<ElementSerializer>(new StreamFeaturesSerializer())); } -String XMPPSerializer::serializeHeader(const String& from, const String& to, const String& id) const { - String result = "<?xml version=\"1.0\"?><stream:stream xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\" version=\"1.0\""; - if (!from.isEmpty()) { - result += " from=\"" + from + "\""; +String XMPPSerializer::serializeHeader(const ProtocolHeader& header) const { + String result = "<?xml version=\"1.0\"?><stream:stream xmlns=\"jabber:client\" xmlns:stream=\"http://etherx.jabber.org/streams\""; + if (!header.getFrom().isEmpty()) { + result += " from=\"" + header.getFrom() + "\""; } - if (!to.isEmpty()) { - result += " to=\"" + to + "\""; + if (!header.getTo().isEmpty()) { + result += " to=\"" + header.getTo() + "\""; } - if (!id.isEmpty()) { - result += " id=\"" + id + "\""; + if (!header.getID().isEmpty()) { + result += " id=\"" + header.getID() + "\""; + } + if (!header.getVersion().isEmpty()) { + result += " version=\"" + header.getVersion() + "\""; } result += ">"; return result; |