summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Serializer')
-rw-r--r--Swiften/Serializer/AuthChallengeSerializer.cpp15
-rw-r--r--Swiften/Serializer/AuthChallengeSerializer.h6
-rw-r--r--Swiften/Serializer/AuthFailureSerializer.h13
-rw-r--r--Swiften/Serializer/AuthRequestSerializer.cpp19
-rw-r--r--Swiften/Serializer/AuthRequestSerializer.h11
-rw-r--r--Swiften/Serializer/AuthResponseSerializer.cpp19
-rw-r--r--Swiften/Serializer/AuthResponseSerializer.h6
-rw-r--r--Swiften/Serializer/AuthSuccessSerializer.cpp15
-rw-r--r--Swiften/Serializer/AuthSuccessSerializer.h6
-rw-r--r--Swiften/Serializer/ComponentHandshakeSerializer.cpp6
-rw-r--r--Swiften/Serializer/ComponentHandshakeSerializer.h6
-rw-r--r--Swiften/Serializer/CompressFailureSerializer.h13
-rw-r--r--Swiften/Serializer/CompressRequestSerializer.cpp6
-rw-r--r--Swiften/Serializer/CompressRequestSerializer.h9
-rw-r--r--Swiften/Serializer/ElementSerializer.cpp2
-rw-r--r--Swiften/Serializer/ElementSerializer.h11
-rw-r--r--Swiften/Serializer/EnableStreamManagementSerializer.h8
-rw-r--r--Swiften/Serializer/GenericElementSerializer.h2
-rw-r--r--Swiften/Serializer/GenericStanzaSerializer.h7
-rw-r--r--Swiften/Serializer/IQSerializer.h13
-rw-r--r--Swiften/Serializer/MessageSerializer.cpp4
-rw-r--r--Swiften/Serializer/MessageSerializer.h9
-rw-r--r--Swiften/Serializer/PayloadSerializer.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializer.h11
-rw-r--r--Swiften/Serializer/PayloadSerializerCollection.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializerCollection.h2
-rw-r--r--Swiften/Serializer/PayloadSerializers/BodySerializer.h11
-rw-r--r--Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp8
-rw-r--r--Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h9
-rw-r--r--Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp16
-rw-r--r--Swiften/Serializer/PayloadSerializers/CommandSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp5
-rw-r--r--Swiften/Serializer/PayloadSerializers/DelaySerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp10
-rw-r--r--Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h9
-rw-r--r--Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp6
-rw-r--r--Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/ErrorSerializer.h9
-rw-r--r--Swiften/Serializer/PayloadSerializers/FormSerializer.cpp21
-rw-r--r--Swiften/Serializer/PayloadSerializers/FormSerializer.h8
-rw-r--r--Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp78
-rw-r--r--Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h7
-rw-r--r--Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/IBBSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp10
-rw-r--r--Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/LastSerializer.h23
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp8
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp7
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp10
-rw-r--r--Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp6
-rw-r--r--Swiften/Serializer/PayloadSerializers/NicknameSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/PrioritySerializer.h9
-rw-r--r--Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp12
-rw-r--r--Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h22
-rw-r--r--Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp6
-rw-r--r--Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h9
-rw-r--r--Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp46
-rw-r--r--Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h19
-rw-r--r--Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp13
-rw-r--r--Swiften/Serializer/PayloadSerializers/RosterSerializer.h9
-rw-r--r--Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp10
-rw-r--r--Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp10
-rw-r--r--Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h9
-rw-r--r--Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp10
-rw-r--r--Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h9
-rw-r--r--Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h9
-rw-r--r--Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h9
-rw-r--r--Swiften/Serializer/PayloadSerializers/StatusSerializer.h13
-rw-r--r--Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h9
-rw-r--r--Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp8
-rw-r--r--Swiften/Serializer/PayloadSerializers/StorageSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp16
-rw-r--r--Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/SubjectSerializer.h6
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp13
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp6
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/ReplaceSerializerTest.cpp30
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp54
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp29
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp4
-rw-r--r--Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp2
-rw-r--r--Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp16
-rw-r--r--Swiften/Serializer/PayloadSerializers/VCardSerializer.h4
-rw-r--r--Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp6
-rw-r--r--Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h4
-rw-r--r--Swiften/Serializer/PresenceSerializer.cpp4
-rw-r--r--Swiften/Serializer/PresenceSerializer.h11
-rw-r--r--Swiften/Serializer/StanzaAckRequestSerializer.h8
-rw-r--r--Swiften/Serializer/StanzaAckSerializer.h8
-rw-r--r--Swiften/Serializer/StanzaSerializer.cpp15
-rw-r--r--Swiften/Serializer/StanzaSerializer.h11
-rw-r--r--Swiften/Serializer/StartTLSFailureSerializer.h13
-rw-r--r--Swiften/Serializer/StartTLSRequestSerializer.h13
-rw-r--r--Swiften/Serializer/StreamErrorSerializer.cpp2
-rw-r--r--Swiften/Serializer/StreamErrorSerializer.h2
-rw-r--r--Swiften/Serializer/StreamFeaturesSerializer.cpp15
-rw-r--r--Swiften/Serializer/StreamFeaturesSerializer.h11
-rw-r--r--Swiften/Serializer/StreamManagementEnabledSerializer.cpp29
-rw-r--r--Swiften/Serializer/StreamManagementEnabledSerializer.h12
-rw-r--r--Swiften/Serializer/StreamManagementFailedSerializer.h8
-rw-r--r--Swiften/Serializer/StreamResumeSerializer.cpp28
-rw-r--r--Swiften/Serializer/StreamResumeSerializer.h21
-rw-r--r--Swiften/Serializer/StreamResumedSerializer.cpp28
-rw-r--r--Swiften/Serializer/StreamResumedSerializer.h21
-rw-r--r--Swiften/Serializer/TLSProceedSerializer.h13
-rw-r--r--Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp16
-rw-r--r--Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp16
-rw-r--r--Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp16
-rw-r--r--Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp16
-rw-r--r--Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp10
-rw-r--r--Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp14
-rw-r--r--Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp4
-rw-r--r--Swiften/Serializer/XML/XMLElement.cpp6
-rw-r--r--Swiften/Serializer/XML/XMLElement.h2
-rw-r--r--Swiften/Serializer/XML/XMLNode.cpp2
-rw-r--r--Swiften/Serializer/XML/XMLNode.h5
-rw-r--r--Swiften/Serializer/XML/XMLRawTextNode.h7
-rw-r--r--Swiften/Serializer/XML/XMLTextNode.h2
-rw-r--r--Swiften/Serializer/XMPPSerializer.cpp58
-rw-r--r--Swiften/Serializer/XMPPSerializer.h8
149 files changed, 880 insertions, 618 deletions
diff --git a/Swiften/Serializer/AuthChallengeSerializer.cpp b/Swiften/Serializer/AuthChallengeSerializer.cpp
index dcded43..445059d 100644
--- a/Swiften/Serializer/AuthChallengeSerializer.cpp
+++ b/Swiften/Serializer/AuthChallengeSerializer.cpp
@@ -4,26 +4,27 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/AuthChallengeSerializer.h"
+#include <Swiften/Serializer/AuthChallengeSerializer.h>
-#include "Swiften/Elements/AuthChallenge.h"
-#include "Swiften/StringCodecs/Base64.h"
+#include <Swiften/Elements/AuthChallenge.h>
+#include <Swiften/StringCodecs/Base64.h>
+#include <Swiften/Base/ByteArray.h>
namespace Swift {
AuthChallengeSerializer::AuthChallengeSerializer() {
}
-std::string AuthChallengeSerializer::serialize(boost::shared_ptr<Element> element) const {
+SafeString AuthChallengeSerializer::serialize(boost::shared_ptr<Element> element) const {
boost::shared_ptr<AuthChallenge> authChallenge(boost::dynamic_pointer_cast<AuthChallenge>(element));
std::string value;
- boost::optional<ByteArray> message = authChallenge->getValue();
+ boost::optional<std::vector<unsigned char> > message = authChallenge->getValue();
if (message) {
- if ((*message).isEmpty()) {
+ if ((*message).empty()) {
value = "=";
}
else {
- value = Base64::encode(*message);
+ value = Base64::encode(ByteArray(*message));
}
}
return "<challenge xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">" + value + "</challenge>";
diff --git a/Swiften/Serializer/AuthChallengeSerializer.h b/Swiften/Serializer/AuthChallengeSerializer.h
index a62efb3..6254fac 100644
--- a/Swiften/Serializer/AuthChallengeSerializer.h
+++ b/Swiften/Serializer/AuthChallengeSerializer.h
@@ -8,14 +8,14 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/AuthChallenge.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
+#include <Swiften/Elements/AuthChallenge.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class AuthChallengeSerializer : public GenericElementSerializer<AuthChallenge> {
public:
AuthChallengeSerializer();
- virtual std::string serialize(boost::shared_ptr<Element> element) const;
+ virtual SafeString serialize(boost::shared_ptr<Element> element) const;
};
}
diff --git a/Swiften/Serializer/AuthFailureSerializer.h b/Swiften/Serializer/AuthFailureSerializer.h
index 477d98c..5f01f09 100644
--- a/Swiften/Serializer/AuthFailureSerializer.h
+++ b/Swiften/Serializer/AuthFailureSerializer.h
@@ -4,14 +4,13 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_AuthFailureSerializer_H
-#define SWIFTEN_AuthFailureSerializer_H
+#pragma once
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/AuthFailure.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Elements/AuthFailure.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class AuthFailureSerializer : public GenericElementSerializer<AuthFailure> {
@@ -19,10 +18,8 @@ namespace Swift {
AuthFailureSerializer() : GenericElementSerializer<AuthFailure>() {
}
- virtual std::string serialize(boost::shared_ptr<Element>) const {
+ virtual SafeString serialize(boost::shared_ptr<Element>) const {
return XMLElement("failure", "urn:ietf:params:xml:ns:xmpp-sasl").serialize();
}
};
}
-
-#endif
diff --git a/Swiften/Serializer/AuthRequestSerializer.cpp b/Swiften/Serializer/AuthRequestSerializer.cpp
index 0bee302..e38dc85 100644
--- a/Swiften/Serializer/AuthRequestSerializer.cpp
+++ b/Swiften/Serializer/AuthRequestSerializer.cpp
@@ -4,29 +4,32 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/AuthRequestSerializer.h"
+#include <Swiften/Serializer/AuthRequestSerializer.h>
-#include "Swiften/Elements/AuthRequest.h"
-#include "Swiften/StringCodecs/Base64.h"
+#include <Swiften/Elements/AuthRequest.h>
+#include <Swiften/StringCodecs/Base64.h>
+#include <Swiften/Base/SafeByteArray.h>
+#include <Swiften/Base/SafeString.h>
+#include <Swiften/Base/Concat.h>
namespace Swift {
AuthRequestSerializer::AuthRequestSerializer() {
}
-std::string AuthRequestSerializer::serialize(boost::shared_ptr<Element> element) const {
+SafeString AuthRequestSerializer::serialize(boost::shared_ptr<Element> element) const {
boost::shared_ptr<AuthRequest> authRequest(boost::dynamic_pointer_cast<AuthRequest>(element));
- std::string value;
- boost::optional<ByteArray> message = authRequest->getMessage();
+ SafeString value;
+ boost::optional<SafeByteArray> message = authRequest->getMessage();
if (message) {
- if ((*message).isEmpty()) {
+ if ((*message).empty()) {
value = "=";
}
else {
value = Base64::encode(*message);
}
}
- return "<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"" + authRequest->getMechanism() + "\">" + value + "</auth>";
+ return concat(SafeString("<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"" + authRequest->getMechanism() + "\">"), value, SafeString("</auth>"));
}
}
diff --git a/Swiften/Serializer/AuthRequestSerializer.h b/Swiften/Serializer/AuthRequestSerializer.h
index 18ef5dd..0d812d6 100644
--- a/Swiften/Serializer/AuthRequestSerializer.h
+++ b/Swiften/Serializer/AuthRequestSerializer.h
@@ -4,21 +4,18 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_AuthRequestSerializer_H
-#define SWIFTEN_AuthRequestSerializer_H
+#pragma once
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/AuthRequest.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
+#include <Swiften/Elements/AuthRequest.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class AuthRequestSerializer : public GenericElementSerializer<AuthRequest> {
public:
AuthRequestSerializer();
- virtual std::string serialize(boost::shared_ptr<Element> element) const;
+ virtual SafeString serialize(boost::shared_ptr<Element> element) const;
};
}
-
-#endif
diff --git a/Swiften/Serializer/AuthResponseSerializer.cpp b/Swiften/Serializer/AuthResponseSerializer.cpp
index a93b4dd..5b166b7 100644
--- a/Swiften/Serializer/AuthResponseSerializer.cpp
+++ b/Swiften/Serializer/AuthResponseSerializer.cpp
@@ -4,29 +4,32 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/AuthResponseSerializer.h"
+#include <Swiften/Serializer/AuthResponseSerializer.h>
-#include "Swiften/Elements/AuthResponse.h"
-#include "Swiften/StringCodecs/Base64.h"
+#include <Swiften/Elements/AuthResponse.h>
+#include <Swiften/StringCodecs/Base64.h>
+#include <Swiften/Base/SafeByteArray.h>
+#include <Swiften/Base/SafeString.h>
+#include <Swiften/Base/Concat.h>
namespace Swift {
AuthResponseSerializer::AuthResponseSerializer() {
}
-std::string AuthResponseSerializer::serialize(boost::shared_ptr<Element> element) const {
+SafeString AuthResponseSerializer::serialize(boost::shared_ptr<Element> element) const {
boost::shared_ptr<AuthResponse> authResponse(boost::dynamic_pointer_cast<AuthResponse>(element));
- std::string value;
- boost::optional<ByteArray> message = authResponse->getValue();
+ SafeString value;
+ boost::optional<SafeByteArray> message = authResponse->getValue();
if (message) {
- if ((*message).isEmpty()) {
+ if ((*message).empty()) {
value = "=";
}
else {
value = Base64::encode(*message);
}
}
- return "<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">" + value + "</response>";
+ return concat(SafeString("<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"), value, SafeString("</response>"));
}
}
diff --git a/Swiften/Serializer/AuthResponseSerializer.h b/Swiften/Serializer/AuthResponseSerializer.h
index cee8ff3..bb4866f 100644
--- a/Swiften/Serializer/AuthResponseSerializer.h
+++ b/Swiften/Serializer/AuthResponseSerializer.h
@@ -8,14 +8,14 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/AuthResponse.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
+#include <Swiften/Elements/AuthResponse.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class AuthResponseSerializer : public GenericElementSerializer<AuthResponse> {
public:
AuthResponseSerializer();
- virtual std::string serialize(boost::shared_ptr<Element> element) const;
+ virtual SafeString serialize(boost::shared_ptr<Element> element) const;
};
}
diff --git a/Swiften/Serializer/AuthSuccessSerializer.cpp b/Swiften/Serializer/AuthSuccessSerializer.cpp
index 443c740..b7cae47 100644
--- a/Swiften/Serializer/AuthSuccessSerializer.cpp
+++ b/Swiften/Serializer/AuthSuccessSerializer.cpp
@@ -4,26 +4,27 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/AuthSuccessSerializer.h"
+#include <Swiften/Serializer/AuthSuccessSerializer.h>
-#include "Swiften/Elements/AuthSuccess.h"
-#include "Swiften/StringCodecs/Base64.h"
+#include <Swiften/Elements/AuthSuccess.h>
+#include <Swiften/StringCodecs/Base64.h>
+#include <Swiften/Base/ByteArray.h>
namespace Swift {
AuthSuccessSerializer::AuthSuccessSerializer() {
}
-std::string AuthSuccessSerializer::serialize(boost::shared_ptr<Element> element) const {
+SafeString AuthSuccessSerializer::serialize(boost::shared_ptr<Element> element) const {
boost::shared_ptr<AuthSuccess> authSuccess(boost::dynamic_pointer_cast<AuthSuccess>(element));
std::string value;
- boost::optional<ByteArray> message = authSuccess->getValue();
+ boost::optional<std::vector<unsigned char> > message = authSuccess->getValue();
if (message) {
- if ((*message).isEmpty()) {
+ if ((*message).empty()) {
value = "=";
}
else {
- value = Base64::encode(*message);
+ value = Base64::encode(ByteArray(*message));
}
}
return "<success xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">" + value + "</success>";
diff --git a/Swiften/Serializer/AuthSuccessSerializer.h b/Swiften/Serializer/AuthSuccessSerializer.h
index eb3279c..5516c0d 100644
--- a/Swiften/Serializer/AuthSuccessSerializer.h
+++ b/Swiften/Serializer/AuthSuccessSerializer.h
@@ -8,14 +8,14 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/AuthSuccess.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
+#include <Swiften/Elements/AuthSuccess.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class AuthSuccessSerializer : public GenericElementSerializer<AuthSuccess> {
public:
AuthSuccessSerializer();
- virtual std::string serialize(boost::shared_ptr<Element> element) const;
+ virtual SafeString serialize(boost::shared_ptr<Element> element) const;
};
}
diff --git a/Swiften/Serializer/ComponentHandshakeSerializer.cpp b/Swiften/Serializer/ComponentHandshakeSerializer.cpp
index cf44ea4..c60492d 100644
--- a/Swiften/Serializer/ComponentHandshakeSerializer.cpp
+++ b/Swiften/Serializer/ComponentHandshakeSerializer.cpp
@@ -4,16 +4,16 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/ComponentHandshakeSerializer.h"
+#include <Swiften/Serializer/ComponentHandshakeSerializer.h>
-#include "Swiften/Elements/ComponentHandshake.h"
+#include <Swiften/Elements/ComponentHandshake.h>
namespace Swift {
ComponentHandshakeSerializer::ComponentHandshakeSerializer() {
}
-std::string ComponentHandshakeSerializer::serialize(boost::shared_ptr<Element> element) const {
+SafeString ComponentHandshakeSerializer::serialize(boost::shared_ptr<Element> element) const {
boost::shared_ptr<ComponentHandshake> handshake(boost::dynamic_pointer_cast<ComponentHandshake>(element));
return "<handshake>" + handshake->getData() + "</handshake>";
}
diff --git a/Swiften/Serializer/ComponentHandshakeSerializer.h b/Swiften/Serializer/ComponentHandshakeSerializer.h
index 7681e56..2d5970e 100644
--- a/Swiften/Serializer/ComponentHandshakeSerializer.h
+++ b/Swiften/Serializer/ComponentHandshakeSerializer.h
@@ -8,14 +8,14 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/ComponentHandshake.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
+#include <Swiften/Elements/ComponentHandshake.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class ComponentHandshakeSerializer : public GenericElementSerializer<ComponentHandshake> {
public:
ComponentHandshakeSerializer();
- virtual std::string serialize(boost::shared_ptr<Element> element) const;
+ virtual SafeString serialize(boost::shared_ptr<Element> element) const;
};
}
diff --git a/Swiften/Serializer/CompressFailureSerializer.h b/Swiften/Serializer/CompressFailureSerializer.h
index 02a4b46..3446670 100644
--- a/Swiften/Serializer/CompressFailureSerializer.h
+++ b/Swiften/Serializer/CompressFailureSerializer.h
@@ -4,14 +4,13 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_CompressFailureSerializer_H
-#define SWIFTEN_CompressFailureSerializer_H
+#pragma once
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/CompressFailure.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Elements/CompressFailure.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class CompressFailureSerializer : public GenericElementSerializer<CompressFailure> {
@@ -19,10 +18,8 @@ namespace Swift {
CompressFailureSerializer() : GenericElementSerializer<CompressFailure>() {
}
- virtual std::string serialize(boost::shared_ptr<Element>) const {
+ virtual SafeString serialize(boost::shared_ptr<Element>) const {
return XMLElement("failure", "http://jabber.org/protocol/compress").serialize();
}
};
}
-
-#endif
diff --git a/Swiften/Serializer/CompressRequestSerializer.cpp b/Swiften/Serializer/CompressRequestSerializer.cpp
index 7733169..8dc4e50 100644
--- a/Swiften/Serializer/CompressRequestSerializer.cpp
+++ b/Swiften/Serializer/CompressRequestSerializer.cpp
@@ -4,16 +4,16 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/CompressRequestSerializer.h"
+#include <Swiften/Serializer/CompressRequestSerializer.h>
-#include "Swiften/Elements/CompressRequest.h"
+#include <Swiften/Elements/CompressRequest.h>
namespace Swift {
CompressRequestSerializer::CompressRequestSerializer() {
}
-std::string CompressRequestSerializer::serialize(boost::shared_ptr<Element> element) const {
+SafeString CompressRequestSerializer::serialize(boost::shared_ptr<Element> element) const {
boost::shared_ptr<CompressRequest> compressRequest(boost::dynamic_pointer_cast<CompressRequest>(element));
return "<compress xmlns='http://jabber.org/protocol/compress'><method>" + compressRequest->getMethod() + "</method></compress>";
}
diff --git a/Swiften/Serializer/CompressRequestSerializer.h b/Swiften/Serializer/CompressRequestSerializer.h
index 0a14fb1..cd06e1a 100644
--- a/Swiften/Serializer/CompressRequestSerializer.h
+++ b/Swiften/Serializer/CompressRequestSerializer.h
@@ -4,21 +4,18 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_COMPRESSREQUESTSERIALIZER_H
-#define SWIFTEN_COMPRESSREQUESTSERIALIZER_H
+#pragma once
#include <boost/shared_ptr.hpp>
-#include "Swiften/Serializer/ElementSerializer.h"
+#include <Swiften/Serializer/ElementSerializer.h>
namespace Swift {
class CompressRequestSerializer : public ElementSerializer {
public:
CompressRequestSerializer();
- virtual std::string serialize(boost::shared_ptr<Element> element) const;
+ virtual SafeString serialize(boost::shared_ptr<Element> element) const;
virtual bool canSerialize(boost::shared_ptr<Element> element) const;
};
}
-
-#endif
diff --git a/Swiften/Serializer/ElementSerializer.cpp b/Swiften/Serializer/ElementSerializer.cpp
index 6b9fdd5..8cfb294 100644
--- a/Swiften/Serializer/ElementSerializer.cpp
+++ b/Swiften/Serializer/ElementSerializer.cpp
@@ -4,7 +4,7 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/ElementSerializer.h"
+#include <Swiften/Serializer/ElementSerializer.h>
namespace Swift {
diff --git a/Swiften/Serializer/ElementSerializer.h b/Swiften/Serializer/ElementSerializer.h
index 3abdf08..7109f96 100644
--- a/Swiften/Serializer/ElementSerializer.h
+++ b/Swiften/Serializer/ElementSerializer.h
@@ -4,22 +4,19 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_ELEMENTSERIALIZER_H
-#define SWIFTEN_ELEMENTSERIALIZER_H
+#pragma once
#include <boost/shared_ptr.hpp>
-#include <string>
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Base/SafeString.h>
+#include <Swiften/Elements/Element.h>
namespace Swift {
class ElementSerializer {
public:
virtual ~ElementSerializer();
- virtual std::string serialize(boost::shared_ptr<Element> element) const = 0;
+ virtual SafeString serialize(boost::shared_ptr<Element> element) const = 0;
virtual bool canSerialize(boost::shared_ptr<Element> element) const = 0;
};
}
-
-#endif
diff --git a/Swiften/Serializer/EnableStreamManagementSerializer.h b/Swiften/Serializer/EnableStreamManagementSerializer.h
index e224a9c..35df0c1 100644
--- a/Swiften/Serializer/EnableStreamManagementSerializer.h
+++ b/Swiften/Serializer/EnableStreamManagementSerializer.h
@@ -8,9 +8,9 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/EnableStreamManagement.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Elements/EnableStreamManagement.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class EnableStreamManagementSerializer : public GenericElementSerializer<EnableStreamManagement> {
@@ -18,7 +18,7 @@ namespace Swift {
EnableStreamManagementSerializer() : GenericElementSerializer<EnableStreamManagement>() {
}
- virtual std::string serialize(boost::shared_ptr<Element>) const {
+ virtual SafeString serialize(boost::shared_ptr<Element>) const {
return XMLElement("enable", "urn:xmpp:sm:2").serialize();
}
};
diff --git a/Swiften/Serializer/GenericElementSerializer.h b/Swiften/Serializer/GenericElementSerializer.h
index 903c205..c8abdf3 100644
--- a/Swiften/Serializer/GenericElementSerializer.h
+++ b/Swiften/Serializer/GenericElementSerializer.h
@@ -14,7 +14,7 @@ namespace Swift {
template<typename T>
class GenericElementSerializer : public ElementSerializer {
public:
- virtual std::string serialize(boost::shared_ptr<Element> element) const = 0;
+ virtual SafeString serialize(boost::shared_ptr<Element> element) const = 0;
virtual bool canSerialize(boost::shared_ptr<Element> element) const {
return boost::dynamic_pointer_cast<T>(element);
diff --git a/Swiften/Serializer/GenericStanzaSerializer.h b/Swiften/Serializer/GenericStanzaSerializer.h
index 2f0fccf..4129ca8 100644
--- a/Swiften/Serializer/GenericStanzaSerializer.h
+++ b/Swiften/Serializer/GenericStanzaSerializer.h
@@ -4,10 +4,9 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_GENERICSTANZASERIALIZER_H
-#define SWIFTEN_GENERICSTANZASERIALIZER_H
+#pragma once
-#include "Swiften/Serializer/StanzaSerializer.h"
+#include <Swiften/Serializer/StanzaSerializer.h>
namespace Swift {
template<typename STANZA_TYPE>
@@ -31,5 +30,3 @@ namespace Swift {
XMLElement&) const = 0;
};
}
-
-#endif
diff --git a/Swiften/Serializer/IQSerializer.h b/Swiften/Serializer/IQSerializer.h
index 21ec300..76a9cb7 100644
--- a/Swiften/Serializer/IQSerializer.h
+++ b/Swiften/Serializer/IQSerializer.h
@@ -4,14 +4,11 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_IQSerializer_H
-#define SWIFTEN_IQSerializer_H
+#pragma once
-#include <cassert>
-
-#include "Swiften/Serializer/GenericStanzaSerializer.h"
-#include "Swiften/Elements/IQ.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Serializer/GenericStanzaSerializer.h>
+#include <Swiften/Elements/IQ.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class IQSerializer : public GenericStanzaSerializer<IQ> {
@@ -32,5 +29,3 @@ namespace Swift {
}
};
}
-
-#endif
diff --git a/Swiften/Serializer/MessageSerializer.cpp b/Swiften/Serializer/MessageSerializer.cpp
index cea9a1d..c221680 100644
--- a/Swiften/Serializer/MessageSerializer.cpp
+++ b/Swiften/Serializer/MessageSerializer.cpp
@@ -4,8 +4,8 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/MessageSerializer.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Serializer/MessageSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
diff --git a/Swiften/Serializer/MessageSerializer.h b/Swiften/Serializer/MessageSerializer.h
index 873cc5a..8e9e941 100644
--- a/Swiften/Serializer/MessageSerializer.h
+++ b/Swiften/Serializer/MessageSerializer.h
@@ -4,11 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_MessageSerializer_H
-#define SWIFTEN_MessageSerializer_H
+#pragma once
-#include "Swiften/Serializer/GenericStanzaSerializer.h"
-#include "Swiften/Elements/Message.h"
+#include <Swiften/Serializer/GenericStanzaSerializer.h>
+#include <Swiften/Elements/Message.h>
namespace Swift {
class XMLElement;
@@ -23,5 +22,3 @@ namespace Swift {
XMLElement& element) const;
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializer.cpp
index db13ade..be73676 100644
--- a/Swiften/Serializer/PayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializer.cpp
@@ -4,7 +4,7 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializer.h"
+#include <Swiften/Serializer/PayloadSerializer.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializer.h b/Swiften/Serializer/PayloadSerializer.h
index 34e6679..c4ad23b 100644
--- a/Swiften/Serializer/PayloadSerializer.h
+++ b/Swiften/Serializer/PayloadSerializer.h
@@ -4,15 +4,14 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_PAYLOADSERIALIZER_H
-#define SWIFTEN_PAYLOADSERIALIZER_H
-
-#include <boost/shared_ptr.hpp>
+#pragma once
#include <string>
-#include "Swiften/Elements/Payload.h"
+#include <boost/shared_ptr.hpp>
namespace Swift {
+ class Payload;
+
class PayloadSerializer {
public:
virtual ~PayloadSerializer();
@@ -21,5 +20,3 @@ namespace Swift {
virtual std::string serialize(boost::shared_ptr<Payload>) const = 0;
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializerCollection.cpp
index 548dd32..ab2b4f4 100644
--- a/Swiften/Serializer/PayloadSerializerCollection.cpp
+++ b/Swiften/Serializer/PayloadSerializerCollection.cpp
@@ -7,8 +7,8 @@
#include <boost/bind.hpp>
#include <algorithm>
-#include "Swiften/Serializer/PayloadSerializerCollection.h"
-#include "Swiften/Serializer/PayloadSerializer.h"
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
+#include <Swiften/Serializer/PayloadSerializer.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializerCollection.h b/Swiften/Serializer/PayloadSerializerCollection.h
index 1b3cbc5..f922a45 100644
--- a/Swiften/Serializer/PayloadSerializerCollection.h
+++ b/Swiften/Serializer/PayloadSerializerCollection.h
@@ -9,7 +9,7 @@
#include <vector>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class PayloadSerializer;
diff --git a/Swiften/Serializer/PayloadSerializers/BodySerializer.h b/Swiften/Serializer/PayloadSerializers/BodySerializer.h
index 6fc6e6d..99df0f5 100644
--- a/Swiften/Serializer/PayloadSerializers/BodySerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/BodySerializer.h
@@ -4,12 +4,11 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_BodySerializer_H
-#define SWIFTEN_BodySerializer_H
+#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Elements/Body.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Elements/Body.h>
namespace Swift {
class BodySerializer : public GenericPayloadSerializer<Body> {
@@ -22,5 +21,3 @@ namespace Swift {
}
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp
index f9b89f3..beb84dd 100644
--- a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.cpp
@@ -4,14 +4,14 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h>
#include <boost/shared_ptr.hpp>
#include <boost/lexical_cast.hpp>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/PayloadSerializerCollection.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h
index d9b14db..0e58eb0 100644
--- a/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/Bytestreams.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/Bytestreams.h>
namespace Swift {
class PayloadSerializerCollection;
diff --git a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp
index ced0d62..2466958 100644
--- a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.cpp
@@ -4,11 +4,11 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h
index de0a871..2587ee0 100644
--- a/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h
@@ -4,11 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_CapsInfoSerializer_H
-#define SWIFTEN_CapsInfoSerializer_H
+#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/CapsInfo.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/CapsInfo.h>
namespace Swift {
class CapsInfoSerializer : public GenericPayloadSerializer<CapsInfo> {
@@ -18,5 +17,3 @@ namespace Swift {
virtual std::string serializePayload(boost::shared_ptr<CapsInfo>) const;
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp
index 3e877eb..ee468bb 100644
--- a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.cpp
@@ -4,7 +4,7 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h
index a786901..d71873d 100644
--- a/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/ChatState.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/ChatState.h>
namespace Swift {
class ChatStateSerializer : public GenericPayloadSerializer<ChatState> {
diff --git a/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp b/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp
index 0fa45ce..534f4f6 100644
--- a/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/CommandSerializer.cpp
@@ -4,16 +4,16 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/CommandSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/CommandSerializer.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
-#include "Swiften/Serializer/PayloadSerializerCollection.h"
-#include "Swiften/Serializer/PayloadSerializers/FormSerializer.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
+#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
namespace Swift {
@@ -21,7 +21,7 @@ CommandSerializer::CommandSerializer() {
}
std::string CommandSerializer::serializePayload(boost::shared_ptr<Command> command) const {
- XMLElement commandElement("command", "http://jabber.org/protocol/comands");
+ XMLElement commandElement("command", "http://jabber.org/protocol/commands");
commandElement.setAttribute("node", command->getNode());
if (!command->getSessionID().empty()) {
diff --git a/Swiften/Serializer/PayloadSerializers/CommandSerializer.h b/Swiften/Serializer/PayloadSerializers/CommandSerializer.h
index b1db825..0ac8451 100644
--- a/Swiften/Serializer/PayloadSerializers/CommandSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/CommandSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/Command.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/Command.h>
namespace Swift {
class PayloadSerializerCollection;
diff --git a/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp b/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp
index 4922042..4f86faa 100644
--- a/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/DelaySerializer.cpp
@@ -4,12 +4,13 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/DelaySerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/DelaySerializer.h>
#include <boost/shared_ptr.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
#include <Swiften/Base/String.h>
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/DelaySerializer.h b/Swiften/Serializer/PayloadSerializers/DelaySerializer.h
index c37dc02..4705e71 100644
--- a/Swiften/Serializer/PayloadSerializers/DelaySerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/DelaySerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/Delay.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/Delay.h>
namespace Swift {
class DelaySerializer : public GenericPayloadSerializer<Delay> {
diff --git a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp
index 65b0a38..e2c6f59 100644
--- a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.cpp
@@ -4,14 +4,14 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
-#include "Swiften/Serializer/PayloadSerializers/FormSerializer.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h
index 46e7ce2..3e028e1 100644
--- a/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h
@@ -4,11 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_DiscoInfoSerializer_H
-#define SWIFTEN_DiscoInfoSerializer_H
+#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/DiscoInfo.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/DiscoInfo.h>
namespace Swift {
class DiscoInfoSerializer : public GenericPayloadSerializer<DiscoInfo> {
@@ -18,5 +17,3 @@ namespace Swift {
virtual std::string serializePayload(boost::shared_ptr<DiscoInfo>) const;
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp
index cb1b7c1..dd52b70 100644
--- a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.cpp
@@ -4,12 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h
index 3b00a17..a8785c2 100644
--- a/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/DiscoItems.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/DiscoItems.h>
namespace Swift {
class DiscoItemsSerializer : public GenericPayloadSerializer<DiscoItems> {
diff --git a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp
index 15d13d7..e3bfd54 100644
--- a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.cpp
@@ -4,8 +4,8 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/ErrorSerializer.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
+#include <Swiften/Serializer/PayloadSerializers/ErrorSerializer.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h
index 7fc4dad..d06efc8 100644
--- a/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/ErrorSerializer.h
@@ -4,11 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_ErrorSerializer_H
-#define SWIFTEN_ErrorSerializer_H
+#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/ErrorPayload.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/ErrorPayload.h>
namespace Swift {
class ErrorSerializer : public GenericPayloadSerializer<ErrorPayload> {
@@ -18,5 +17,3 @@ namespace Swift {
virtual std::string serializePayload(boost::shared_ptr<ErrorPayload> error) const;
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp
index 53b4241..7a6bb79 100644
--- a/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/FormSerializer.cpp
@@ -4,16 +4,17 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/FormSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
#include <boost/shared_ptr.hpp>
#include <iostream>
#include <string>
-#include "Swiften/Base/String.h"
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
+#include <Swiften/Base/String.h>
+#include <Swiften/Base/Algorithm.h>
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
using namespace Swift;
@@ -129,14 +130,6 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF
fieldType = "text-multi";
multiLineify(boost::dynamic_pointer_cast<TextMultiFormField>(field)->getValue(), "value", fieldElement);
}
- else if (boost::dynamic_pointer_cast<UntypedFormField>(field)) {
- std::vector<std::string> lines = boost::dynamic_pointer_cast<UntypedFormField>(field)->getValue();
- foreach(const std::string& line, lines) {
- boost::shared_ptr<XMLElement> valueElement(new XMLElement("value"));
- valueElement->addNode(XMLTextNode::create(line));
- fieldElement->addNode(valueElement);
- }
- }
else {
assert(false);
}
@@ -162,7 +155,7 @@ boost::shared_ptr<XMLElement> FormSerializer::fieldToXML(boost::shared_ptr<FormF
void FormSerializer::multiLineify(const std::string& text, const std::string& elementName, boost::shared_ptr<XMLElement> element) const {
std::string unRdText(text);
- unRdText.erase(std::remove(unRdText.begin(), unRdText.end(), '\r'), unRdText.end());
+ erase(unRdText, '\r');
std::vector<std::string> lines = String::split(unRdText, '\n');
foreach (std::string line, lines) {
boost::shared_ptr<XMLElement> lineElement(new XMLElement(elementName));
diff --git a/Swiften/Serializer/PayloadSerializers/FormSerializer.h b/Swiften/Serializer/PayloadSerializers/FormSerializer.h
index 86c8dee..43db9e8 100644
--- a/Swiften/Serializer/PayloadSerializers/FormSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/FormSerializer.h
@@ -6,10 +6,10 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/Form.h"
-#include "Swiften/Elements/FormField.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/Form.h>
+#include <Swiften/Elements/FormField.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class FormSerializer : public GenericPayloadSerializer<Form> {
diff --git a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
index 1bbcbf2..14e3b46 100644
--- a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
+++ b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.cpp
@@ -4,42 +4,45 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h"
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/PayloadSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/IBBSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/BodySerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/SubjectSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/PrioritySerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/ErrorSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/RosterSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/StatusSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/VCardSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/StorageSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/DelaySerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/FormSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/CommandSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/NicknameSerializer.h"
-#include "Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h>
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/PayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/IBBSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/BodySerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/SubjectSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/ChatStateSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/PrioritySerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/ErrorSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/RosterSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/StatusSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/DiscoItemsSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/BytestreamsSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/VCardSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/StorageSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/DelaySerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/CommandSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/NicknameSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h>
+#include <Swiften/Serializer/PayloadSerializers/LastSerializer.h>
namespace Swift {
@@ -51,6 +54,7 @@ FullPayloadSerializerCollection::FullPayloadSerializerCollection() {
serializers_.push_back(new PrioritySerializer());
serializers_.push_back(new ErrorSerializer());
serializers_.push_back(new RosterSerializer());
+ serializers_.push_back(new RosterItemExchangeSerializer());
serializers_.push_back(new MUCPayloadSerializer());
serializers_.push_back(new MUCUserPayloadSerializer());
serializers_.push_back(new MUCOwnerPayloadSerializer(this));
@@ -77,6 +81,8 @@ FullPayloadSerializerCollection::FullPayloadSerializerCollection() {
serializers_.push_back(new InBandRegistrationPayloadSerializer());
serializers_.push_back(new NicknameSerializer());
serializers_.push_back(new SearchPayloadSerializer());
+ serializers_.push_back(new ReplaceSerializer());
+ serializers_.push_back(new LastSerializer());
foreach(PayloadSerializer* serializer, serializers_) {
addSerializer(serializer);
}
diff --git a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h
index bf86f27..bfe7d76 100644
--- a/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h
+++ b/Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h
@@ -4,12 +4,11 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_FULLPAYLOADSERIALIZERCOLLECTION_H
-#define SWIFTEN_FULLPAYLOADSERIALIZERCOLLECTION_H
+#pragma once
#include <vector>
-#include "Swiften/Serializer/PayloadSerializerCollection.h"
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
namespace Swift {
class FullPayloadSerializerCollection : public PayloadSerializerCollection {
@@ -21,5 +20,3 @@ namespace Swift {
std::vector<PayloadSerializer*> serializers_;
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
index 7ac4103..13370c5 100644
--- a/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/IBBSerializer.cpp
@@ -4,16 +4,16 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/IBBSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/IBBSerializer.h>
#include <boost/shared_ptr.hpp>
#include <boost/lexical_cast.hpp>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Serializer/PayloadSerializerCollection.h"
-#include "Swiften/StringCodecs/Base64.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
+#include <Swiften/StringCodecs/Base64.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/IBBSerializer.h b/Swiften/Serializer/PayloadSerializers/IBBSerializer.h
index d750f6f..8b026e1 100644
--- a/Swiften/Serializer/PayloadSerializers/IBBSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/IBBSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/IBB.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/IBB.h>
namespace Swift {
class PayloadSerializerCollection;
diff --git a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp
index e4ae11f..12b1bb5 100644
--- a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.cpp
@@ -4,14 +4,14 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
-#include "Swiften/Serializer/PayloadSerializers/FormSerializer.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h
index 45d49ea..008f374 100644
--- a/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h
@@ -7,8 +7,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/InBandRegistrationPayload.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/InBandRegistrationPayload.h>
namespace Swift {
class PayloadSerializerCollection;
diff --git a/Swiften/Serializer/PayloadSerializers/LastSerializer.h b/Swiften/Serializer/PayloadSerializers/LastSerializer.h
new file mode 100644
index 0000000..e91d702
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/LastSerializer.h
@@ -0,0 +1,23 @@
+/*
+ * Copyright (c) 2011 Kevin Smith
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <boost/lexical_cast.hpp>
+
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/Last.h>
+
+namespace Swift {
+ class LastSerializer : public GenericPayloadSerializer<Last> {
+ public:
+ LastSerializer() : GenericPayloadSerializer<Last>() {}
+
+ virtual std::string serializePayload(boost::shared_ptr<Last> last) const {
+ return "<query xmlns='jabber:iq:last' seconds='" + boost::lexical_cast<std::string>(last->getSeconds()) + "'/>";
+ }
+ };
+}
diff --git a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp
index db28514..f86b59e 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.cpp
@@ -4,11 +4,11 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h>
-#include "Swiften/Serializer/PayloadSerializerCollection.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h
index 4808744..5e6913a 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/MUCOwnerPayloadSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/MUCOwnerPayload.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/MUCOwnerPayload.h>
namespace Swift {
class PayloadSerializerCollection;
diff --git a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp
index d7e1613..7080e14 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.cpp
@@ -4,9 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h>
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <boost/lexical_cast.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
+
+#include <Swiften/Serializer/XML/XMLElement.h>
#include <Swiften/Base/String.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h
index 7038e6e..4bf8d22 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/MUCPayloadSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/MUCPayload.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/MUCPayload.h>
namespace Swift {
class MUCPayloadSerializer : public GenericPayloadSerializer<MUCPayload> {
diff --git a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp
index 50746a9..44aa506 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.cpp
@@ -4,15 +4,15 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h>
#include <sstream>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
namespace Swift {
@@ -21,7 +21,7 @@ MUCUserPayloadSerializer::MUCUserPayloadSerializer() : GenericPayloadSerializer<
}
std::string MUCUserPayloadSerializer::serializePayload(boost::shared_ptr<MUCUserPayload> payload) const {
- XMLElement mucElement("x", "http://jabber.org/protocol/muc");
+ XMLElement mucElement("x", "http://jabber.org/protocol/muc#user");
foreach (const MUCUserPayload::StatusCode statusCode, payload->getStatusCodes()) {
boost::shared_ptr<XMLElement> statusElement(new XMLElement("status"));
std::ostringstream code;
diff --git a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h
index 54e6aff..634ce22 100644
--- a/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/MUCUserPayloadSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/MUCUserPayload.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/MUCUserPayload.h>
namespace Swift {
class MUCUserPayloadSerializer : public GenericPayloadSerializer<MUCUserPayload> {
diff --git a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp
index 23d2c25..38a5db5 100644
--- a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.cpp
@@ -4,12 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/NicknameSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/NicknameSerializer.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h
index e07767b..382ec11 100644
--- a/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/NicknameSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/Nickname.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/Nickname.h>
namespace Swift {
class NicknameSerializer : public GenericPayloadSerializer<Nickname> {
diff --git a/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h b/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h
index cc96ce7..5a2ef27 100644
--- a/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PrioritySerializer.h
@@ -4,13 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_PrioritySerializer_H
-#define SWIFTEN_PrioritySerializer_H
+#pragma once
#include <boost/lexical_cast.hpp>
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/Priority.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/Priority.h>
namespace Swift {
class PrioritySerializer : public GenericPayloadSerializer<Priority> {
@@ -22,5 +21,3 @@ namespace Swift {
}
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp
index 6e1d74d..6cb226c 100644
--- a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.cpp
@@ -4,15 +4,15 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
-#include "Swiften/Serializer/PayloadSerializerCollection.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h
index 7b46136..3548cac 100644
--- a/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/PrivateStorageSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/PrivateStorage.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/PrivateStorage.h>
namespace Swift {
class PayloadSerializerCollection;
diff --git a/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h
index 6874569..02a5564 100644
--- a/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/RawXMLPayloadSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/RawXMLPayload.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/RawXMLPayload.h>
namespace Swift {
class RawXMLPayloadSerializer : public GenericPayloadSerializer<RawXMLPayload> {
diff --git a/Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h b/Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h
new file mode 100644
index 0000000..88ad2b3
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2011 Vlad Voicu
+ * Licensed under the Simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Elements/Replace.h>
+
+namespace Swift {
+ class ReplaceSerializer : public GenericPayloadSerializer<Replace> {
+ public:
+ ReplaceSerializer() : GenericPayloadSerializer<Replace>() {}
+
+ virtual std::string serializePayload(boost::shared_ptr<Replace> replace) const {
+ return "<replace id = '" + replace->getID() + "' xmlns='http://swift.im/protocol/replace'/>";
+ }
+ };
+}
diff --git a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp
index cfb3a90..af0c609 100644
--- a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.cpp
@@ -4,12 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h
index d259555..133e45e 100644
--- a/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h
@@ -4,11 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_ResourceBindSerializer_H
-#define SWIFTEN_ResourceBindSerializer_H
+#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/ResourceBind.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/ResourceBind.h>
namespace Swift {
class ResourceBindSerializer : public GenericPayloadSerializer<ResourceBind> {
@@ -18,5 +17,3 @@ namespace Swift {
virtual std::string serializePayload(boost::shared_ptr<ResourceBind>) const;
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp
new file mode 100644
index 0000000..b60db12
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2011 Jan Kaluza
+ * Licensed under the Simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h>
+
+#include <boost/shared_ptr.hpp>
+
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+
+namespace Swift {
+
+RosterItemExchangeSerializer::RosterItemExchangeSerializer() : GenericPayloadSerializer<RosterItemExchangePayload>() {
+}
+
+std::string RosterItemExchangeSerializer::serializePayload(boost::shared_ptr<RosterItemExchangePayload> roster) const {
+ XMLElement queryElement("x", "http://jabber.org/protocol/rosterx");
+ foreach(const RosterItemExchangePayload::Item& item, roster->getItems()) {
+ boost::shared_ptr<XMLElement> itemElement(new XMLElement("item"));
+ itemElement->setAttribute("jid", item.getJID());
+ itemElement->setAttribute("name", item.getName());
+
+ switch (item.getAction()) {
+ case RosterItemExchangePayload::Item::Add: itemElement->setAttribute("action", "add"); break;
+ case RosterItemExchangePayload::Item::Modify: itemElement->setAttribute("action", "modify"); break;
+ case RosterItemExchangePayload::Item::Delete: itemElement->setAttribute("action", "delete"); break;
+ }
+
+ foreach(const std::string& group, item.getGroups()) {
+ boost::shared_ptr<XMLElement> groupElement(new XMLElement("group"));
+ groupElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(group)));
+ itemElement->addNode(groupElement);
+ }
+
+ queryElement.addNode(itemElement);
+ }
+
+ return queryElement.serialize();
+}
+
+}
diff --git a/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h
new file mode 100644
index 0000000..f246f9e
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2011 Jan Kaluza
+ * Licensed under the Simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/RosterItemExchangePayload.h>
+
+namespace Swift {
+ class RosterItemExchangeSerializer : public GenericPayloadSerializer<RosterItemExchangePayload> {
+ public:
+ RosterItemExchangeSerializer();
+
+ virtual std::string serializePayload(boost::shared_ptr<RosterItemExchangePayload>) const;
+ };
+}
diff --git a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp b/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp
index 40faf73..84f36d2 100644
--- a/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/RosterSerializer.cpp
@@ -4,14 +4,14 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/RosterSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/RosterSerializer.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
@@ -20,6 +20,9 @@ RosterSerializer::RosterSerializer() : GenericPayloadSerializer<RosterPayload>()
std::string RosterSerializer::serializePayload(boost::shared_ptr<RosterPayload> roster) const {
XMLElement queryElement("query", "jabber:iq:roster");
+ if (roster->getVersion()) {
+ queryElement.setAttribute("ver", *roster->getVersion());
+ }
foreach(const RosterItemPayload& item, roster->getItems()) {
boost::shared_ptr<XMLElement> itemElement(new XMLElement("item"));
itemElement->setAttribute("jid", item.getJID());
diff --git a/Swiften/Serializer/PayloadSerializers/RosterSerializer.h b/Swiften/Serializer/PayloadSerializers/RosterSerializer.h
index 49e194b..52fdb2a 100644
--- a/Swiften/Serializer/PayloadSerializers/RosterSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/RosterSerializer.h
@@ -4,11 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_RosterSerializer_H
-#define SWIFTEN_RosterSerializer_H
+#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/RosterPayload.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/RosterPayload.h>
namespace Swift {
class RosterSerializer : public GenericPayloadSerializer<RosterPayload> {
@@ -18,5 +17,3 @@ namespace Swift {
virtual std::string serializePayload(boost::shared_ptr<RosterPayload>) const;
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp
index a7a9fda..a5cd634 100644
--- a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.cpp
@@ -4,14 +4,14 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
-#include "Swiften/Serializer/PayloadSerializers/FormSerializer.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h
index 2d8ec85..e4dbff8 100644
--- a/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h
@@ -7,8 +7,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/SearchPayload.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/SearchPayload.h>
namespace Swift {
class PayloadSerializerCollection;
diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp
index b9ec55e..51079ee 100644
--- a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.cpp
@@ -4,11 +4,11 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h"
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h>
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h
index a02aeb9..a1915c7 100644
--- a/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h
@@ -4,11 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_SecurityLabelSerializer_H
-#define SWIFTEN_SecurityLabelSerializer_H
+#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/SecurityLabel.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/SecurityLabel.h>
namespace Swift {
class SecurityLabelSerializer : public GenericPayloadSerializer<SecurityLabel> {
@@ -18,5 +17,3 @@ namespace Swift {
virtual std::string serializePayload(boost::shared_ptr<SecurityLabel> version) const;
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp
index 7424c98..1078292 100644
--- a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.cpp
@@ -4,11 +4,11 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h"
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
-#include "Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h>
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h
index 88a1541..02104df 100644
--- a/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h
@@ -4,11 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_SecurityLabelsCatalogSerializer_H
-#define SWIFTEN_SecurityLabelsCatalogSerializer_H
+#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/SecurityLabelsCatalog.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/SecurityLabelsCatalog.h>
namespace Swift {
class SecurityLabelsCatalogSerializer : public GenericPayloadSerializer<SecurityLabelsCatalog> {
@@ -18,5 +17,3 @@ namespace Swift {
virtual std::string serializePayload(boost::shared_ptr<SecurityLabelsCatalog> version) const;
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp
index b2eb1ed..e117167 100644
--- a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.cpp
@@ -4,7 +4,7 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h
index 72f4afd..98fa243 100644
--- a/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h
@@ -4,11 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_SoftwareVersionSerializer_H
-#define SWIFTEN_SoftwareVersionSerializer_H
+#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/SoftwareVersion.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/SoftwareVersion.h>
namespace Swift {
class SoftwareVersionSerializer : public GenericPayloadSerializer<SoftwareVersion> {
@@ -18,5 +17,3 @@ namespace Swift {
virtual std::string serializePayload(boost::shared_ptr<SoftwareVersion> version) const;
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h b/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h
index dd9ba97..2082f4b 100644
--- a/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/StartSessionSerializer.h
@@ -4,13 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_StartSessionSerializer_H
-#define SWIFTEN_StartSessionSerializer_H
+#pragma once
#include <boost/lexical_cast.hpp>
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/StartSession.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/StartSession.h>
namespace Swift {
class StartSessionSerializer : public GenericPayloadSerializer<StartSession> {
@@ -22,5 +21,3 @@ namespace Swift {
}
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/StatusSerializer.h b/Swiften/Serializer/PayloadSerializers/StatusSerializer.h
index 565d554..a8de26f 100644
--- a/Swiften/Serializer/PayloadSerializers/StatusSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/StatusSerializer.h
@@ -4,13 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_StatusSerializer_H
-#define SWIFTEN_StatusSerializer_H
+#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Elements/Status.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Elements/Status.h>
namespace Swift {
class StatusSerializer : public GenericPayloadSerializer<Status> {
@@ -24,5 +23,3 @@ namespace Swift {
}
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h b/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h
index e797e81..e65c1b6 100644
--- a/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h
@@ -4,11 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_StatusShowSerializer_H
-#define SWIFTEN_StatusShowSerializer_H
+#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/StatusShow.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/StatusShow.h>
namespace Swift {
class StatusShowSerializer : public GenericPayloadSerializer<StatusShow> {
@@ -35,5 +34,3 @@ namespace Swift {
}
};
}
-
-#endif
diff --git a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp
index 049c797..30adf26 100644
--- a/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/StorageSerializer.cpp
@@ -4,13 +4,13 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/StorageSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/StorageSerializer.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/StorageSerializer.h b/Swiften/Serializer/PayloadSerializers/StorageSerializer.h
index bc682a6..6f4f03b 100644
--- a/Swiften/Serializer/PayloadSerializers/StorageSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/StorageSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/Storage.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/Storage.h>
namespace Swift {
class StorageSerializer : public GenericPayloadSerializer<Storage> {
diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp
index 70fb2ac..9a0f37c 100644
--- a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.cpp
@@ -4,17 +4,17 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h>
#include <boost/shared_ptr.hpp>
#include <boost/lexical_cast.hpp>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
-#include "Swiften/Serializer/PayloadSerializerCollection.h"
-#include "Swiften/Serializer/PayloadSerializers/FormSerializer.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
+#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
#define FILE_TRANSFER_NS "http://jabber.org/protocol/si/profile/file-transfer"
@@ -49,7 +49,7 @@ std::string StreamInitiationSerializer::serializePayload(boost::shared_ptr<Strea
siElement.addNode(fileElement);
}
- boost::shared_ptr<XMLElement> featureElement(new XMLElement("feature", "http://jabber.org/protocol/feature-neg"));
+ boost::shared_ptr<XMLElement> featureElement(new XMLElement("feature", FEATURE_NEG_NS));
if (streamInitiation->getProvidedMethods().size() > 0) {
Form::ref form(new Form(Form::FormType));
ListSingleFormField::ref field = ListSingleFormField::create();
diff --git a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h
index 0b51519..f28493b 100644
--- a/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/StreamInitiation.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/StreamInitiation.h>
namespace Swift {
class PayloadSerializerCollection;
diff --git a/Swiften/Serializer/PayloadSerializers/SubjectSerializer.h b/Swiften/Serializer/PayloadSerializers/SubjectSerializer.h
index cf78ddd..fe82499 100644
--- a/Swiften/Serializer/PayloadSerializers/SubjectSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/SubjectSerializer.h
@@ -6,9 +6,9 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Elements/Subject.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Elements/Subject.h>
namespace Swift {
class SubjectSerializer : public GenericPayloadSerializer<Subject> {
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp
index 2604331..270d165 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/CapsInfoSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/CapsInfoSerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp
index 3875efd..32f5f49 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/DiscoInfoSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/DiscoInfoSerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp
index dd06244..27d4ac5 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ErrorSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/ErrorSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/ErrorSerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp
index e4a6661..29e7e59 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/FormSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/FormSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/FormSerializer.h>
using namespace Swift;
@@ -96,13 +96,6 @@ class FormSerializerTest : public CppUnit::TestFixture {
field->setDescription("Tell all your friends about your new bot!");
form->addField(field);
- std::vector<std::string> values2;
- values2.push_back("foo");
- values2.push_back("bar");
- field = UntypedFormField::create(values2);
- field->setName("fum");
- form->addField(field);
-
CPPUNIT_ASSERT_EQUAL(std::string(
"<x type=\"form\" xmlns=\"jabber:x:data\">"
"<field type=\"hidden\" var=\"FORM_TYPE\">"
@@ -139,10 +132,6 @@ class FormSerializerTest : public CppUnit::TestFixture {
"<value>foo@bar.com</value>"
"<value>baz@fum.org</value>"
"</field>"
- "<field var=\"fum\">"
- "<value>foo</value>"
- "<value>bar</value>"
- "</field>"
"</x>"), testling.serialize(form));
}
};
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp
index 7020537..df43e69 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/InBandRegistrationPayloadSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/InBandRegistrationPayloadSerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp
index 481d9c2..9eed97e 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.cpp
@@ -4,11 +4,11 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h>
#include <cppunit/extensions/HelperMacros.h>
-#include "Swiften/Serializer/PayloadSerializer.h"
+#include <Swiften/Serializer/PayloadSerializer.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h
index 038b616..01f07e4 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h
@@ -8,9 +8,9 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
#include <string>
-#include "Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h"
+#include <Swiften/Serializer/PayloadSerializers/FullPayloadSerializerCollection.h>
namespace Swift {
class PayloadsSerializer {
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp
index c976b12..f5b8bee 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PrioritySerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/PrioritySerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/PrioritySerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp
index b0f4084..23d71aa 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/PrivateStorageSerializerTest.cpp
@@ -7,9 +7,9 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h"
-#include "Swiften/Elements/PrivateStorage.h"
-#include "Swiften/Elements/Storage.h"
+#include <Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h>
+#include <Swiften/Elements/PrivateStorage.h>
+#include <Swiften/Elements/Storage.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ReplaceSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ReplaceSerializerTest.cpp
new file mode 100644
index 0000000..3d054cc
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ReplaceSerializerTest.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2011 Vlad Voicu
+ * Licensed under the Simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+#include <Swiften/Serializer/PayloadSerializers/ReplaceSerializer.h>
+
+using namespace Swift;
+
+class ReplaceSerializerTest: public CppUnit::TestFixture {
+ CPPUNIT_TEST_SUITE(ReplaceSerializerTest);
+ CPPUNIT_TEST(testSerialize);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ ReplaceSerializerTest() {}
+
+ void testSerialize() {
+ ReplaceSerializer testling;
+ boost::shared_ptr<Replace> replace(new Replace());
+ replace->setID("bad1");
+ CPPUNIT_ASSERT_EQUAL(std::string("<replace id = 'bad1' xmlns='http://swift.im/protocol/replace'/>"), testling.serialize(replace));
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(ReplaceSerializerTest);
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp
index c7872fe..f8d3d30 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/ResourceBindSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/ResourceBindSerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp
new file mode 100644
index 0000000..b6a90d9
--- /dev/null
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterItemExchangeSerializerTest.cpp
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2011 Jan Kaluza
+ * Licensed under the Simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+#include <Swiften/Serializer/PayloadSerializers/RosterItemExchangeSerializer.h>
+
+using namespace Swift;
+
+class RosterItemExchangeSerializerTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE(RosterItemExchangeSerializerTest);
+ CPPUNIT_TEST(testSerialize);
+ CPPUNIT_TEST_SUITE_END();
+
+ public:
+ RosterItemExchangeSerializerTest() {}
+
+ void testSerialize() {
+ RosterItemExchangeSerializer testling;
+ boost::shared_ptr<RosterItemExchangePayload> roster(new RosterItemExchangePayload());
+
+ RosterItemExchangePayload::Item item1;
+ item1.setJID("foo@bar.com");
+ item1.setName("Foo @ Bar");
+ item1.setAction(RosterItemExchangePayload::Item::Add);
+ item1.addGroup("Group 1");
+ item1.addGroup("Group 2");
+ roster->addItem(item1);
+
+ RosterItemExchangePayload::Item item2;
+ item2.setJID("baz@blo.com");
+ item2.setName("Baz");
+ item2.setAction(RosterItemExchangePayload::Item::Modify);
+ roster->addItem(item2);
+
+ std::string expectedResult =
+ "<x xmlns=\"http://jabber.org/protocol/rosterx\">"
+ "<item action=\"add\" jid=\"foo@bar.com\" name=\"Foo @ Bar\">"
+ "<group>Group 1</group>"
+ "<group>Group 2</group>"
+ "</item>"
+ "<item action=\"modify\" jid=\"baz@blo.com\" name=\"Baz\"/>"
+ "</x>";
+
+ CPPUNIT_ASSERT_EQUAL(expectedResult, testling.serialize(roster));
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(RosterItemExchangeSerializerTest);
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp
index b8ceac3..9ecddc3 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/RosterSerializerTest.cpp
@@ -7,20 +7,19 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/RosterSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/RosterSerializer.h>
using namespace Swift;
-class RosterSerializerTest : public CppUnit::TestFixture
-{
+class RosterSerializerTest : public CppUnit::TestFixture {
CPPUNIT_TEST_SUITE(RosterSerializerTest);
CPPUNIT_TEST(testSerialize);
CPPUNIT_TEST(testSerialize_ItemWithUnknownContent);
+ CPPUNIT_TEST(testSerialize_WithVersion);
+ CPPUNIT_TEST(testSerialize_WithEmptyVersion);
CPPUNIT_TEST_SUITE_END();
public:
- RosterSerializerTest() {}
-
void testSerialize() {
RosterSerializer testling;
boost::shared_ptr<RosterPayload> roster(new RosterPayload());
@@ -77,6 +76,26 @@ class RosterSerializerTest : public CppUnit::TestFixture
CPPUNIT_ASSERT_EQUAL(expectedResult, testling.serialize(roster));
}
+
+ void testSerialize_WithVersion() {
+ RosterSerializer testling;
+ boost::shared_ptr<RosterPayload> roster(new RosterPayload());
+ roster->setVersion("ver20");
+
+ std::string expectedResult = "<query ver=\"ver20\" xmlns=\"jabber:iq:roster\"/>";
+
+ CPPUNIT_ASSERT_EQUAL(expectedResult, testling.serialize(roster));
+ }
+
+ void testSerialize_WithEmptyVersion() {
+ RosterSerializer testling;
+ boost::shared_ptr<RosterPayload> roster(new RosterPayload());
+ roster->setVersion("");
+
+ std::string expectedResult = "<query ver=\"\" xmlns=\"jabber:iq:roster\"/>";
+
+ CPPUNIT_ASSERT_EQUAL(expectedResult, testling.serialize(roster));
+ }
};
CPPUNIT_TEST_SUITE_REGISTRATION(RosterSerializerTest);
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp
index e8328b8..d0dcbef 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/SearchPayloadSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/SearchPayloadSerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp
index 03bad89..0de509d 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/SecurityLabelSerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp
index a7bf1b9..c060e41 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/SecurityLabelsCatalogSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/SecurityLabelsCatalogSerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp
index 6fac094..ad1e9b4 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/SoftwareVersionSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/SoftwareVersionSerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp
index c0b1dc2..af90a0a 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/StatusSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/StatusSerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp
index 2fee152..898c835 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StatusShowSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/StatusShowSerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp
index 01899a9..b963a9c 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StorageSerializerTest.cpp
@@ -7,8 +7,8 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h"
-#include "Swiften/Elements/Storage.h"
+#include <Swiften/Serializer/PayloadSerializers/UnitTest/PayloadsSerializer.h>
+#include <Swiften/Elements/Storage.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp
index d05fdba..7b96298 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/StreamInitiationSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/StreamInitiationSerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp
index 8a9a615..3ac1d77 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/VCardSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/VCardSerializer.h>
using namespace Swift;
@@ -29,7 +29,7 @@ class VCardSerializerTest : public CppUnit::TestFixture
vcard->setFamilyName("Wonderland");
vcard->setSuffix("PhD");
vcard->setNickname("DreamGirl");
- vcard->setPhoto("abcdef");
+ vcard->setPhoto(createByteArray("abcdef"));
vcard->setPhotoType("image/png");
vcard->addUnknownContent("<BDAY>1234</BDAY><MAILER>mutt</MAILER>");
diff --git a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp
index 6f37d61..613b465 100644
--- a/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp
+++ b/Swiften/Serializer/PayloadSerializers/UnitTest/VCardUpdateSerializerTest.cpp
@@ -7,7 +7,7 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h>
using namespace Swift;
diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
index 79e543e..17a6b49 100644
--- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/VCardSerializer.cpp
@@ -4,15 +4,15 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/VCardSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/VCardSerializer.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
-#include "Swiften/StringCodecs/Base64.h"
-#include "Swiften/Base/foreach.h"
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/StringCodecs/Base64.h>
+#include <Swiften/Base/foreach.h>
namespace Swift {
@@ -87,14 +87,14 @@ std::string VCardSerializer::serializePayload(boost::shared_ptr<VCard> vcard) c
nickElement->addNode(boost::shared_ptr<XMLTextNode>(new XMLTextNode(vcard->getNickname())));
queryElement.addNode(nickElement);
}
- if (!vcard->getPhoto().isEmpty() || !vcard->getPhotoType().empty()) {
+ if (!vcard->getPhoto().empty() || !vcard->getPhotoType().empty()) {
XMLElement::ref photoElement(new XMLElement("PHOTO"));
if (!vcard->getPhotoType().empty()) {
XMLElement::ref typeElement(new XMLElement("TYPE"));
typeElement->addNode(XMLTextNode::ref(new XMLTextNode(vcard->getPhotoType())));
photoElement->addNode(typeElement);
}
- if (!vcard->getPhoto().isEmpty()) {
+ if (!vcard->getPhoto().empty()) {
XMLElement::ref binvalElement(new XMLElement("BINVAL"));
binvalElement->addNode(XMLTextNode::ref(new XMLTextNode(Base64::encode(vcard->getPhoto()))));
photoElement->addNode(binvalElement);
diff --git a/Swiften/Serializer/PayloadSerializers/VCardSerializer.h b/Swiften/Serializer/PayloadSerializers/VCardSerializer.h
index 7b9a8a9..c73ff18 100644
--- a/Swiften/Serializer/PayloadSerializers/VCardSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/VCardSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/VCard.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/VCard.h>
namespace Swift {
class VCardSerializer : public GenericPayloadSerializer<VCard> {
diff --git a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp
index e315bc3..c06262f 100644
--- a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp
+++ b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.cpp
@@ -4,12 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h"
+#include <Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
namespace Swift {
diff --git a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h
index 46ca154..68084f0 100644
--- a/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h
+++ b/Swiften/Serializer/PayloadSerializers/VCardUpdateSerializer.h
@@ -6,8 +6,8 @@
#pragma once
-#include "Swiften/Serializer/GenericPayloadSerializer.h"
-#include "Swiften/Elements/VCardUpdate.h"
+#include <Swiften/Serializer/GenericPayloadSerializer.h>
+#include <Swiften/Elements/VCardUpdate.h>
namespace Swift {
class VCardUpdateSerializer : public GenericPayloadSerializer<VCardUpdate> {
diff --git a/Swiften/Serializer/PresenceSerializer.cpp b/Swiften/Serializer/PresenceSerializer.cpp
index 0de6493..ae1f88c 100644
--- a/Swiften/Serializer/PresenceSerializer.cpp
+++ b/Swiften/Serializer/PresenceSerializer.cpp
@@ -4,8 +4,8 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/PresenceSerializer.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Serializer/PresenceSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
#include "boost/shared_ptr.hpp"
diff --git a/Swiften/Serializer/PresenceSerializer.h b/Swiften/Serializer/PresenceSerializer.h
index 3cb9aab..e5d9f30 100644
--- a/Swiften/Serializer/PresenceSerializer.h
+++ b/Swiften/Serializer/PresenceSerializer.h
@@ -4,13 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_PresenceSerializer_H
-#define SWIFTEN_PresenceSerializer_H
+#pragma once
-#include <cassert>
-
-#include "Swiften/Serializer/GenericStanzaSerializer.h"
-#include "Swiften/Elements/Presence.h"
+#include <Swiften/Serializer/GenericStanzaSerializer.h>
+#include <Swiften/Elements/Presence.h>
namespace Swift {
class PresenceSerializer : public GenericStanzaSerializer<Presence> {
@@ -23,5 +20,3 @@ namespace Swift {
XMLElement& element) const;
};
}
-
-#endif
diff --git a/Swiften/Serializer/StanzaAckRequestSerializer.h b/Swiften/Serializer/StanzaAckRequestSerializer.h
index b03a2c2..dbcb27a 100644
--- a/Swiften/Serializer/StanzaAckRequestSerializer.h
+++ b/Swiften/Serializer/StanzaAckRequestSerializer.h
@@ -8,9 +8,9 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/StanzaAckRequest.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Elements/StanzaAckRequest.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class StanzaAckRequestSerializer : public GenericElementSerializer<StanzaAckRequest> {
@@ -18,7 +18,7 @@ namespace Swift {
StanzaAckRequestSerializer() : GenericElementSerializer<StanzaAckRequest>() {
}
- virtual std::string serialize(boost::shared_ptr<Element>) const {
+ virtual SafeString serialize(boost::shared_ptr<Element>) const {
return XMLElement("r", "urn:xmpp:sm:2").serialize();
}
};
diff --git a/Swiften/Serializer/StanzaAckSerializer.h b/Swiften/Serializer/StanzaAckSerializer.h
index 984509f..91bbb8d 100644
--- a/Swiften/Serializer/StanzaAckSerializer.h
+++ b/Swiften/Serializer/StanzaAckSerializer.h
@@ -9,9 +9,9 @@
#include <boost/shared_ptr.hpp>
#include <boost/lexical_cast.hpp>
-#include "Swiften/Elements/StanzaAck.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Elements/StanzaAck.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class StanzaAckSerializer : public GenericElementSerializer<StanzaAck> {
@@ -19,7 +19,7 @@ namespace Swift {
StanzaAckSerializer() : GenericElementSerializer<StanzaAck>() {
}
- virtual std::string serialize(boost::shared_ptr<Element> element) const {
+ virtual SafeString serialize(boost::shared_ptr<Element> element) const {
StanzaAck::ref stanzaAck(boost::dynamic_pointer_cast<StanzaAck>(element));
assert(stanzaAck->isValid());
XMLElement result("a", "urn:xmpp:sm:2");
diff --git a/Swiften/Serializer/StanzaSerializer.cpp b/Swiften/Serializer/StanzaSerializer.cpp
index cfc9a43..c34ecae 100644
--- a/Swiften/Serializer/StanzaSerializer.cpp
+++ b/Swiften/Serializer/StanzaSerializer.cpp
@@ -4,24 +4,25 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/StanzaSerializer.h"
+#include <Swiften/Serializer/StanzaSerializer.h>
#include <sstream>
#include <typeinfo>
#include <iostream>
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLRawTextNode.h"
-#include "Swiften/Serializer/PayloadSerializer.h"
-#include "Swiften/Serializer/PayloadSerializerCollection.h"
-#include "Swiften/Elements/Stanza.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLRawTextNode.h>
+#include <Swiften/Serializer/PayloadSerializer.h>
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
+#include <Swiften/Elements/Stanza.h>
namespace Swift {
StanzaSerializer::StanzaSerializer(const std::string& tag, PayloadSerializerCollection* payloadSerializers) : tag_(tag), payloadSerializers_(payloadSerializers) {
}
-std::string StanzaSerializer::serialize(boost::shared_ptr<Element> element) const {
+SafeString StanzaSerializer::serialize(boost::shared_ptr<Element> element) const {
boost::shared_ptr<Stanza> stanza(boost::dynamic_pointer_cast<Stanza>(element));
XMLElement stanzaElement(tag_);
diff --git a/Swiften/Serializer/StanzaSerializer.h b/Swiften/Serializer/StanzaSerializer.h
index 505d320..5726562 100644
--- a/Swiften/Serializer/StanzaSerializer.h
+++ b/Swiften/Serializer/StanzaSerializer.h
@@ -4,11 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_STANZASERIALIZER_H
-#define SWIFTEN_STANZASERIALIZER_H
+#pragma once
-#include "Swiften/Elements/Stanza.h"
-#include "Swiften/Serializer/ElementSerializer.h"
+#include <Swiften/Elements/Stanza.h>
+#include <Swiften/Serializer/ElementSerializer.h>
#include <string>
namespace Swift {
@@ -19,7 +18,7 @@ namespace Swift {
public:
StanzaSerializer(const std::string& tag, PayloadSerializerCollection* payloadSerializers);
- virtual std::string serialize(boost::shared_ptr<Element>) const;
+ virtual SafeString serialize(boost::shared_ptr<Element>) const;
virtual void setStanzaSpecificAttributes(boost::shared_ptr<Element>, XMLElement&) const = 0;
private:
@@ -27,5 +26,3 @@ namespace Swift {
PayloadSerializerCollection* payloadSerializers_;
};
}
-
-#endif
diff --git a/Swiften/Serializer/StartTLSFailureSerializer.h b/Swiften/Serializer/StartTLSFailureSerializer.h
index 548a24c..6f3f24c 100644
--- a/Swiften/Serializer/StartTLSFailureSerializer.h
+++ b/Swiften/Serializer/StartTLSFailureSerializer.h
@@ -4,14 +4,13 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_StartTLSFailureSerializer_H
-#define SWIFTEN_StartTLSFailureSerializer_H
+#pragma once
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/StartTLSFailure.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Elements/StartTLSFailure.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class StartTLSFailureSerializer : public GenericElementSerializer<StartTLSFailure> {
@@ -19,10 +18,8 @@ namespace Swift {
StartTLSFailureSerializer() : GenericElementSerializer<StartTLSFailure>() {
}
- virtual std::string serialize(boost::shared_ptr<Element>) const {
+ virtual SafeString serialize(boost::shared_ptr<Element>) const {
return XMLElement("failure", "urn:ietf:params:xml:ns:xmpp-tls").serialize();
}
};
}
-
-#endif
diff --git a/Swiften/Serializer/StartTLSRequestSerializer.h b/Swiften/Serializer/StartTLSRequestSerializer.h
index 2e9ecfa..d5fa046 100644
--- a/Swiften/Serializer/StartTLSRequestSerializer.h
+++ b/Swiften/Serializer/StartTLSRequestSerializer.h
@@ -4,14 +4,13 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_StartTLSRequestSerializer_H
-#define SWIFTEN_StartTLSRequestSerializer_H
+#pragma once
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/StartTLSRequest.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Elements/StartTLSRequest.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class StartTLSRequestSerializer : public GenericElementSerializer<StartTLSRequest> {
@@ -19,10 +18,8 @@ namespace Swift {
StartTLSRequestSerializer() : GenericElementSerializer<StartTLSRequest>() {
}
- virtual std::string serialize(boost::shared_ptr<Element>) const {
+ virtual SafeString serialize(boost::shared_ptr<Element>) const {
return XMLElement("starttls", "urn:ietf:params:xml:ns:xmpp-tls").serialize();
}
};
}
-
-#endif
diff --git a/Swiften/Serializer/StreamErrorSerializer.cpp b/Swiften/Serializer/StreamErrorSerializer.cpp
index 11f8a30..e95ee37 100644
--- a/Swiften/Serializer/StreamErrorSerializer.cpp
+++ b/Swiften/Serializer/StreamErrorSerializer.cpp
@@ -15,7 +15,7 @@ namespace Swift {
StreamErrorSerializer::StreamErrorSerializer() : GenericElementSerializer<StreamError>() {
}
-std::string StreamErrorSerializer::serialize(boost::shared_ptr<Element> element) const {
+SafeString StreamErrorSerializer::serialize(boost::shared_ptr<Element> element) const {
StreamError::ref error = boost::dynamic_pointer_cast<StreamError>(element);
XMLElement errorElement("error", "http://etherx.jabber.org/streams");
diff --git a/Swiften/Serializer/StreamErrorSerializer.h b/Swiften/Serializer/StreamErrorSerializer.h
index 9d4f60c..2115324 100644
--- a/Swiften/Serializer/StreamErrorSerializer.h
+++ b/Swiften/Serializer/StreamErrorSerializer.h
@@ -14,6 +14,6 @@ namespace Swift {
public:
StreamErrorSerializer();
- virtual std::string serialize(boost::shared_ptr<Element> error) const;
+ virtual SafeString serialize(boost::shared_ptr<Element> error) const;
};
}
diff --git a/Swiften/Serializer/StreamFeaturesSerializer.cpp b/Swiften/Serializer/StreamFeaturesSerializer.cpp
index 915433c..3c500e3 100644
--- a/Swiften/Serializer/StreamFeaturesSerializer.cpp
+++ b/Swiften/Serializer/StreamFeaturesSerializer.cpp
@@ -4,18 +4,20 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/StreamFeaturesSerializer.h"
+#include <Swiften/Serializer/StreamFeaturesSerializer.h>
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
-#include "Swiften/Base/foreach.h"
+#include <boost/smart_ptr/make_shared.hpp>
+
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
+#include <Swiften/Base/foreach.h>
namespace Swift {
StreamFeaturesSerializer::StreamFeaturesSerializer() {
}
-std::string StreamFeaturesSerializer::serialize(boost::shared_ptr<Element> element) const {
+SafeString StreamFeaturesSerializer::serialize(boost::shared_ptr<Element> element) const {
boost::shared_ptr<StreamFeatures> streamFeatures(boost::dynamic_pointer_cast<StreamFeatures>(element));
XMLElement streamFeaturesElement("stream:features");
@@ -49,6 +51,9 @@ std::string StreamFeaturesSerializer::serialize(boost::shared_ptr<Element> eleme
if (streamFeatures->hasStreamManagement()) {
streamFeaturesElement.addNode(boost::shared_ptr<XMLElement>(new XMLElement("sm", "urn:xmpp:sm:2")));
}
+ if (streamFeatures->hasRosterVersioning()) {
+ streamFeaturesElement.addNode(boost::make_shared<XMLElement>("ver", "urn:xmpp:features:rosterver"));
+ }
return streamFeaturesElement.serialize();
}
diff --git a/Swiften/Serializer/StreamFeaturesSerializer.h b/Swiften/Serializer/StreamFeaturesSerializer.h
index 3b475e0..0e8a6d2 100644
--- a/Swiften/Serializer/StreamFeaturesSerializer.h
+++ b/Swiften/Serializer/StreamFeaturesSerializer.h
@@ -4,21 +4,18 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_StreamFeaturesSerializer_H
-#define SWIFTEN_StreamFeaturesSerializer_H
+#pragma once
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/StreamFeatures.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
+#include <Swiften/Elements/StreamFeatures.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class StreamFeaturesSerializer : public GenericElementSerializer<StreamFeatures> {
public:
StreamFeaturesSerializer();
- virtual std::string serialize(boost::shared_ptr<Element> element) const;
+ virtual SafeString serialize(boost::shared_ptr<Element> element) const;
};
}
-
-#endif
diff --git a/Swiften/Serializer/StreamManagementEnabledSerializer.cpp b/Swiften/Serializer/StreamManagementEnabledSerializer.cpp
new file mode 100644
index 0000000..c19b86f
--- /dev/null
+++ b/Swiften/Serializer/StreamManagementEnabledSerializer.cpp
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Serializer/StreamManagementEnabledSerializer.h>
+
+#include <boost/shared_ptr.hpp>
+
+#include <Swiften/Elements/StreamManagementEnabled.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+
+using namespace Swift;
+
+StreamManagementEnabledSerializer::StreamManagementEnabledSerializer() : GenericElementSerializer<StreamManagementEnabled>() {
+}
+
+SafeString StreamManagementEnabledSerializer::serialize(boost::shared_ptr<Element> el) const {
+ boost::shared_ptr<StreamManagementEnabled> e(boost::dynamic_pointer_cast<StreamManagementEnabled>(el));
+ XMLElement element("enabled", "urn:xmpp:sm:2");
+ if (!e->getResumeID().empty()) {
+ element.setAttribute("id", e->getResumeID());
+ }
+ if (e->getResumeSupported()) {
+ element.setAttribute("resume", "true");
+ }
+ return element.serialize();
+}
diff --git a/Swiften/Serializer/StreamManagementEnabledSerializer.h b/Swiften/Serializer/StreamManagementEnabledSerializer.h
index fc7bd86..0ea976a 100644
--- a/Swiften/Serializer/StreamManagementEnabledSerializer.h
+++ b/Swiften/Serializer/StreamManagementEnabledSerializer.h
@@ -8,18 +8,14 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/StreamManagementEnabled.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Elements/StreamManagementEnabled.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
namespace Swift {
class StreamManagementEnabledSerializer : public GenericElementSerializer<StreamManagementEnabled> {
public:
- StreamManagementEnabledSerializer() : GenericElementSerializer<StreamManagementEnabled>() {
- }
+ StreamManagementEnabledSerializer();
- virtual std::string serialize(boost::shared_ptr<Element>) const {
- return XMLElement("enabled", "urn:xmpp:sm:2").serialize();
- }
+ virtual SafeString serialize(boost::shared_ptr<Element>) const;
};
}
diff --git a/Swiften/Serializer/StreamManagementFailedSerializer.h b/Swiften/Serializer/StreamManagementFailedSerializer.h
index b22ed0d..034366e 100644
--- a/Swiften/Serializer/StreamManagementFailedSerializer.h
+++ b/Swiften/Serializer/StreamManagementFailedSerializer.h
@@ -8,9 +8,9 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/StreamManagementFailed.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Elements/StreamManagementFailed.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class StreamManagementFailedSerializer : public GenericElementSerializer<StreamManagementFailed> {
@@ -18,7 +18,7 @@ namespace Swift {
StreamManagementFailedSerializer() : GenericElementSerializer<StreamManagementFailed>() {
}
- virtual std::string serialize(boost::shared_ptr<Element>) const {
+ virtual SafeString serialize(boost::shared_ptr<Element>) const {
return XMLElement("failed", "urn:xmpp:sm:2").serialize();
}
};
diff --git a/Swiften/Serializer/StreamResumeSerializer.cpp b/Swiften/Serializer/StreamResumeSerializer.cpp
new file mode 100644
index 0000000..01877a9
--- /dev/null
+++ b/Swiften/Serializer/StreamResumeSerializer.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Serializer/StreamResumeSerializer.h>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/lexical_cast.hpp>
+
+#include <Swiften/Elements/StreamResume.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+
+using namespace Swift;
+
+StreamResumeSerializer::StreamResumeSerializer() : GenericElementSerializer<StreamResume>() {
+}
+
+SafeString StreamResumeSerializer::serialize(boost::shared_ptr<Element> el) const {
+ boost::shared_ptr<StreamResume> e(boost::dynamic_pointer_cast<StreamResume>(el));
+ XMLElement element("resume", "urn:xmpp:sm:2");
+ element.setAttribute("previd", e->getResumeID());
+ if (e->getHandledStanzasCount()) {
+ element.setAttribute("h", boost::lexical_cast<std::string>(e->getHandledStanzasCount()));
+ }
+ return element.serialize();
+}
diff --git a/Swiften/Serializer/StreamResumeSerializer.h b/Swiften/Serializer/StreamResumeSerializer.h
new file mode 100644
index 0000000..965485f
--- /dev/null
+++ b/Swiften/Serializer/StreamResumeSerializer.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2011 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+#include <Swiften/Elements/StreamResume.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
+
+namespace Swift {
+ class StreamResumeSerializer : public GenericElementSerializer<StreamResume> {
+ public:
+ StreamResumeSerializer();
+
+ virtual SafeString serialize(boost::shared_ptr<Element>) const;
+ };
+}
diff --git a/Swiften/Serializer/StreamResumedSerializer.cpp b/Swiften/Serializer/StreamResumedSerializer.cpp
new file mode 100644
index 0000000..06006b8
--- /dev/null
+++ b/Swiften/Serializer/StreamResumedSerializer.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Serializer/StreamResumedSerializer.h>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/lexical_cast.hpp>
+
+#include <Swiften/Elements/StreamResumed.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
+
+using namespace Swift;
+
+StreamResumedSerializer::StreamResumedSerializer() : GenericElementSerializer<StreamResumed>() {
+}
+
+SafeString StreamResumedSerializer::serialize(boost::shared_ptr<Element> el) const {
+ boost::shared_ptr<StreamResumed> e(boost::dynamic_pointer_cast<StreamResumed>(el));
+ XMLElement element("resumed", "urn:xmpp:sm:2");
+ element.setAttribute("previd", e->getResumeID());
+ if (e->getHandledStanzasCount()) {
+ element.setAttribute("h", boost::lexical_cast<std::string>(e->getHandledStanzasCount()));
+ }
+ return element.serialize();
+}
diff --git a/Swiften/Serializer/StreamResumedSerializer.h b/Swiften/Serializer/StreamResumedSerializer.h
new file mode 100644
index 0000000..24d5f86
--- /dev/null
+++ b/Swiften/Serializer/StreamResumedSerializer.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2011 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+
+#include <Swiften/Elements/StreamResumed.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
+
+namespace Swift {
+ class StreamResumedSerializer : public GenericElementSerializer<StreamResumed> {
+ public:
+ StreamResumedSerializer();
+
+ virtual SafeString serialize(boost::shared_ptr<Element>) const;
+ };
+}
diff --git a/Swiften/Serializer/TLSProceedSerializer.h b/Swiften/Serializer/TLSProceedSerializer.h
index 1b08c23..95ee211 100644
--- a/Swiften/Serializer/TLSProceedSerializer.h
+++ b/Swiften/Serializer/TLSProceedSerializer.h
@@ -4,14 +4,13 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_TLSProceedSerializer_H
-#define SWIFTEN_TLSProceedSerializer_H
+#pragma once
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/TLSProceed.h"
-#include "Swiften/Serializer/GenericElementSerializer.h"
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Elements/TLSProceed.h>
+#include <Swiften/Serializer/GenericElementSerializer.h>
+#include <Swiften/Serializer/XML/XMLElement.h>
namespace Swift {
class TLSProceedSerializer : public GenericElementSerializer<TLSProceed> {
@@ -19,10 +18,8 @@ namespace Swift {
TLSProceedSerializer() : GenericElementSerializer<TLSProceed>() {
}
- virtual std::string serialize(boost::shared_ptr<Element>) const {
+ virtual SafeString serialize(boost::shared_ptr<Element>) const {
return XMLElement("proceed", "urn:ietf:params:xml:ns:xmpp-tls").serialize();
}
};
}
-
-#endif
diff --git a/Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp b/Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp
index af857ef..3dd922e 100644
--- a/Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp
+++ b/Swiften/Serializer/UnitTest/AuthChallengeSerializerTest.cpp
@@ -3,12 +3,14 @@
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
+#include <QA/Checker/IO.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/AuthChallengeSerializer.h"
-#include "Swiften/Elements/AuthChallenge.h"
+#include <Swiften/Serializer/AuthChallengeSerializer.h>
+#include <Swiften/Elements/AuthChallenge.h>
+#include <Swiften/Base/ByteArray.h>
using namespace Swift;
@@ -23,9 +25,9 @@ class AuthChallengeSerializerTest : public CppUnit::TestFixture {
void testSerialize() {
AuthChallengeSerializer testling;
boost::shared_ptr<AuthChallenge> authChallenge(new AuthChallenge());
- authChallenge->setValue("foo");
+ authChallenge->setValue(createByteArray("foo"));
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<challenge xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"Zm9v"
"</challenge>"), testling.serialize(authChallenge));
@@ -35,7 +37,7 @@ class AuthChallengeSerializerTest : public CppUnit::TestFixture {
AuthChallengeSerializer testling;
boost::shared_ptr<AuthChallenge> authChallenge(new AuthChallenge());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<challenge xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"</challenge>"), testling.serialize(authChallenge));
}
@@ -43,9 +45,9 @@ class AuthChallengeSerializerTest : public CppUnit::TestFixture {
void testSerialize_EmptyMessage() {
AuthChallengeSerializer testling;
boost::shared_ptr<AuthChallenge> authChallenge(new AuthChallenge());
- authChallenge->setValue(ByteArray());
+ authChallenge->setValue(std::vector<unsigned char>());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<challenge xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"="
"</challenge>"), testling.serialize(authChallenge));
diff --git a/Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp b/Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp
index 9f9f2fa..4d4cf50 100644
--- a/Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp
+++ b/Swiften/Serializer/UnitTest/AuthRequestSerializerTest.cpp
@@ -3,12 +3,14 @@
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
+#include <QA/Checker/IO.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/AuthRequestSerializer.h"
-#include "Swiften/Elements/AuthRequest.h"
+#include <Swiften/Serializer/AuthRequestSerializer.h>
+#include <Swiften/Elements/AuthRequest.h>
+#include <Swiften/Base/ByteArray.h>
using namespace Swift;
@@ -23,9 +25,9 @@ class AuthRequestSerializerTest : public CppUnit::TestFixture {
void testSerialize() {
AuthRequestSerializer testling;
boost::shared_ptr<AuthRequest> authRequest(new AuthRequest("PLAIN"));
- authRequest->setMessage("foo");
+ authRequest->setMessage(createSafeByteArray("foo"));
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"PLAIN\">"
"Zm9v"
"</auth>"), testling.serialize(authRequest));
@@ -35,7 +37,7 @@ class AuthRequestSerializerTest : public CppUnit::TestFixture {
AuthRequestSerializer testling;
boost::shared_ptr<AuthRequest> authRequest(new AuthRequest("PLAIN"));
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"PLAIN\">"
"</auth>"), testling.serialize(authRequest));
}
@@ -43,9 +45,9 @@ class AuthRequestSerializerTest : public CppUnit::TestFixture {
void testSerialize_EmptyMessage() {
AuthRequestSerializer testling;
boost::shared_ptr<AuthRequest> authRequest(new AuthRequest("PLAIN"));
- authRequest->setMessage(ByteArray());
+ authRequest->setMessage(SafeByteArray());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<auth xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\" mechanism=\"PLAIN\">"
"="
"</auth>"), testling.serialize(authRequest));
diff --git a/Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp b/Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp
index c93810c..6804559 100644
--- a/Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp
+++ b/Swiften/Serializer/UnitTest/AuthResponseSerializerTest.cpp
@@ -3,12 +3,14 @@
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
+#include <QA/Checker/IO.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/AuthResponseSerializer.h"
-#include "Swiften/Elements/AuthResponse.h"
+#include <Swiften/Serializer/AuthResponseSerializer.h>
+#include <Swiften/Elements/AuthResponse.h>
+#include <Swiften/Base/ByteArray.h>
using namespace Swift;
@@ -23,9 +25,9 @@ class AuthResponseSerializerTest : public CppUnit::TestFixture {
void testSerialize() {
AuthResponseSerializer testling;
boost::shared_ptr<AuthResponse> authResponse(new AuthResponse());
- authResponse->setValue("foo");
+ authResponse->setValue(createSafeByteArray("foo"));
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"Zm9v"
"</response>"), testling.serialize(authResponse));
@@ -35,7 +37,7 @@ class AuthResponseSerializerTest : public CppUnit::TestFixture {
AuthResponseSerializer testling;
boost::shared_ptr<AuthResponse> authResponse(new AuthResponse());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"</response>"), testling.serialize(authResponse));
}
@@ -43,9 +45,9 @@ class AuthResponseSerializerTest : public CppUnit::TestFixture {
void testSerialize_EmptyMessage() {
AuthResponseSerializer testling;
boost::shared_ptr<AuthResponse> authResponse(new AuthResponse());
- authResponse->setValue(ByteArray());
+ authResponse->setValue(SafeByteArray());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<response xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"="
"</response>"), testling.serialize(authResponse));
diff --git a/Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp b/Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp
index 385c1e5..0d9f103 100644
--- a/Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp
+++ b/Swiften/Serializer/UnitTest/AuthSuccessSerializerTest.cpp
@@ -3,12 +3,14 @@
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
+#include <QA/Checker/IO.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/AuthSuccessSerializer.h"
-#include "Swiften/Elements/AuthSuccess.h"
+#include <Swiften/Serializer/AuthSuccessSerializer.h>
+#include <Swiften/Elements/AuthSuccess.h>
+#include <Swiften/Base/ByteArray.h>
using namespace Swift;
@@ -23,9 +25,9 @@ class AuthSuccessSerializerTest : public CppUnit::TestFixture {
void testSerialize() {
AuthSuccessSerializer testling;
boost::shared_ptr<AuthSuccess> authSuccess(new AuthSuccess());
- authSuccess->setValue("foo");
+ authSuccess->setValue(createByteArray("foo"));
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<success xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"Zm9v"
"</success>"), testling.serialize(authSuccess));
@@ -35,7 +37,7 @@ class AuthSuccessSerializerTest : public CppUnit::TestFixture {
AuthSuccessSerializer testling;
boost::shared_ptr<AuthSuccess> authSuccess(new AuthSuccess());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<success xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"</success>"), testling.serialize(authSuccess));
}
@@ -43,9 +45,9 @@ class AuthSuccessSerializerTest : public CppUnit::TestFixture {
void testSerialize_EmptyMessage() {
AuthSuccessSerializer testling;
boost::shared_ptr<AuthSuccess> authSuccess(new AuthSuccess());
- authSuccess->setValue(ByteArray());
+ authSuccess->setValue(std::vector<unsigned char>());
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<success xmlns=\"urn:ietf:params:xml:ns:xmpp-sasl\">"
"="
"</success>"), testling.serialize(authSuccess));
diff --git a/Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp b/Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp
index 65caa81..c4826c2 100644
--- a/Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp
+++ b/Swiften/Serializer/UnitTest/StreamFeaturesSerializerTest.cpp
@@ -3,12 +3,14 @@
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
+#include <QA/Checker/IO.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/StreamFeaturesSerializer.h"
-#include "Swiften/Elements/StreamFeatures.h"
+#include <Swiften/Serializer/StreamFeaturesSerializer.h>
+#include <Swiften/Elements/StreamFeatures.h>
+
using namespace Swift;
@@ -32,8 +34,9 @@ class StreamFeaturesSerializerTest : public CppUnit::TestFixture
streamFeatures->setHasResourceBind();
streamFeatures->setHasSession();
streamFeatures->setHasStreamManagement();
+ streamFeatures->setHasRosterVersioning();
- CPPUNIT_ASSERT_EQUAL(std::string(
+ CPPUNIT_ASSERT_EQUAL(SafeString(
"<stream:features>"
"<starttls xmlns=\"urn:ietf:params:xml:ns:xmpp-tls\"/>"
"<compression xmlns=\"http://jabber.org/features/compress\">"
@@ -47,6 +50,7 @@ class StreamFeaturesSerializerTest : public CppUnit::TestFixture
"<bind xmlns=\"urn:ietf:params:xml:ns:xmpp-bind\"/>"
"<session xmlns=\"urn:ietf:params:xml:ns:xmpp-session\"/>"
"<sm xmlns=\"urn:xmpp:sm:2\"/>"
+ "<ver xmlns=\"urn:xmpp:features:rosterver\"/>"
"</stream:features>"), testling.serialize(streamFeatures));
}
};
diff --git a/Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp b/Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp
index 76c1b23..c0ab841 100644
--- a/Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp
+++ b/Swiften/Serializer/UnitTest/XMPPSerializerTest.cpp
@@ -7,10 +7,10 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/XMPPSerializer.h"
-#include "Swiften/Elements/AuthChallenge.h"
-#include "Swiften/Serializer/PayloadSerializerCollection.h"
-#include "Swiften/Elements/ProtocolHeader.h"
+#include <Swiften/Serializer/XMPPSerializer.h>
+#include <Swiften/Elements/AuthChallenge.h>
+#include <Swiften/Serializer/PayloadSerializerCollection.h>
+#include <Swiften/Elements/ProtocolHeader.h>
using namespace Swift;
@@ -31,7 +31,7 @@ class XMPPSerializerTest : public CppUnit::TestFixture {
}
void testSerializeHeader_Client() {
- std::auto_ptr<XMPPSerializer> testling(createSerializer(ClientStreamType));
+ boost::shared_ptr<XMPPSerializer> testling(createSerializer(ClientStreamType));
ProtocolHeader protocolHeader;
protocolHeader.setFrom("bla@foo.com");
protocolHeader.setTo("foo.com");
@@ -42,7 +42,7 @@ class XMPPSerializerTest : public CppUnit::TestFixture {
}
void testSerializeHeader_Component() {
- std::auto_ptr<XMPPSerializer> testling(createSerializer(ComponentStreamType));
+ boost::shared_ptr<XMPPSerializer> testling(createSerializer(ComponentStreamType));
ProtocolHeader protocolHeader;
protocolHeader.setFrom("bla@foo.com");
protocolHeader.setTo("foo.com");
@@ -53,7 +53,7 @@ class XMPPSerializerTest : public CppUnit::TestFixture {
}
void testSerializeHeader_Server() {
- std::auto_ptr<XMPPSerializer> testling(createSerializer(ServerStreamType));
+ boost::shared_ptr<XMPPSerializer> testling(createSerializer(ServerStreamType));
ProtocolHeader protocolHeader;
protocolHeader.setFrom("bla@foo.com");
protocolHeader.setTo("foo.com");
diff --git a/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp b/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp
index 8c68f97..897a4f4 100644
--- a/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp
+++ b/Swiften/Serializer/XML/UnitTest/XMLElementTest.cpp
@@ -7,8 +7,8 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
-#include "Swiften/Serializer/XML/XMLElement.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
+#include <Swiften/Serializer/XML/XMLElement.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
using namespace Swift;
diff --git a/Swiften/Serializer/XML/XMLElement.cpp b/Swiften/Serializer/XML/XMLElement.cpp
index 6c90e0d..be90406 100644
--- a/Swiften/Serializer/XML/XMLElement.cpp
+++ b/Swiften/Serializer/XML/XMLElement.cpp
@@ -4,10 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/XML/XMLElement.h"
+#include <Swiften/Serializer/XML/XMLElement.h>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/Serializer/XML/XMLTextNode.h"
+#include <Swiften/Base/foreach.h>
+#include <Swiften/Serializer/XML/XMLTextNode.h>
namespace Swift {
diff --git a/Swiften/Serializer/XML/XMLElement.h b/Swiften/Serializer/XML/XMLElement.h
index 65af7ae..6eacb82 100644
--- a/Swiften/Serializer/XML/XMLElement.h
+++ b/Swiften/Serializer/XML/XMLElement.h
@@ -12,7 +12,7 @@
#include <string>
-#include "Swiften/Serializer/XML/XMLNode.h"
+#include <Swiften/Serializer/XML/XMLNode.h>
namespace Swift {
class XMLElement : public XMLNode {
diff --git a/Swiften/Serializer/XML/XMLNode.cpp b/Swiften/Serializer/XML/XMLNode.cpp
index cd604f5..7eedeff 100644
--- a/Swiften/Serializer/XML/XMLNode.cpp
+++ b/Swiften/Serializer/XML/XMLNode.cpp
@@ -4,7 +4,7 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/XML/XMLNode.h"
+#include <Swiften/Serializer/XML/XMLNode.h>
namespace Swift {
diff --git a/Swiften/Serializer/XML/XMLNode.h b/Swiften/Serializer/XML/XMLNode.h
index 5261888..d222faf 100644
--- a/Swiften/Serializer/XML/XMLNode.h
+++ b/Swiften/Serializer/XML/XMLNode.h
@@ -4,8 +4,7 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_XMLNode_H
-#define SWIFTEN_XMLNode_H
+#pragma once
#include <string>
@@ -17,5 +16,3 @@ namespace Swift {
virtual std::string serialize() = 0;
};
}
-
-#endif
diff --git a/Swiften/Serializer/XML/XMLRawTextNode.h b/Swiften/Serializer/XML/XMLRawTextNode.h
index 9fa8c40..9e222d5 100644
--- a/Swiften/Serializer/XML/XMLRawTextNode.h
+++ b/Swiften/Serializer/XML/XMLRawTextNode.h
@@ -4,10 +4,9 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_XMLRawTextNode_H
-#define SWIFTEN_XMLRawTextNode_H
+#pragma once
-#include "Swiften/Serializer/XML/XMLNode.h"
+#include <Swiften/Serializer/XML/XMLNode.h>
namespace Swift {
class XMLRawTextNode : public XMLNode {
@@ -23,5 +22,3 @@ namespace Swift {
std::string text_;
};
}
-
-#endif
diff --git a/Swiften/Serializer/XML/XMLTextNode.h b/Swiften/Serializer/XML/XMLTextNode.h
index 4d55f76..648854f 100644
--- a/Swiften/Serializer/XML/XMLTextNode.h
+++ b/Swiften/Serializer/XML/XMLTextNode.h
@@ -6,7 +6,7 @@
#pragma once
-#include "Swiften/Serializer/XML/XMLNode.h"
+#include <Swiften/Serializer/XML/XMLNode.h>
#include <Swiften/Base/String.h>
namespace Swift {
diff --git a/Swiften/Serializer/XMPPSerializer.cpp b/Swiften/Serializer/XMPPSerializer.cpp
index 06f3558..054175d 100644
--- a/Swiften/Serializer/XMPPSerializer.cpp
+++ b/Swiften/Serializer/XMPPSerializer.cpp
@@ -4,36 +4,38 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Serializer/XMPPSerializer.h"
+#include <Swiften/Serializer/XMPPSerializer.h>
#include <boost/bind.hpp>
#include <boost/smart_ptr/make_shared.hpp>
#include <iostream>
#include <cassert>
-#include "Swiften/Elements/ProtocolHeader.h"
-#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"
-#include "Swiften/Serializer/AuthSuccessSerializer.h"
-#include "Swiften/Serializer/AuthChallengeSerializer.h"
-#include "Swiften/Serializer/AuthResponseSerializer.h"
-#include "Swiften/Serializer/EnableStreamManagementSerializer.h"
-#include "Swiften/Serializer/StreamManagementEnabledSerializer.h"
-#include "Swiften/Serializer/StreamManagementFailedSerializer.h"
-#include "Swiften/Serializer/StanzaAckSerializer.h"
-#include "Swiften/Serializer/StanzaAckRequestSerializer.h"
-#include "Swiften/Serializer/StartTLSRequestSerializer.h"
-#include "Swiften/Serializer/StartTLSFailureSerializer.h"
-#include "Swiften/Serializer/TLSProceedSerializer.h"
-#include "Swiften/Serializer/MessageSerializer.h"
-#include "Swiften/Serializer/PresenceSerializer.h"
-#include "Swiften/Serializer/IQSerializer.h"
-#include "Swiften/Serializer/ComponentHandshakeSerializer.h"
+#include <Swiften/Elements/ProtocolHeader.h>
+#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>
+#include <Swiften/Serializer/AuthSuccessSerializer.h>
+#include <Swiften/Serializer/AuthChallengeSerializer.h>
+#include <Swiften/Serializer/AuthResponseSerializer.h>
+#include <Swiften/Serializer/EnableStreamManagementSerializer.h>
+#include <Swiften/Serializer/StreamManagementEnabledSerializer.h>
+#include <Swiften/Serializer/StreamResumeSerializer.h>
+#include <Swiften/Serializer/StreamResumedSerializer.h>
+#include <Swiften/Serializer/StreamManagementFailedSerializer.h>
+#include <Swiften/Serializer/StanzaAckSerializer.h>
+#include <Swiften/Serializer/StanzaAckRequestSerializer.h>
+#include <Swiften/Serializer/StartTLSRequestSerializer.h>
+#include <Swiften/Serializer/StartTLSFailureSerializer.h>
+#include <Swiften/Serializer/TLSProceedSerializer.h>
+#include <Swiften/Serializer/MessageSerializer.h>
+#include <Swiften/Serializer/PresenceSerializer.h>
+#include <Swiften/Serializer/IQSerializer.h>
+#include <Swiften/Serializer/ComponentHandshakeSerializer.h>
namespace Swift {
@@ -56,6 +58,8 @@ XMPPSerializer::XMPPSerializer(PayloadSerializerCollection* payloadSerializers,
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<StreamResumeSerializer>());
+ serializers_.push_back(boost::make_shared<StreamResumedSerializer>());
serializers_.push_back(boost::make_shared<StanzaAckSerializer>());
serializers_.push_back(boost::make_shared<StanzaAckRequestSerializer>());
serializers_.push_back(boost::make_shared<ComponentHandshakeSerializer>());
@@ -79,10 +83,8 @@ std::string XMPPSerializer::serializeHeader(const ProtocolHeader& header) const
return result;
}
-std::string XMPPSerializer::serializeElement(boost::shared_ptr<Element> element) const {
- std::vector< boost::shared_ptr<ElementSerializer> >::const_iterator i = std::find_if(
- serializers_.begin(), serializers_.end(),
- boost::bind(&ElementSerializer::canSerialize, _1, element));
+SafeString XMPPSerializer::serializeElement(boost::shared_ptr<Element> element) const {
+ std::vector< boost::shared_ptr<ElementSerializer> >::const_iterator i = std::find_if(serializers_.begin(), serializers_.end(), boost::bind(&ElementSerializer::canSerialize, _1, element));
if (i != serializers_.end()) {
return (*i)->serialize(element);
}
diff --git a/Swiften/Serializer/XMPPSerializer.h b/Swiften/Serializer/XMPPSerializer.h
index 4f83857..58274a8 100644
--- a/Swiften/Serializer/XMPPSerializer.h
+++ b/Swiften/Serializer/XMPPSerializer.h
@@ -9,10 +9,10 @@
#include <boost/shared_ptr.hpp>
#include <vector>
-#include "Swiften/Elements/Element.h"
-#include "Swiften/Elements/StreamType.h"
+#include <Swiften/Elements/Element.h>
+#include <Swiften/Elements/StreamType.h>
#include <string>
-#include "Swiften/Serializer/ElementSerializer.h"
+#include <Swiften/Serializer/ElementSerializer.h>
namespace Swift {
class PayloadSerializerCollection;
@@ -24,7 +24,7 @@ namespace Swift {
XMPPSerializer(PayloadSerializerCollection*, StreamType type);
std::string serializeHeader(const ProtocolHeader&) const;
- std::string serializeElement(boost::shared_ptr<Element> stanza) const;
+ SafeString serializeElement(boost::shared_ptr<Element> stanza) const;
std::string serializeFooter() const;
private: