summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp')
-rw-r--r--Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp
index 2e75ecb..9562edb 100644
--- a/Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PubSubSerializer.cpp
@@ -30,40 +30,40 @@
using namespace Swift;
PubSubSerializer::PubSubSerializer(PayloadSerializerCollection* serializers) : serializers(serializers) {
- pubsubSerializers.push_back(boost::make_shared<PubSubItemsSerializer>(serializers));
- pubsubSerializers.push_back(boost::make_shared<PubSubCreateSerializer>(serializers));
- pubsubSerializers.push_back(boost::make_shared<PubSubPublishSerializer>(serializers));
- pubsubSerializers.push_back(boost::make_shared<PubSubOptionsSerializer>(serializers));
- pubsubSerializers.push_back(boost::make_shared<PubSubAffiliationsSerializer>(serializers));
- pubsubSerializers.push_back(boost::make_shared<PubSubRetractSerializer>(serializers));
- pubsubSerializers.push_back(boost::make_shared<PubSubDefaultSerializer>(serializers));
- pubsubSerializers.push_back(boost::make_shared<PubSubSubscriptionsSerializer>(serializers));
- pubsubSerializers.push_back(boost::make_shared<PubSubSubscribeSerializer>(serializers));
- pubsubSerializers.push_back(boost::make_shared<PubSubUnsubscribeSerializer>(serializers));
- pubsubSerializers.push_back(boost::make_shared<PubSubSubscriptionSerializer>(serializers));
+ pubsubSerializers.push_back(boost::make_shared<PubSubItemsSerializer>(serializers));
+ pubsubSerializers.push_back(boost::make_shared<PubSubCreateSerializer>(serializers));
+ pubsubSerializers.push_back(boost::make_shared<PubSubPublishSerializer>(serializers));
+ pubsubSerializers.push_back(boost::make_shared<PubSubOptionsSerializer>(serializers));
+ pubsubSerializers.push_back(boost::make_shared<PubSubAffiliationsSerializer>(serializers));
+ pubsubSerializers.push_back(boost::make_shared<PubSubRetractSerializer>(serializers));
+ pubsubSerializers.push_back(boost::make_shared<PubSubDefaultSerializer>(serializers));
+ pubsubSerializers.push_back(boost::make_shared<PubSubSubscriptionsSerializer>(serializers));
+ pubsubSerializers.push_back(boost::make_shared<PubSubSubscribeSerializer>(serializers));
+ pubsubSerializers.push_back(boost::make_shared<PubSubUnsubscribeSerializer>(serializers));
+ pubsubSerializers.push_back(boost::make_shared<PubSubSubscriptionSerializer>(serializers));
}
PubSubSerializer::~PubSubSerializer() {
}
std::string PubSubSerializer::serializePayload(boost::shared_ptr<PubSub> payload) const {
- if (!payload) {
- return "";
- }
- XMLElement element("pubsub", "http://jabber.org/protocol/pubsub");
- boost::shared_ptr<PubSubPayload> p = payload->getPayload();
- foreach(boost::shared_ptr<PayloadSerializer> serializer, pubsubSerializers) {
- if (serializer->canSerialize(p)) {
- element.addNode(boost::make_shared<XMLRawTextNode>(serializer->serialize(p)));
- if (boost::shared_ptr<PubSubCreate> create = boost::dynamic_pointer_cast<PubSubCreate>(p)) {
- element.addNode(boost::make_shared<XMLRawTextNode>(boost::make_shared<PubSubConfigureSerializer>(serializers)->serialize(create->getConfigure())));
- }
- if (boost::shared_ptr<PubSubSubscribe> subscribe = boost::dynamic_pointer_cast<PubSubSubscribe>(p)) {
- element.addNode(boost::make_shared<XMLRawTextNode>(boost::make_shared<PubSubConfigureSerializer>(serializers)->serialize(subscribe->getOptions())));
- }
- }
- }
- return element.serialize();
+ if (!payload) {
+ return "";
+ }
+ XMLElement element("pubsub", "http://jabber.org/protocol/pubsub");
+ boost::shared_ptr<PubSubPayload> p = payload->getPayload();
+ foreach(boost::shared_ptr<PayloadSerializer> serializer, pubsubSerializers) {
+ if (serializer->canSerialize(p)) {
+ element.addNode(boost::make_shared<XMLRawTextNode>(serializer->serialize(p)));
+ if (boost::shared_ptr<PubSubCreate> create = boost::dynamic_pointer_cast<PubSubCreate>(p)) {
+ element.addNode(boost::make_shared<XMLRawTextNode>(boost::make_shared<PubSubConfigureSerializer>(serializers)->serialize(create->getConfigure())));
+ }
+ if (boost::shared_ptr<PubSubSubscribe> subscribe = boost::dynamic_pointer_cast<PubSubSubscribe>(p)) {
+ element.addNode(boost::make_shared<XMLRawTextNode>(boost::make_shared<PubSubConfigureSerializer>(serializers)->serialize(subscribe->getOptions())));
+ }
+ }
+ }
+ return element.serialize();
}