summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2009-07-13 07:17:57 (GMT)
committerRemko Tronçon <git@el-tramo.be>2009-07-13 07:18:39 (GMT)
commit6ca206b0d0645e50a8a2c59ebd134f9c0f164b9b (patch)
tree1c4d785f79941b07e7c7d7473fe98d09229b5fa6 /Swiften/Serializer
parent72858ab262a16aa8db209c2898ab0d3c951a9829 (diff)
downloadswift-contrib-6ca206b0d0645e50a8a2c59ebd134f9c0f164b9b.zip
swift-contrib-6ca206b0d0645e50a8a2c59ebd134f9c0f164b9b.tar.bz2
Server stream header support.
Diffstat (limited to 'Swiften/Serializer')
-rw-r--r--Swiften/Serializer/XMPPSerializer.cpp15
-rw-r--r--Swiften/Serializer/XMPPSerializer.h2
2 files changed, 14 insertions, 3 deletions
diff --git a/Swiften/Serializer/XMPPSerializer.cpp b/Swiften/Serializer/XMPPSerializer.cpp
index c43f9db..6139586 100644
--- a/Swiften/Serializer/XMPPSerializer.cpp
+++ b/Swiften/Serializer/XMPPSerializer.cpp
@@ -34,8 +34,19 @@ XMPPSerializer::XMPPSerializer(PayloadSerializerCollection* payloadSerializers)
serializers_.push_back(boost::shared_ptr<ElementSerializer>(new StreamFeaturesSerializer()));
}
-String XMPPSerializer::serializeHeader(const String& domain) const {
- return "<?xml version='1.0'?><stream:stream to='" + domain + "' xmlns='jabber:client' xmlns:stream='http://etherx.jabber.org/streams' version='1.0' >";
+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 + "\"";
+ }
+ if (!to.isEmpty()) {
+ result += " to=\"" + to + "\"";
+ }
+ if (!id.isEmpty()) {
+ result += " id=\"" + id + "\"";
+ }
+ result += ">";
+ return result;
}
String XMPPSerializer::serializeElement(boost::shared_ptr<Element> element) const {
diff --git a/Swiften/Serializer/XMPPSerializer.h b/Swiften/Serializer/XMPPSerializer.h
index 1fc8b9d..f77e14b 100644
--- a/Swiften/Serializer/XMPPSerializer.h
+++ b/Swiften/Serializer/XMPPSerializer.h
@@ -16,7 +16,7 @@ namespace Swift {
public:
XMPPSerializer(PayloadSerializerCollection*);
- String serializeHeader(const String& domain) const;
+ String serializeHeader(const String& from, const String& to, const String& id = "") const;
String serializeElement(boost::shared_ptr<Element> stanza) const;
String serializeFooter() const;