summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2010-12-09 21:00:03 (GMT)
committerRemko Tronçon <git@el-tramo.be>2010-12-09 21:32:08 (GMT)
commitedabab9987aa7fd74f7db5dcfc77677472406180 (patch)
tree4512825cc540ea9412671f3bc8f970d90415568f /Swiften/Serializer
parentf0fec4f31afcc91a55d72aad462a0cc571aacf5d (diff)
downloadswift-edabab9987aa7fd74f7db5dcfc77677472406180.zip
swift-edabab9987aa7fd74f7db5dcfc77677472406180.tar.bz2
Added Stream error parserialement.
Diffstat (limited to 'Swiften/Serializer')
-rw-r--r--Swiften/Serializer/GenericElementSerializer.h6
-rw-r--r--Swiften/Serializer/GenericPayloadSerializer.h5
-rw-r--r--Swiften/Serializer/XMPPSerializer.cpp43
3 files changed, 29 insertions, 25 deletions
diff --git a/Swiften/Serializer/GenericElementSerializer.h b/Swiften/Serializer/GenericElementSerializer.h
index 702e374..0329411 100644
--- a/Swiften/Serializer/GenericElementSerializer.h
+++ b/Swiften/Serializer/GenericElementSerializer.h
@@ -6,7 +6,9 @@
#pragma once
-#include "Swiften/Serializer/ElementSerializer.h"
+#include <boost/shared_ptr.hpp>
+
+#include <Swiften/Serializer/ElementSerializer.h>
namespace Swift {
template<typename T>
@@ -15,7 +17,7 @@ namespace Swift {
virtual String serialize(boost::shared_ptr<Element> element) const = 0;
virtual bool canSerialize(boost::shared_ptr<Element> element) const {
- return dynamic_cast<T*>(element.get()) != 0;
+ return boost::dynamic_pointer_cast<T>(element);
}
};
}
diff --git a/Swiften/Serializer/GenericPayloadSerializer.h b/Swiften/Serializer/GenericPayloadSerializer.h
index b415256..13603e5 100644
--- a/Swiften/Serializer/GenericPayloadSerializer.h
+++ b/Swiften/Serializer/GenericPayloadSerializer.h
@@ -8,8 +8,7 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Serializer/PayloadSerializer.h"
-#include "Swiften/Elements/Body.h"
+#include <Swiften/Serializer/PayloadSerializer.h>
namespace Swift {
template<typename PAYLOAD_TYPE>
@@ -20,7 +19,7 @@ namespace Swift {
}
virtual bool canSerialize(boost::shared_ptr<Payload> element) const {
- return dynamic_cast<PAYLOAD_TYPE*>(element.get());
+ return boost::dynamic_pointer_cast<PAYLOAD_TYPE>(element);
}
virtual String serializePayload(boost::shared_ptr<PAYLOAD_TYPE>) const = 0;
diff --git a/Swiften/Serializer/XMPPSerializer.cpp b/Swiften/Serializer/XMPPSerializer.cpp
index da4715c..ad84152 100644
--- a/Swiften/Serializer/XMPPSerializer.cpp
+++ b/Swiften/Serializer/XMPPSerializer.cpp
@@ -7,6 +7,7 @@
#include "Swiften/Serializer/XMPPSerializer.h"
#include <boost/bind.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <iostream>
#include <cassert>
@@ -14,6 +15,7 @@
#include "Swiften/Base/foreach.h"
#include "Swiften/Serializer/CompressRequestSerializer.h"
#include "Swiften/Serializer/CompressFailureSerializer.h"
+#include "Swiften/Serializer/StreamErrorSerializer.h"
#include "Swiften/Serializer/StreamFeaturesSerializer.h"
#include "Swiften/Serializer/AuthRequestSerializer.h"
#include "Swiften/Serializer/AuthFailureSerializer.h"
@@ -36,26 +38,27 @@
namespace Swift {
XMPPSerializer::XMPPSerializer(PayloadSerializerCollection* payloadSerializers, StreamType type) : type_(type) {
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new PresenceSerializer(payloadSerializers)));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new IQSerializer(payloadSerializers)));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new MessageSerializer(payloadSerializers)));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new CompressRequestSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new CompressFailureSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new AuthRequestSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new AuthFailureSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new AuthSuccessSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new AuthChallengeSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new AuthResponseSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new StartTLSRequestSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new StartTLSFailureSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new TLSProceedSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new StreamFeaturesSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new EnableStreamManagementSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new StreamManagementEnabledSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new StreamManagementFailedSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new StanzaAckSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new StanzaAckRequestSerializer()));
- serializers_.push_back(boost::shared_ptr<ElementSerializer>(new ComponentHandshakeSerializer()));
+ serializers_.push_back(boost::make_shared<PresenceSerializer>(payloadSerializers));
+ serializers_.push_back(boost::make_shared<IQSerializer>(payloadSerializers));
+ serializers_.push_back(boost::make_shared<MessageSerializer>(payloadSerializers));
+ serializers_.push_back(boost::make_shared<CompressRequestSerializer>());
+ serializers_.push_back(boost::make_shared<CompressFailureSerializer>());
+ serializers_.push_back(boost::make_shared<AuthRequestSerializer>());
+ serializers_.push_back(boost::make_shared<AuthFailureSerializer>());
+ serializers_.push_back(boost::make_shared<AuthSuccessSerializer>());
+ serializers_.push_back(boost::make_shared<AuthChallengeSerializer>());
+ serializers_.push_back(boost::make_shared<AuthResponseSerializer>());
+ serializers_.push_back(boost::make_shared<StartTLSRequestSerializer>());
+ serializers_.push_back(boost::make_shared<StartTLSFailureSerializer>());
+ serializers_.push_back(boost::make_shared<TLSProceedSerializer>());
+ serializers_.push_back(boost::make_shared<StreamFeaturesSerializer>());
+ serializers_.push_back(boost::make_shared<StreamErrorSerializer>());
+ serializers_.push_back(boost::make_shared<EnableStreamManagementSerializer>());
+ serializers_.push_back(boost::make_shared<StreamManagementEnabledSerializer>());
+ serializers_.push_back(boost::make_shared<StreamManagementFailedSerializer>());
+ serializers_.push_back(boost::make_shared<StanzaAckSerializer>());
+ serializers_.push_back(boost::make_shared<StanzaAckRequestSerializer>());
+ serializers_.push_back(boost::make_shared<ComponentHandshakeSerializer>());
}
String XMPPSerializer::serializeHeader(const ProtocolHeader& header) const {