summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Elements')
-rw-r--r--Swiften/Elements/AuthChallenge.h14
-rw-r--r--Swiften/Elements/AuthFailure.h2
-rw-r--r--Swiften/Elements/AuthRequest.h18
-rw-r--r--Swiften/Elements/AuthResponse.h17
-rw-r--r--Swiften/Elements/AuthSuccess.h12
-rw-r--r--Swiften/Elements/Body.h5
-rw-r--r--Swiften/Elements/Bytestreams.h6
-rw-r--r--Swiften/Elements/CapsInfo.h4
-rw-r--r--Swiften/Elements/ChatState.h5
-rw-r--r--Swiften/Elements/Command.h6
-rw-r--r--Swiften/Elements/ComponentHandshake.h4
-rw-r--r--Swiften/Elements/CompressFailure.h8
-rw-r--r--Swiften/Elements/CompressRequest.h7
-rw-r--r--Swiften/Elements/Compressed.h10
-rw-r--r--Swiften/Elements/Delay.h6
-rw-r--r--Swiften/Elements/DiscoInfo.cpp11
-rw-r--r--Swiften/Elements/DiscoInfo.h12
-rw-r--r--Swiften/Elements/DiscoItems.h7
-rw-r--r--Swiften/Elements/Element.cpp2
-rw-r--r--Swiften/Elements/Element.h5
-rw-r--r--Swiften/Elements/EnableStreamManagement.h2
-rw-r--r--Swiften/Elements/ErrorPayload.h13
-rw-r--r--Swiften/Elements/Form.cpp4
-rw-r--r--Swiften/Elements/Form.h13
-rw-r--r--Swiften/Elements/FormField.h5
-rw-r--r--Swiften/Elements/IBB.h21
-rw-r--r--Swiften/Elements/IQ.cpp18
-rw-r--r--Swiften/Elements/IQ.h4
-rw-r--r--Swiften/Elements/InBandRegistrationPayload.h6
-rw-r--r--Swiften/Elements/JingleContentPayload.h (renamed from Swiften/Elements/JingleContent.h)31
-rw-r--r--Swiften/Elements/JingleIBBTransportPayload.h (renamed from Swiften/Elements/JingleIBBTransport.h)8
-rw-r--r--Swiften/Elements/JinglePayload.h8
-rw-r--r--Swiften/Elements/JingleS5BTransportPayload.h (renamed from Swiften/Elements/JingleS5BTransport.h)6
-rw-r--r--Swiften/Elements/JingleTransportPayload.h (renamed from Swiften/Elements/JingleTransport.h)6
-rw-r--r--Swiften/Elements/Last.h22
-rw-r--r--Swiften/Elements/MUCOccupant.cpp2
-rw-r--r--Swiften/Elements/MUCOccupant.h2
-rw-r--r--Swiften/Elements/MUCOwnerPayload.h2
-rw-r--r--Swiften/Elements/MUCPayload.h14
-rw-r--r--Swiften/Elements/MUCUserPayload.h6
-rw-r--r--Swiften/Elements/Message.h14
-rw-r--r--Swiften/Elements/Nickname.h2
-rw-r--r--Swiften/Elements/Payload.cpp2
-rw-r--r--Swiften/Elements/Payload.h4
-rw-r--r--Swiften/Elements/Presence.cpp46
-rw-r--r--Swiften/Elements/Presence.h47
-rw-r--r--Swiften/Elements/Priority.h4
-rw-r--r--Swiften/Elements/PrivateStorage.h2
-rw-r--r--Swiften/Elements/Replace.h28
-rw-r--r--Swiften/Elements/ResourceBind.h12
-rw-r--r--Swiften/Elements/RosterItemExchangePayload.cpp18
-rw-r--r--Swiften/Elements/RosterItemExchangePayload.h87
-rw-r--r--Swiften/Elements/RosterItemPayload.h14
-rw-r--r--Swiften/Elements/RosterPayload.cpp4
-rw-r--r--Swiften/Elements/RosterPayload.h13
-rw-r--r--Swiften/Elements/SearchPayload.h4
-rw-r--r--Swiften/Elements/SecurityLabel.h7
-rw-r--r--Swiften/Elements/SecurityLabelsCatalog.h14
-rw-r--r--Swiften/Elements/SoftwareVersion.h4
-rw-r--r--Swiften/Elements/Stanza.cpp9
-rw-r--r--Swiften/Elements/Stanza.h27
-rw-r--r--Swiften/Elements/StanzaAck.h2
-rw-r--r--Swiften/Elements/StanzaAckRequest.h2
-rw-r--r--Swiften/Elements/StartSession.h7
-rw-r--r--Swiften/Elements/StartTLSFailure.h7
-rw-r--r--Swiften/Elements/StartTLSRequest.h10
-rw-r--r--Swiften/Elements/Status.h7
-rw-r--r--Swiften/Elements/StatusShow.cpp12
-rw-r--r--Swiften/Elements/StatusShow.h25
-rw-r--r--Swiften/Elements/Storage.h4
-rw-r--r--Swiften/Elements/StreamFeatures.cpp21
-rw-r--r--Swiften/Elements/StreamFeatures.h25
-rw-r--r--Swiften/Elements/StreamInitiation.h2
-rw-r--r--Swiften/Elements/StreamManagementEnabled.cpp15
-rw-r--r--Swiften/Elements/StreamManagementEnabled.h28
-rw-r--r--Swiften/Elements/StreamManagementFailed.h2
-rw-r--r--Swiften/Elements/StreamResume.cpp15
-rw-r--r--Swiften/Elements/StreamResume.h40
-rw-r--r--Swiften/Elements/StreamResumed.cpp15
-rw-r--r--Swiften/Elements/StreamResumed.h40
-rw-r--r--Swiften/Elements/Subject.h2
-rw-r--r--Swiften/Elements/TLSProceed.h10
-rw-r--r--Swiften/Elements/UnitTest/FormTest.cpp2
-rw-r--r--Swiften/Elements/UnitTest/IQTest.cpp4
-rw-r--r--Swiften/Elements/UnitTest/StanzaTest.cpp9
-rw-r--r--Swiften/Elements/UnknownElement.h7
-rw-r--r--Swiften/Elements/VCard.cpp6
-rw-r--r--Swiften/Elements/VCard.h8
-rw-r--r--Swiften/Elements/VCardUpdate.h4
-rw-r--r--Swiften/Elements/Version.h10
90 files changed, 710 insertions, 347 deletions
diff --git a/Swiften/Elements/AuthChallenge.h b/Swiften/Elements/AuthChallenge.h
index 74d7dba..f7f2796 100644
--- a/Swiften/Elements/AuthChallenge.h
+++ b/Swiften/Elements/AuthChallenge.h
@@ -7,9 +7,9 @@
#pragma once
#include <boost/optional.hpp>
+#include <vector>
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
class AuthChallenge : public Element {
@@ -17,18 +17,18 @@ namespace Swift {
AuthChallenge() {
}
- AuthChallenge(const ByteArray& value) : value(value) {
+ AuthChallenge(const std::vector<unsigned char>& value) : value(value) {
}
- const boost::optional<ByteArray>& getValue() const {
+ const boost::optional< std::vector<unsigned char> >& getValue() const {
return value;
}
- void setValue(const ByteArray& value) {
- this->value = boost::optional<ByteArray>(value);
+ void setValue(const std::vector<unsigned char>& value) {
+ this->value = boost::optional<std::vector<unsigned char> >(value);
}
private:
- boost::optional<ByteArray> value;
+ boost::optional< std::vector<unsigned char> > value;
};
}
diff --git a/Swiften/Elements/AuthFailure.h b/Swiften/Elements/AuthFailure.h
index 7ffc762..ac40956 100644
--- a/Swiften/Elements/AuthFailure.h
+++ b/Swiften/Elements/AuthFailure.h
@@ -8,7 +8,7 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
class AuthFailure : public Element {
diff --git a/Swiften/Elements/AuthRequest.h b/Swiften/Elements/AuthRequest.h
index ba86900..bfc86c2 100644
--- a/Swiften/Elements/AuthRequest.h
+++ b/Swiften/Elements/AuthRequest.h
@@ -6,10 +6,12 @@
#pragma once
+#include <vector>
+#include <string>
#include <boost/optional.hpp>
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
+#include <Swiften/Base/SafeByteArray.h>
namespace Swift {
class AuthRequest : public Element {
@@ -17,20 +19,20 @@ namespace Swift {
AuthRequest(const std::string& mechanism = "") : mechanism_(mechanism) {
}
- AuthRequest(const std::string& mechanism, const ByteArray& message) :
+ AuthRequest(const std::string& mechanism, const SafeByteArray& message) :
mechanism_(mechanism), message_(message) {
}
- AuthRequest(const std::string& mechanism, const boost::optional<ByteArray>& message) :
+ AuthRequest(const std::string& mechanism, const boost::optional<SafeByteArray>& message) :
mechanism_(mechanism), message_(message) {
}
- const boost::optional<ByteArray>& getMessage() const {
+ const boost::optional<SafeByteArray>& getMessage() const {
return message_;
}
- void setMessage(const ByteArray& message) {
- message_ = boost::optional<ByteArray>(message);
+ void setMessage(const SafeByteArray& message) {
+ message_ = boost::optional<SafeByteArray>(message);
}
const std::string& getMechanism() const {
@@ -43,6 +45,6 @@ namespace Swift {
private:
std::string mechanism_;
- boost::optional<ByteArray> message_;
+ boost::optional<SafeByteArray> message_;
};
}
diff --git a/Swiften/Elements/AuthResponse.h b/Swiften/Elements/AuthResponse.h
index 96d1b13..db2dcea 100644
--- a/Swiften/Elements/AuthResponse.h
+++ b/Swiften/Elements/AuthResponse.h
@@ -6,10 +6,11 @@
#pragma once
+#include <vector>
#include <boost/optional.hpp>
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
+#include <Swiften/Base/SafeByteArray.h>
namespace Swift {
class AuthResponse : public Element {
@@ -17,21 +18,21 @@ namespace Swift {
AuthResponse() {
}
- AuthResponse(const ByteArray& value) : value(value) {
+ AuthResponse(const SafeByteArray& value) : value(value) {
}
- AuthResponse(const boost::optional<ByteArray>& value) : value(value) {
+ AuthResponse(const boost::optional<SafeByteArray>& value) : value(value) {
}
- const boost::optional<ByteArray>& getValue() const {
+ const boost::optional<SafeByteArray>& getValue() const {
return value;
}
- void setValue(const ByteArray& value) {
- this->value = boost::optional<ByteArray>(value);
+ void setValue(const SafeByteArray& value) {
+ this->value = boost::optional<SafeByteArray>(value);
}
private:
- boost::optional<ByteArray> value;
+ boost::optional<SafeByteArray> value;
};
}
diff --git a/Swiften/Elements/AuthSuccess.h b/Swiften/Elements/AuthSuccess.h
index af5f9bb..3c0f329 100644
--- a/Swiften/Elements/AuthSuccess.h
+++ b/Swiften/Elements/AuthSuccess.h
@@ -6,25 +6,25 @@
#pragma once
+#include <vector>
#include <boost/optional.hpp>
-#include "Swiften/Elements/Element.h"
-#include "Swiften/Base/ByteArray.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
class AuthSuccess : public Element {
public:
AuthSuccess() {}
- const boost::optional<ByteArray>& getValue() const {
+ const boost::optional<std::vector<unsigned char> >& getValue() const {
return value;
}
- void setValue(const ByteArray& value) {
- this->value = boost::optional<ByteArray>(value);
+ void setValue(const std::vector<unsigned char>& value) {
+ this->value = boost::optional<std::vector<unsigned char> >(value);
}
private:
- boost::optional<ByteArray> value;
+ boost::optional<std::vector<unsigned char> > value;
};
}
diff --git a/Swiften/Elements/Body.h b/Swiften/Elements/Body.h
index 2887390..a2497f7 100644
--- a/Swiften/Elements/Body.h
+++ b/Swiften/Elements/Body.h
@@ -6,14 +6,13 @@
#pragma once
-#include "Swiften/Elements/Payload.h"
#include <string>
+#include <Swiften/Elements/Payload.h>
+
namespace Swift {
class Body : public Payload {
public:
- typedef boost::shared_ptr<Body> ref;
-
Body(const std::string& text = "") : text_(text) {
}
diff --git a/Swiften/Elements/Bytestreams.h b/Swiften/Elements/Bytestreams.h
index b493375..9724a54 100644
--- a/Swiften/Elements/Bytestreams.h
+++ b/Swiften/Elements/Bytestreams.h
@@ -9,10 +9,10 @@
#include <vector>
#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
-
-#include "Swiften/JID/JID.h"
#include <string>
-#include "Swiften/Elements/Payload.h"
+
+#include <Swiften/JID/JID.h>
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class Bytestreams : public Payload {
diff --git a/Swiften/Elements/CapsInfo.h b/Swiften/Elements/CapsInfo.h
index ccad278..c6d3b64 100644
--- a/Swiften/Elements/CapsInfo.h
+++ b/Swiften/Elements/CapsInfo.h
@@ -7,9 +7,9 @@
#pragma once
#include <boost/shared_ptr.hpp>
-
#include <string>
-#include "Swiften/Elements/Payload.h"
+
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class CapsInfo : public Payload {
diff --git a/Swiften/Elements/ChatState.h b/Swiften/Elements/ChatState.h
index 2896877..477fd27 100644
--- a/Swiften/Elements/ChatState.h
+++ b/Swiften/Elements/ChatState.h
@@ -7,7 +7,8 @@
#pragma once
#include <string>
-#include "Swiften/Elements/Payload.h"
+
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class ChatState : public Payload {
@@ -17,7 +18,7 @@ namespace Swift {
state_ = state;
}
- ChatStateType getChatState() { return state_; }
+ ChatStateType getChatState() const { return state_; }
void setChatState(ChatStateType state) {state_ = state;}
private:
diff --git a/Swiften/Elements/Command.h b/Swiften/Elements/Command.h
index f4059a8..91ae5a3 100644
--- a/Swiften/Elements/Command.h
+++ b/Swiften/Elements/Command.h
@@ -7,10 +7,10 @@
#pragma once
#include <boost/shared_ptr.hpp>
-
#include <string>
-#include "Swiften/Elements/Payload.h"
-#include "Swiften/Elements/Form.h"
+
+#include <Swiften/Elements/Payload.h>
+#include <Swiften/Elements/Form.h>
namespace Swift {
/**
diff --git a/Swiften/Elements/ComponentHandshake.h b/Swiften/Elements/ComponentHandshake.h
index 6047eab..5992b8c 100644
--- a/Swiften/Elements/ComponentHandshake.h
+++ b/Swiften/Elements/ComponentHandshake.h
@@ -7,10 +7,10 @@
#pragma once
#include <boost/shared_ptr.hpp>
-
-#include "Swiften/Elements/Element.h"
#include <string>
+#include <Swiften/Elements/Element.h>
+
namespace Swift {
class ComponentHandshake : public Element {
public:
diff --git a/Swiften/Elements/CompressFailure.h b/Swiften/Elements/CompressFailure.h
index c0d5847..7dd8867 100644
--- a/Swiften/Elements/CompressFailure.h
+++ b/Swiften/Elements/CompressFailure.h
@@ -4,10 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_CompressFailure_H
-#define SWIFTEN_CompressFailure_H
+#pragma once
-#include "Swiften/Elements/Element.h"
+
+#include <Swiften/Elements/Element.h>
namespace Swift {
class CompressFailure : public Element {
@@ -15,5 +15,3 @@ namespace Swift {
CompressFailure() {}
};
}
-
-#endif
diff --git a/Swiften/Elements/CompressRequest.h b/Swiften/Elements/CompressRequest.h
index 0eb302a..b6fcc64 100644
--- a/Swiften/Elements/CompressRequest.h
+++ b/Swiften/Elements/CompressRequest.h
@@ -4,10 +4,9 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_CompressRequest_H
-#define SWIFTEN_CompressRequest_H
+#pragma once
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
class CompressRequest : public Element
@@ -27,5 +26,3 @@ namespace Swift {
std::string method_;
};
}
-
-#endif
diff --git a/Swiften/Elements/Compressed.h b/Swiften/Elements/Compressed.h
index e50c17e..2affec5 100644
--- a/Swiften/Elements/Compressed.h
+++ b/Swiften/Elements/Compressed.h
@@ -4,17 +4,13 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_COMPRESSED_H
-#define SWIFTEN_COMPRESSED_H
+#pragma once
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
- class Compressed : public Element
- {
+ class Compressed : public Element {
public:
Compressed() {}
};
}
-
-#endif
diff --git a/Swiften/Elements/Delay.h b/Swiften/Elements/Delay.h
index 3213037..f7c4570 100644
--- a/Swiften/Elements/Delay.h
+++ b/Swiften/Elements/Delay.h
@@ -6,11 +6,11 @@
#pragma once
-#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
#include <boost/optional.hpp>
-#include "Swiften/Elements/Payload.h"
-#include "Swiften/JID/JID.h"
+#include <Swiften/Elements/Payload.h>
+#include <Swiften/JID/JID.h>
namespace Swift {
class Delay : public Payload {
diff --git a/Swiften/Elements/DiscoInfo.cpp b/Swiften/Elements/DiscoInfo.cpp
index f0e728e..f54b6bf 100644
--- a/Swiften/Elements/DiscoInfo.cpp
+++ b/Swiften/Elements/DiscoInfo.cpp
@@ -4,7 +4,9 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Elements/DiscoInfo.h"
+#include <Swiften/Elements/DiscoInfo.h>
+
+#include <algorithm>
namespace Swift {
@@ -12,6 +14,9 @@ const std::string DiscoInfo::ChatStatesFeature = std::string("http://jabber.org/
const std::string DiscoInfo::SecurityLabelsFeature = std::string("urn:xmpp:sec-label:0");
const std::string DiscoInfo::SecurityLabelsCatalogFeature = std::string("urn:xmpp:sec-label:catalog:2");
const std::string DiscoInfo::JabberSearchFeature = std::string("jabber:iq:search");
+const std::string DiscoInfo::CommandsFeature = std::string("http://jabber.org/protocol/commands");
+const std::string DiscoInfo::MessageCorrectionFeature = std::string("urn:xmpp:message-correct:0");
+
bool DiscoInfo::Identity::operator<(const Identity& other) const {
@@ -33,4 +38,8 @@ bool DiscoInfo::Identity::operator<(const Identity& other) const {
}
}
+bool DiscoInfo::hasFeature(const std::string& feature) const {
+ return std::find(features_.begin(), features_.end(), feature) != features_.end();
+}
+
}
diff --git a/Swiften/Elements/DiscoInfo.h b/Swiften/Elements/DiscoInfo.h
index b73165e..c5c9e1c 100644
--- a/Swiften/Elements/DiscoInfo.h
+++ b/Swiften/Elements/DiscoInfo.h
@@ -7,12 +7,10 @@
#pragma once
#include <vector>
-#include <algorithm>
-
-#include "Swiften/Elements/Payload.h"
#include <string>
-#include "Swiften/Elements/Form.h"
+#include <Swiften/Elements/Payload.h>
+#include <Swiften/Elements/Form.h>
namespace Swift {
class DiscoInfo : public Payload {
@@ -23,6 +21,8 @@ namespace Swift {
static const std::string SecurityLabelsFeature;
static const std::string SecurityLabelsCatalogFeature;
static const std::string JabberSearchFeature;
+ static const std::string CommandsFeature;
+ static const std::string MessageCorrectionFeature;
class Identity {
public:
@@ -82,9 +82,7 @@ namespace Swift {
features_.push_back(feature);
}
- bool hasFeature(const std::string& feature) const {
- return std::find(features_.begin(), features_.end(), feature) != features_.end();
- }
+ bool hasFeature(const std::string& feature) const;
void addExtension(Form::ref form) {
extensions_.push_back(form);
diff --git a/Swiften/Elements/DiscoItems.h b/Swiften/Elements/DiscoItems.h
index cc5a583..149e41c 100644
--- a/Swiften/Elements/DiscoItems.h
+++ b/Swiften/Elements/DiscoItems.h
@@ -7,11 +7,10 @@
#pragma once
#include <vector>
-#include <algorithm>
-
-#include "Swiften/Elements/Payload.h"
#include <string>
-#include "Swiften/JID/JID.h"
+
+#include <Swiften/Elements/Payload.h>
+#include <Swiften/JID/JID.h>
namespace Swift {
class DiscoItems : public Payload {
diff --git a/Swiften/Elements/Element.cpp b/Swiften/Elements/Element.cpp
index 5407e89..94829ba 100644
--- a/Swiften/Elements/Element.cpp
+++ b/Swiften/Elements/Element.cpp
@@ -4,7 +4,7 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
diff --git a/Swiften/Elements/Element.h b/Swiften/Elements/Element.h
index aded528..1e6a9d0 100644
--- a/Swiften/Elements/Element.h
+++ b/Swiften/Elements/Element.h
@@ -4,8 +4,7 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_ELEMENT_H
-#define SWIFTEN_ELEMENT_H
+#pragma once
namespace Swift {
class Element {
@@ -13,5 +12,3 @@ namespace Swift {
virtual ~Element();
};
}
-
-#endif
diff --git a/Swiften/Elements/EnableStreamManagement.h b/Swiften/Elements/EnableStreamManagement.h
index 807db84..15a091e 100644
--- a/Swiften/Elements/EnableStreamManagement.h
+++ b/Swiften/Elements/EnableStreamManagement.h
@@ -6,7 +6,7 @@
#pragma once
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
diff --git a/Swiften/Elements/ErrorPayload.h b/Swiften/Elements/ErrorPayload.h
index 12ad574..f21ba98 100644
--- a/Swiften/Elements/ErrorPayload.h
+++ b/Swiften/Elements/ErrorPayload.h
@@ -7,10 +7,10 @@
#pragma once
#include <boost/shared_ptr.hpp>
-
-#include "Swiften/Elements/Payload.h"
#include <string>
+#include <Swiften/Elements/Payload.h>
+
namespace Swift {
class ErrorPayload : public Payload {
public:
@@ -69,9 +69,18 @@ namespace Swift {
return text_;
}
+ void setPayload(boost::shared_ptr<Payload> payload) {
+ payload_ = payload;
+ }
+
+ boost::shared_ptr<Payload> getPayload() const {
+ return payload_;
+ }
+
private:
Type type_;
Condition condition_;
std::string text_;
+ boost::shared_ptr<Payload> payload_;
};
}
diff --git a/Swiften/Elements/Form.cpp b/Swiften/Elements/Form.cpp
index 03fd1a4..c34b868 100644
--- a/Swiften/Elements/Form.cpp
+++ b/Swiften/Elements/Form.cpp
@@ -4,8 +4,8 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Elements/Form.h"
-#include "Swiften/Base/foreach.h"
+#include <Swiften/Elements/Form.h>
+#include <Swiften/Base/foreach.h>
namespace Swift {
diff --git a/Swiften/Elements/Form.h b/Swiften/Elements/Form.h
index 1c50f0c..47ff7d4 100644
--- a/Swiften/Elements/Form.h
+++ b/Swiften/Elements/Form.h
@@ -7,12 +7,11 @@
#pragma once
#include <vector>
-
-#include "Swiften/Elements/Payload.h"
-#include "Swiften/Elements/FormField.h"
#include <string>
-#include "Swiften/JID/JID.h"
+#include <Swiften/Elements/Payload.h>
+#include <Swiften/Elements/FormField.h>
+#include <Swiften/JID/JID.h>
namespace Swift {
/**
@@ -32,12 +31,12 @@ namespace Swift {
void addField(boost::shared_ptr<FormField> field) { fields_.push_back(field); }
const std::vector<boost::shared_ptr<FormField> >& getFields() const { return fields_; }
void setTitle(const std::string& title) { title_ = title; }
- const std::string& getTitle() { return title_; }
+ const std::string& getTitle() const { return title_; }
void setInstructions(const std::string& instructions) { instructions_ = instructions; }
- const std::string& getInstructions() { return instructions_; }
+ const std::string& getInstructions() const { return instructions_; }
- Type getType() { return type_; }
+ Type getType() const { return type_; }
void setType(Type type) { type_ = type; }
std::string getFormType() const;
diff --git a/Swiften/Elements/FormField.h b/Swiften/Elements/FormField.h
index 517369b..e8fe3a0 100644
--- a/Swiften/Elements/FormField.h
+++ b/Swiften/Elements/FormField.h
@@ -11,9 +11,9 @@
#include <vector>
#include <boost/shared_ptr.hpp>
-
#include <string>
-#include "Swiften/JID/JID.h"
+
+#include <Swiften/JID/JID.h>
namespace Swift {
class FormField {
@@ -111,5 +111,4 @@ namespace Swift {
SWIFTEN_DECLARE_FORM_FIELD(JIDSingle, JID);
SWIFTEN_DECLARE_FORM_FIELD(JIDMulti, std::vector<JID>);
SWIFTEN_DECLARE_FORM_FIELD(ListMulti, std::vector<std::string>);
- SWIFTEN_DECLARE_FORM_FIELD(Untyped, std::vector<std::string>);
}
diff --git a/Swiften/Elements/IBB.h b/Swiften/Elements/IBB.h
index 55f2c4f..64c9f14 100644
--- a/Swiften/Elements/IBB.h
+++ b/Swiften/Elements/IBB.h
@@ -6,11 +6,12 @@
#pragma once
+#include <string>
+#include <vector>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
-#include <string>
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class IBB : public Payload {
@@ -31,20 +32,20 @@ namespace Swift {
}
static IBB::ref createIBBOpen(const std::string& streamID, int blockSize) {
- IBB::ref result(new IBB(Open, streamID));
+ IBB::ref result = boost::make_shared<IBB>(Open, streamID);
result->setBlockSize(blockSize);
return result;
}
- static IBB::ref createIBBData(const std::string& streamID, int sequenceNumber, const ByteArray& data) {
- IBB::ref result(new IBB(Data, streamID));
+ static IBB::ref createIBBData(const std::string& streamID, int sequenceNumber, const std::vector<unsigned char>& data) {
+ IBB::ref result = boost::make_shared<IBB>(Data, streamID);
result->setSequenceNumber(sequenceNumber);
result->setData(data);
return result;
}
static IBB::ref createIBBClose(const std::string& streamID) {
- return IBB::ref(new IBB(Close, streamID));
+ return boost::make_shared<IBB>(Close, streamID);
}
void setAction(Action action) {
@@ -71,11 +72,11 @@ namespace Swift {
return streamID;
}
- const ByteArray& getData() const {
+ const std::vector<unsigned char>& getData() const {
return data;
}
- void setData(const ByteArray& data) {
+ void setData(const std::vector<unsigned char>& data) {
this->data = data;
}
@@ -98,7 +99,7 @@ namespace Swift {
private:
Action action;
std::string streamID;
- ByteArray data;
+ std::vector<unsigned char> data;
StanzaType stanzaType;
int blockSize;
int sequenceNumber;
diff --git a/Swiften/Elements/IQ.cpp b/Swiften/Elements/IQ.cpp
index eb62ee4..8e6d7cc 100644
--- a/Swiften/Elements/IQ.cpp
+++ b/Swiften/Elements/IQ.cpp
@@ -4,13 +4,15 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Elements/IQ.h"
+#include <Swiften/Elements/IQ.h>
+
+#include <boost/smart_ptr/make_shared.hpp>
namespace Swift {
boost::shared_ptr<IQ> IQ::createRequest(
Type type, const JID& to, const std::string& id, boost::shared_ptr<Payload> payload) {
- boost::shared_ptr<IQ> iq(new IQ(type));
+ boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(type);
if (to.isValid()) {
iq->setTo(to);
}
@@ -22,7 +24,7 @@ boost::shared_ptr<IQ> IQ::createRequest(
}
boost::shared_ptr<IQ> IQ::createResult(const JID& to, const std::string& id, boost::shared_ptr<Payload> payload) {
- boost::shared_ptr<IQ> iq(new IQ(Result));
+ boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(Result);
iq->setTo(to);
iq->setID(id);
if (payload) {
@@ -32,7 +34,7 @@ boost::shared_ptr<IQ> IQ::createResult(const JID& to, const std::string& id, boo
}
boost::shared_ptr<IQ> IQ::createResult(const JID& to, const JID& from, const std::string& id, boost::shared_ptr<Payload> payload) {
- boost::shared_ptr<IQ> iq(new IQ(Result));
+ boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(Result);
iq->setTo(to);
iq->setFrom(from);
iq->setID(id);
@@ -43,19 +45,19 @@ boost::shared_ptr<IQ> IQ::createResult(const JID& to, const JID& from, const std
}
boost::shared_ptr<IQ> IQ::createError(const JID& to, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type) {
- boost::shared_ptr<IQ> iq(new IQ(IQ::Error));
+ boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(IQ::Error);
iq->setTo(to);
iq->setID(id);
- iq->addPayload(boost::shared_ptr<Swift::ErrorPayload>(new Swift::ErrorPayload(condition, type)));
+ iq->addPayload(boost::make_shared<Swift::ErrorPayload>(condition, type));
return iq;
}
boost::shared_ptr<IQ> IQ::createError(const JID& to, const JID& from, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type) {
- boost::shared_ptr<IQ> iq(new IQ(IQ::Error));
+ boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(IQ::Error);
iq->setTo(to);
iq->setFrom(from);
iq->setID(id);
- iq->addPayload(boost::shared_ptr<Swift::ErrorPayload>(new Swift::ErrorPayload(condition, type)));
+ iq->addPayload(boost::make_shared<Swift::ErrorPayload>(condition, type));
return iq;
}
diff --git a/Swiften/Elements/IQ.h b/Swiften/Elements/IQ.h
index 78a8bbd..05cd96a 100644
--- a/Swiften/Elements/IQ.h
+++ b/Swiften/Elements/IQ.h
@@ -8,8 +8,8 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/Stanza.h"
-#include "Swiften/Elements/ErrorPayload.h"
+#include <Swiften/Elements/Stanza.h>
+#include <Swiften/Elements/ErrorPayload.h>
namespace Swift {
class IQ : public Stanza {
diff --git a/Swiften/Elements/InBandRegistrationPayload.h b/Swiften/Elements/InBandRegistrationPayload.h
index e4e1e6f..8f6a9f1 100644
--- a/Swiften/Elements/InBandRegistrationPayload.h
+++ b/Swiften/Elements/InBandRegistrationPayload.h
@@ -8,11 +8,11 @@
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
-
-#include "Swiften/Elements/Payload.h"
-#include "Swiften/Elements/Form.h"
#include <string>
+#include <Swiften/Elements/Payload.h>
+#include <Swiften/Elements/Form.h>
+
namespace Swift {
class InBandRegistrationPayload : public Payload {
public:
diff --git a/Swiften/Elements/JingleContent.h b/Swiften/Elements/JingleContentPayload.h
index 4ae908b..c44a806 100644
--- a/Swiften/Elements/JingleContent.h
+++ b/Swiften/Elements/JingleContentPayload.h
@@ -8,18 +8,17 @@
#include <vector>
#include <boost/optional.hpp>
-
#include <string>
+
#include <Swiften/JID/JID.h>
#include <Swiften/Elements/Payload.h>
#include <Swiften/Elements/JingleDescription.h>
-#include <Swiften/Elements/JingleTransport.h>
-#include <Swiften/Base/foreach.h>
+#include <Swiften/Elements/JingleTransportPayload.h>
namespace Swift {
- class JingleContent : public Payload {
+ class JingleContentPayload : public Payload {
public:
- typedef boost::shared_ptr<JingleContent> ref;
+ typedef boost::shared_ptr<JingleContentPayload> ref;
enum Creator {
InitiatorCreator,
@@ -33,10 +32,18 @@ namespace Swift {
BothSenders,
};*/
+ Creator getCreator() const {
+ return creator;
+ }
+
void setCreator(Creator creator) {
this->creator = creator;
}
+ const std::string& getName() const {
+ return name;
+ }
+
void setName(const std::string& name) {
this->name = name;
}
@@ -49,18 +56,18 @@ namespace Swift {
descriptions.push_back(description);
}
- const std::vector<JingleTransport::ref>& getTransports() const {
+ const std::vector<boost::shared_ptr<JingleTransportPayload> >& getTransports() const {
return transports;
}
- void addTransport(JingleTransport::ref transport) {
+ void addTransport(boost::shared_ptr<JingleTransportPayload> transport) {
transports.push_back(transport);
}
template<typename T>
boost::shared_ptr<T> getDescription() const {
- foreach (JingleDescription::ref i, descriptions) {
- boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(i));
+ for (size_t i = 0; i < descriptions.size(); ++i) {
+ boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(descriptions[i]));
if (result) {
return result;
}
@@ -70,8 +77,8 @@ namespace Swift {
template<typename T>
boost::shared_ptr<T> getTransport() const {
- foreach (JingleTransport::ref i, transports) {
- boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(i));
+ for (size_t i = 0; i < transports.size(); ++i) {
+ boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(transports[i]));
if (result) {
return result;
}
@@ -84,6 +91,6 @@ namespace Swift {
std::string name;
//Senders senders;
std::vector<JingleDescription::ref> descriptions;
- std::vector<JingleTransport::ref> transports;
+ std::vector<boost::shared_ptr<JingleTransportPayload> > transports;
};
}
diff --git a/Swiften/Elements/JingleIBBTransport.h b/Swiften/Elements/JingleIBBTransportPayload.h
index faa5af3..67aab09 100644
--- a/Swiften/Elements/JingleIBBTransport.h
+++ b/Swiften/Elements/JingleIBBTransportPayload.h
@@ -6,12 +6,16 @@
#pragma once
+#include <boost/shared_ptr.hpp>
#include <string>
-#include <Swiften/Elements/JingleTransport.h>
+
+#include <Swiften/Elements/JingleTransportPayload.h>
namespace Swift {
- class JingleIBBTransport : public JingleTransport {
+ class JingleIBBTransportPayload : public JingleTransportPayload {
public:
+ typedef boost::shared_ptr<JingleIBBTransportPayload> ref;
+
enum StanzaType {
IQStanza,
MessageStanza,
diff --git a/Swiften/Elements/JinglePayload.h b/Swiften/Elements/JinglePayload.h
index 59fba7b..5c766b8 100644
--- a/Swiften/Elements/JinglePayload.h
+++ b/Swiften/Elements/JinglePayload.h
@@ -12,7 +12,7 @@
#include <string>
#include <Swiften/JID/JID.h>
#include <Swiften/Elements/Payload.h>
-#include <Swiften/Elements/JingleContent.h>
+#include <Swiften/Elements/JingleContentPayload.h>
namespace Swift {
@@ -98,11 +98,11 @@ namespace Swift {
return sessionID;
}
- void addContent(JingleContent::ref content) {
+ void addContent(JingleContentPayload::ref content) {
this->contents.push_back(content);
}
- const std::vector<JingleContent::ref>& getContents() const {
+ const std::vector<JingleContentPayload::ref>& getContents() const {
return contents;
}
@@ -119,7 +119,7 @@ namespace Swift {
JID initiator;
JID responder;
std::string sessionID;
- std::vector<JingleContent::ref> contents;
+ std::vector<JingleContentPayload::ref> contents;
boost::optional<Reason> reason;
};
}
diff --git a/Swiften/Elements/JingleS5BTransport.h b/Swiften/Elements/JingleS5BTransportPayload.h
index 4522417..7b3089f 100644
--- a/Swiften/Elements/JingleS5BTransport.h
+++ b/Swiften/Elements/JingleS5BTransportPayload.h
@@ -6,11 +6,13 @@
#pragma once
-#include <Swiften/Elements/JingleTransport.h>
+#include <Swiften/Elements/JingleTransportPayload.h>
#include <Swiften/Elements/Bytestreams.h>
+// FIXME: Remove Bytestreams, and replace by our own candidate
+
namespace Swift {
- class JingleS5BTransport : public JingleTransport {
+ class JingleS5BTransportPayload : public JingleTransportPayload {
public:
const Bytestreams& getInfo() const {
return info;
diff --git a/Swiften/Elements/JingleTransport.h b/Swiften/Elements/JingleTransportPayload.h
index ecd2a34..7a9ea29 100644
--- a/Swiften/Elements/JingleTransport.h
+++ b/Swiften/Elements/JingleTransportPayload.h
@@ -6,9 +6,13 @@
#pragma once
+#include <boost/shared_ptr.hpp>
+
#include <Swiften/Elements/Payload.h>
namespace Swift {
- class JingleTransport : public Payload {
+ class JingleTransportPayload : public Payload {
+ public:
+ typedef boost::shared_ptr<JingleTransportPayload> ref;
};
}
diff --git a/Swiften/Elements/Last.h b/Swiften/Elements/Last.h
new file mode 100644
index 0000000..fe0323a
--- /dev/null
+++ b/Swiften/Elements/Last.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2011 Kevin Smith
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#pragma once
+
+#include <Swiften/Elements/Payload.h>
+
+namespace Swift {
+ class Last : public Payload {
+ public:
+ Last(int seconds = 0) : seconds_(seconds) {};
+
+ int getSeconds() const {return seconds_;}
+ void setSeconds(int seconds) {seconds_ = seconds;}
+
+ private:
+ int seconds_;
+ };
+}
diff --git a/Swiften/Elements/MUCOccupant.cpp b/Swiften/Elements/MUCOccupant.cpp
index a5d8f0e..57034ad 100644
--- a/Swiften/Elements/MUCOccupant.cpp
+++ b/Swiften/Elements/MUCOccupant.cpp
@@ -4,7 +4,7 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Elements/MUCOccupant.h"
+#include <Swiften/Elements/MUCOccupant.h>
namespace Swift {
diff --git a/Swiften/Elements/MUCOccupant.h b/Swiften/Elements/MUCOccupant.h
index b3ae4aa..931f544 100644
--- a/Swiften/Elements/MUCOccupant.h
+++ b/Swiften/Elements/MUCOccupant.h
@@ -9,7 +9,7 @@
#include <boost/optional.hpp>
#include <string>
-#include "Swiften/JID/JID.h"
+#include <Swiften/JID/JID.h>
namespace Swift {
class Client;
diff --git a/Swiften/Elements/MUCOwnerPayload.h b/Swiften/Elements/MUCOwnerPayload.h
index 6c3e5f0..a3db05b 100644
--- a/Swiften/Elements/MUCOwnerPayload.h
+++ b/Swiften/Elements/MUCOwnerPayload.h
@@ -8,7 +8,7 @@
#include <boost/optional.hpp>
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class MUCOwnerPayload : public Payload {
diff --git a/Swiften/Elements/MUCPayload.h b/Swiften/Elements/MUCPayload.h
index c372360..3b99111 100644
--- a/Swiften/Elements/MUCPayload.h
+++ b/Swiften/Elements/MUCPayload.h
@@ -7,11 +7,11 @@
#pragma once
#include <boost/optional.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/date_time/posix_time/posix_time_types.hpp>
-#include "Swiften/JID/JID.h"
+#include <Swiften/JID/JID.h>
#include <string>
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class MUCPayload : public Payload {
@@ -40,19 +40,19 @@ namespace Swift {
since_ = since;
}
- int getMaxChars() {
+ int getMaxChars() const{
return maxChars_;
}
- int getMaxStanzas() {
+ int getMaxStanzas() const{
return maxStanzas_;
}
- int getSeconds() {
+ int getSeconds() const {
return seconds_;
}
- boost::posix_time::ptime getSince() {
+ const boost::posix_time::ptime& getSince() const {
return since_;
}
diff --git a/Swiften/Elements/MUCUserPayload.h b/Swiften/Elements/MUCUserPayload.h
index 7460c35..0276964 100644
--- a/Swiften/Elements/MUCUserPayload.h
+++ b/Swiften/Elements/MUCUserPayload.h
@@ -11,9 +11,9 @@
#include <string>
#include <vector>
-#include "Swiften/JID/JID.h"
-#include "Swiften/Elements/Payload.h"
-#include "Swiften/Elements/MUCOccupant.h"
+#include <Swiften/JID/JID.h>
+#include <Swiften/Elements/Payload.h>
+#include <Swiften/Elements/MUCOccupant.h>
namespace Swift {
class MUCUserPayload : public Payload {
diff --git a/Swiften/Elements/Message.h b/Swiften/Elements/Message.h
index a553eb3..19e3fbb 100644
--- a/Swiften/Elements/Message.h
+++ b/Swiften/Elements/Message.h
@@ -8,12 +8,14 @@
#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
+#include <boost/smart_ptr/make_shared.hpp>
#include <string>
-#include "Swiften/Elements/Body.h"
-#include "Swiften/Elements/Subject.h"
-#include "Swiften/Elements/ErrorPayload.h"
-#include "Swiften/Elements/Stanza.h"
+#include <Swiften/Elements/Body.h>
+#include <Swiften/Elements/Subject.h>
+#include <Swiften/Elements/ErrorPayload.h>
+#include <Swiften/Elements/Stanza.h>
+#include <Swiften/Elements/Replace.h>
namespace Swift {
class Message : public Stanza {
@@ -33,7 +35,7 @@ namespace Swift {
}
void setSubject(const std::string& subject) {
- updatePayload(boost::shared_ptr<Subject>(new Subject(subject)));
+ updatePayload(boost::make_shared<Subject>(subject));
}
std::string getBody() const {
@@ -45,7 +47,7 @@ namespace Swift {
}
void setBody(const std::string& body) {
- updatePayload(boost::shared_ptr<Body>(new Body(body)));
+ updatePayload(boost::make_shared<Body>(body));
}
bool isError() {
diff --git a/Swiften/Elements/Nickname.h b/Swiften/Elements/Nickname.h
index 540f6da..a244ce3 100644
--- a/Swiften/Elements/Nickname.h
+++ b/Swiften/Elements/Nickname.h
@@ -6,7 +6,7 @@
#pragma once
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
#include <string>
namespace Swift {
diff --git a/Swiften/Elements/Payload.cpp b/Swiften/Elements/Payload.cpp
index b66dcdb..b7c3ffe 100644
--- a/Swiften/Elements/Payload.cpp
+++ b/Swiften/Elements/Payload.cpp
@@ -4,7 +4,7 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
namespace Swift {
diff --git a/Swiften/Elements/Payload.h b/Swiften/Elements/Payload.h
index c87b899..8b6d44a 100644
--- a/Swiften/Elements/Payload.h
+++ b/Swiften/Elements/Payload.h
@@ -6,13 +6,9 @@
#pragma once
-#include <boost/shared_ptr.hpp>
-
namespace Swift {
class Payload {
public:
- typedef boost::shared_ptr<Payload> ref;
-
virtual ~Payload();
};
}
diff --git a/Swiften/Elements/Presence.cpp b/Swiften/Elements/Presence.cpp
new file mode 100644
index 0000000..38b8a4c
--- /dev/null
+++ b/Swiften/Elements/Presence.cpp
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Elements/Presence.h>
+
+#include <Swiften/Elements/Priority.h>
+#include <Swiften/Elements/Status.h>
+
+namespace Swift {
+
+Presence::Presence() : type_(Available) /*, showType_(Online)*/ {
+}
+
+Presence::Presence(const std::string& status) : type_(Available) {
+ setStatus(status);
+}
+
+Presence::~Presence() {
+}
+
+int Presence::getPriority() const {
+ boost::shared_ptr<Priority> priority(getPayload<Priority>());
+ return (priority ? priority->getPriority() : 0);
+}
+
+void Presence::setPriority(int priority) {
+ updatePayload(boost::make_shared<Priority>(priority));
+}
+
+std::string Presence::getStatus() const {
+ boost::shared_ptr<Status> status(getPayload<Status>());
+ if (status) {
+ return status->getText();
+ }
+ return "";
+}
+
+void Presence::setStatus(const std::string& status) {
+ updatePayload(boost::make_shared<Status>(status));
+}
+
+
+}
diff --git a/Swiften/Elements/Presence.h b/Swiften/Elements/Presence.h
index 7f957ba..28a9ee5 100644
--- a/Swiften/Elements/Presence.h
+++ b/Swiften/Elements/Presence.h
@@ -6,11 +6,10 @@
#pragma once
+#include <boost/smart_ptr/make_shared.hpp>
-#include "Swiften/Elements/Stanza.h"
-#include "Swiften/Elements/Status.h"
-#include "Swiften/Elements/StatusShow.h"
-#include "Swiften/Elements/Priority.h"
+#include <Swiften/Elements/Stanza.h>
+#include <Swiften/Elements/StatusShow.h>
namespace Swift {
class Presence : public Stanza {
@@ -19,21 +18,20 @@ namespace Swift {
enum Type { Available, Error, Probe, Subscribe, Subscribed, Unavailable, Unsubscribe, Unsubscribed };
- Presence() : type_(Available) /*, showType_(Online)*/ {}
- Presence(const std::string& status) : type_(Available) {
- setStatus(status);
- }
+ Presence();
+ Presence(const std::string& status);
+ virtual ~Presence();
static ref create() {
- return ref(new Presence());
+ return boost::make_shared<Presence>();
}
static ref create(const std::string& status) {
- return ref(new Presence(status));
+ return boost::make_shared<Presence>(status);
}
static ref create(Presence::ref presence) {
- return ref(new Presence(*presence));
+ return boost::make_shared<Presence>(*presence);
}
Type getType() const { return type_; }
@@ -48,32 +46,17 @@ namespace Swift {
}
void setShow(const StatusShow::Type &show) {
- updatePayload(boost::shared_ptr<StatusShow>(new StatusShow(show)));
- }
-
- std::string getStatus() const {
- boost::shared_ptr<Status> status(getPayload<Status>());
- if (status) {
- return status->getText();
- }
- return "";
+ updatePayload(boost::make_shared<StatusShow>(show));
}
- void setStatus(const std::string& status) {
- updatePayload(boost::shared_ptr<Status>(new Status(status)));
- }
-
- int getPriority() const {
- boost::shared_ptr<Priority> priority(getPayload<Priority>());
- return (priority ? priority->getPriority() : 0);
- }
+ std::string getStatus() const;
+ void setStatus(const std::string& status);
- void setPriority(int priority) {
- updatePayload(boost::shared_ptr<Priority>(new Priority(priority)));
- }
+ int getPriority() const;
+ void setPriority(int priority);
boost::shared_ptr<Presence> clone() const {
- return boost::shared_ptr<Presence>(new Presence(*this));
+ return boost::make_shared<Presence>(*this);
}
bool isAvailable() const {
diff --git a/Swiften/Elements/Priority.h b/Swiften/Elements/Priority.h
index 12181d4..2c0cb9b 100644
--- a/Swiften/Elements/Priority.h
+++ b/Swiften/Elements/Priority.h
@@ -6,13 +6,11 @@
#pragma once
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class Priority : public Payload {
public:
- typedef boost::shared_ptr<Priority> ref;
-
Priority(int priority = 0) : priority_(priority) {
}
diff --git a/Swiften/Elements/PrivateStorage.h b/Swiften/Elements/PrivateStorage.h
index 34d9185..a8e1b74 100644
--- a/Swiften/Elements/PrivateStorage.h
+++ b/Swiften/Elements/PrivateStorage.h
@@ -8,7 +8,7 @@
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class PrivateStorage : public Payload {
diff --git a/Swiften/Elements/Replace.h b/Swiften/Elements/Replace.h
new file mode 100644
index 0000000..230bce7
--- /dev/null
+++ b/Swiften/Elements/Replace.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2011 Vlad Voicu
+ * Licensed under the Simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <boost/shared_ptr.hpp>
+#include <string>
+
+#include <Swiften/Elements/Payload.h>
+
+namespace Swift {
+ class Replace : public Payload {
+ public:
+ typedef boost::shared_ptr<Replace> ref;
+ Replace(const std::string& id = std::string()) : replaceID_(id) {};
+ const std::string& getID() const {
+ return replaceID_;
+ }
+ void setID(const std::string& id) {
+ replaceID_ = id;
+ }
+ private:
+ std::string replaceID_;
+ };
+}
diff --git a/Swiften/Elements/ResourceBind.h b/Swiften/Elements/ResourceBind.h
index 3569eb3..f67a995 100644
--- a/Swiften/Elements/ResourceBind.h
+++ b/Swiften/Elements/ResourceBind.h
@@ -4,16 +4,14 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_ResourceBind_H
-#define SWIFTEN_ResourceBind_H
+#pragma once
#include <string>
-#include "Swiften/Elements/Payload.h"
-#include "Swiften/JID/JID.h"
+#include <Swiften/Elements/Payload.h>
+#include <Swiften/JID/JID.h>
namespace Swift {
- class ResourceBind : public Payload
- {
+ class ResourceBind : public Payload {
public:
ResourceBind() {}
@@ -38,5 +36,3 @@ namespace Swift {
std::string resource_;
};
}
-
-#endif
diff --git a/Swiften/Elements/RosterItemExchangePayload.cpp b/Swiften/Elements/RosterItemExchangePayload.cpp
new file mode 100644
index 0000000..abd5296
--- /dev/null
+++ b/Swiften/Elements/RosterItemExchangePayload.cpp
@@ -0,0 +1,18 @@
+/*
+ * Copyright (c) 2011 Jan Kaluza
+ * Licensed under the Simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#include <Swiften/Elements/RosterItemExchangePayload.h>
+#include <Swiften/Base/foreach.h>
+
+namespace Swift {
+
+RosterItemExchangePayload::Item::Item(Action action) : action(action) {
+}
+
+RosterItemExchangePayload::RosterItemExchangePayload() {
+}
+
+}
diff --git a/Swiften/Elements/RosterItemExchangePayload.h b/Swiften/Elements/RosterItemExchangePayload.h
new file mode 100644
index 0000000..f9aa2c8
--- /dev/null
+++ b/Swiften/Elements/RosterItemExchangePayload.h
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2011 Jan Kaluza
+ * Licensed under the Simplified BSD license.
+ * See Documentation/Licenses/BSD-simplified.txt for more information.
+ */
+
+#pragma once
+
+#include <vector>
+#include <string>
+#include <boost/shared_ptr.hpp>
+
+#include <Swiften/Elements/Payload.h>
+#include <Swiften/JID/JID.h>
+
+
+namespace Swift {
+ class RosterItemExchangePayload : public Payload {
+ public:
+ typedef boost::shared_ptr<RosterItemExchangePayload> ref;
+
+ class Item {
+ public:
+ enum Action { Add, Modify, Delete };
+
+ Item(Action action = Add);
+
+ Action getAction() const {
+ return action;
+ }
+
+ void setAction(Action action) {
+ this->action = action;
+ }
+
+ const JID& getJID() const {
+ return jid;
+ }
+
+ void setJID(const JID& jid) {
+ this->jid = jid;
+ }
+
+ const std::string& getName() const {
+ return name;
+ }
+
+ void setName(const std::string& name) {
+ this->name = name;
+ }
+
+ const std::vector<std::string>& getGroups() const {
+ return groups;
+ }
+
+ void setGroups(const std::vector<std::string> &groups) {
+ this->groups = groups;
+ }
+
+ void addGroup(const std::string& group) {
+ groups.push_back(group);
+ }
+
+ private:
+ Action action;
+ JID jid;
+ std::string name;
+ std::vector<std::string> groups;
+ };
+
+ typedef std::vector<RosterItemExchangePayload::Item> RosterItemExchangePayloadItems;
+
+ public:
+ RosterItemExchangePayload();
+
+ void addItem(const RosterItemExchangePayload::Item& item) {
+ items_.push_back(item);
+ }
+
+ const RosterItemExchangePayloadItems& getItems() const {
+ return items_;
+ }
+
+ private:
+ RosterItemExchangePayloadItems items_;
+ };
+}
diff --git a/Swiften/Elements/RosterItemPayload.h b/Swiften/Elements/RosterItemPayload.h
index b8a1b10..915ae31 100644
--- a/Swiften/Elements/RosterItemPayload.h
+++ b/Swiften/Elements/RosterItemPayload.h
@@ -4,22 +4,20 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_RosterItemPayloadPayload_H
-#define SWIFTEN_RosterItemPayloadPayload_H
+#pragma once
#include <vector>
-
-#include "Swiften/JID/JID.h"
#include <string>
+#include <Swiften/JID/JID.h>
+
namespace Swift {
- class RosterItemPayload
- {
+ class RosterItemPayload {
public:
enum Subscription { None, To, From, Both, Remove };
RosterItemPayload() : subscription_(None), ask_(false) {}
- RosterItemPayload(const JID& jid, const std::string& name, Subscription subscription) : jid_(jid), name_(name), subscription_(subscription), ask_(false) { }
+ RosterItemPayload(const JID& jid, const std::string& name, Subscription subscription, const std::vector<std::string>& groups = std::vector<std::string>()) : jid_(jid), name_(name), subscription_(subscription), groups_(groups), ask_(false) { }
void setJID(const JID& jid) { jid_ = jid; }
const JID& getJID() const { return jid_; }
@@ -51,5 +49,3 @@ namespace Swift {
std::string unknownContent_;
};
}
-
-#endif
diff --git a/Swiften/Elements/RosterPayload.cpp b/Swiften/Elements/RosterPayload.cpp
index 5453ae8..6071cbc 100644
--- a/Swiften/Elements/RosterPayload.cpp
+++ b/Swiften/Elements/RosterPayload.cpp
@@ -4,8 +4,8 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Elements/RosterPayload.h"
-#include "Swiften/Base/foreach.h"
+#include <Swiften/Elements/RosterPayload.h>
+#include <Swiften/Base/foreach.h>
namespace Swift {
diff --git a/Swiften/Elements/RosterPayload.h b/Swiften/Elements/RosterPayload.h
index b46b384..c4907cb 100644
--- a/Swiften/Elements/RosterPayload.h
+++ b/Swiften/Elements/RosterPayload.h
@@ -10,8 +10,8 @@
#include <boost/optional.hpp>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/RosterItemPayload.h"
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/RosterItemPayload.h>
+#include <Swiften/Elements/Payload.h>
namespace Swift {
@@ -33,7 +33,16 @@ namespace Swift {
return items_;
}
+ const boost::optional<std::string>& getVersion() const {
+ return version_;
+ }
+
+ void setVersion(const std::string& version) {
+ version_ = version;
+ }
+
private:
RosterItemPayloads items_;
+ boost::optional<std::string> version_;
};
}
diff --git a/Swiften/Elements/SearchPayload.h b/Swiften/Elements/SearchPayload.h
index d6d7ed1..202007b 100644
--- a/Swiften/Elements/SearchPayload.h
+++ b/Swiften/Elements/SearchPayload.h
@@ -9,8 +9,8 @@
#include <boost/shared_ptr.hpp>
#include <boost/optional.hpp>
-#include "Swiften/Elements/Payload.h"
-#include "Swiften/Elements/Form.h"
+#include <Swiften/Elements/Payload.h>
+#include <Swiften/Elements/Form.h>
#include <string>
namespace Swift {
diff --git a/Swiften/Elements/SecurityLabel.h b/Swiften/Elements/SecurityLabel.h
index ca38e32..0487977 100644
--- a/Swiften/Elements/SecurityLabel.h
+++ b/Swiften/Elements/SecurityLabel.h
@@ -4,13 +4,12 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_SecurityLabel_H
-#define SWIFTEN_SecurityLabel_H
+#pragma once
#include <vector>
#include <string>
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class SecurityLabel : public Payload {
@@ -59,5 +58,3 @@ namespace Swift {
std::vector<std::string> equivalentLabels_;
};
}
-
-#endif
diff --git a/Swiften/Elements/SecurityLabelsCatalog.h b/Swiften/Elements/SecurityLabelsCatalog.h
index 10ef459..0f40c13 100644
--- a/Swiften/Elements/SecurityLabelsCatalog.h
+++ b/Swiften/Elements/SecurityLabelsCatalog.h
@@ -4,15 +4,15 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_SecurityLabelsCatalog_H
-#define SWIFTEN_SecurityLabelsCatalog_H
+#pragma once
#include <vector>
-
-#include "Swiften/JID/JID.h"
#include <string>
-#include "Swiften/Elements/Payload.h"
-#include "Swiften/Elements/SecurityLabel.h"
+#include <boost/shared_ptr.hpp>
+
+#include <Swiften/JID/JID.h>
+#include <Swiften/Elements/Payload.h>
+#include <Swiften/Elements/SecurityLabel.h>
namespace Swift {
class SecurityLabelsCatalog : public Payload {
@@ -85,5 +85,3 @@ namespace Swift {
std::vector<Item> items_;
};
}
-
-#endif
diff --git a/Swiften/Elements/SoftwareVersion.h b/Swiften/Elements/SoftwareVersion.h
index 5863b38..c49b47b 100644
--- a/Swiften/Elements/SoftwareVersion.h
+++ b/Swiften/Elements/SoftwareVersion.h
@@ -6,8 +6,10 @@
#pragma once
-#include "Swiften/Elements/Payload.h"
#include <string>
+#include <boost/shared_ptr.hpp>
+
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class SoftwareVersion : public Payload {
diff --git a/Swiften/Elements/Stanza.cpp b/Swiften/Elements/Stanza.cpp
index d15d778..23f2d89 100644
--- a/Swiften/Elements/Stanza.cpp
+++ b/Swiften/Elements/Stanza.cpp
@@ -4,13 +4,18 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Elements/Stanza.h"
-#include "Swiften/Elements/Delay.h"
+#include <Swiften/Elements/Stanza.h>
+#include <Swiften/Elements/Delay.h>
#include <typeinfo>
+#include <Swiften/Base/foreach.h>
+
namespace Swift {
+Stanza::Stanza() {
+}
+
Stanza::~Stanza() {
payloads_.clear();
}
diff --git a/Swiften/Elements/Stanza.h b/Swiften/Elements/Stanza.h
index 9b934e4..9e082cc 100644
--- a/Swiften/Elements/Stanza.h
+++ b/Swiften/Elements/Stanza.h
@@ -7,27 +7,28 @@
#pragma once
#include <vector>
+#include <string>
#include <boost/shared_ptr.hpp>
-#include <boost/optional.hpp>
-#include <boost/date_time/posix_time/posix_time.hpp>
+#include <boost/optional/optional_fwd.hpp>
+#include <boost/date_time/posix_time/ptime.hpp>
-#include "Swiften/Elements/Element.h"
-#include "Swiften/Elements/Payload.h"
-#include <string>
-#include "Swiften/Base/foreach.h"
-#include "Swiften/JID/JID.h"
+#include <Swiften/Elements/Element.h>
+#include <Swiften/JID/JID.h>
namespace Swift {
+ class Payload;
+
class Stanza : public Element {
public:
typedef boost::shared_ptr<Stanza> ref;
+ Stanza();
virtual ~Stanza();
template<typename T>
boost::shared_ptr<T> getPayload() const {
- foreach (const boost::shared_ptr<Payload>& i, payloads_) {
- boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(i));
+ for (size_t i = 0; i < payloads_.size(); ++i) {
+ boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(payloads_[i]));
if (result) {
return result;
}
@@ -38,8 +39,8 @@ namespace Swift {
template<typename T>
std::vector< boost::shared_ptr<T> > getPayloads() const {
std::vector< boost::shared_ptr<T> > results;
- foreach (const boost::shared_ptr<Payload>& i, payloads_) {
- boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(i));
+ for (size_t i = 0; i < payloads_.size(); ++i) {
+ boost::shared_ptr<T> result(boost::dynamic_pointer_cast<T>(payloads_[i]));
if (result) {
results.push_back(result);
}
@@ -78,8 +79,6 @@ namespace Swift {
std::string id_;
JID from_;
JID to_;
-
- typedef std::vector< boost::shared_ptr<Payload> > Payloads;
- Payloads payloads_;
+ std::vector< boost::shared_ptr<Payload> > payloads_;
};
}
diff --git a/Swiften/Elements/StanzaAck.h b/Swiften/Elements/StanzaAck.h
index 8a57442..3aa2dfd 100644
--- a/Swiften/Elements/StanzaAck.h
+++ b/Swiften/Elements/StanzaAck.h
@@ -6,7 +6,7 @@
#pragma once
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
diff --git a/Swiften/Elements/StanzaAckRequest.h b/Swiften/Elements/StanzaAckRequest.h
index 024ebc9..81b3871 100644
--- a/Swiften/Elements/StanzaAckRequest.h
+++ b/Swiften/Elements/StanzaAckRequest.h
@@ -6,7 +6,7 @@
#pragma once
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
diff --git a/Swiften/Elements/StartSession.h b/Swiften/Elements/StartSession.h
index 0586f40..7aeb611 100644
--- a/Swiften/Elements/StartSession.h
+++ b/Swiften/Elements/StartSession.h
@@ -4,11 +4,10 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_StartSession_H
-#define SWIFTEN_StartSession_H
+#pragma once
#include <string>
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class StartSession : public Payload {
@@ -16,5 +15,3 @@ namespace Swift {
StartSession() {}
};
}
-
-#endif
diff --git a/Swiften/Elements/StartTLSFailure.h b/Swiften/Elements/StartTLSFailure.h
index bb70204..5e233fb 100644
--- a/Swiften/Elements/StartTLSFailure.h
+++ b/Swiften/Elements/StartTLSFailure.h
@@ -4,10 +4,9 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_StartTLSFailure_H
-#define SWIFTEN_StartTLSFailure_H
+#pragma once
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
class StartTLSFailure : public Element {
@@ -15,5 +14,3 @@ namespace Swift {
StartTLSFailure() {}
};
}
-
-#endif
diff --git a/Swiften/Elements/StartTLSRequest.h b/Swiften/Elements/StartTLSRequest.h
index 8ce40ec..e284f75 100644
--- a/Swiften/Elements/StartTLSRequest.h
+++ b/Swiften/Elements/StartTLSRequest.h
@@ -4,17 +4,13 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_StartTLSRequest_H
-#define SWIFTEN_StartTLSRequest_H
+#pragma once
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
- class StartTLSRequest : public Element
- {
+ class StartTLSRequest : public Element {
public:
StartTLSRequest() {}
};
}
-
-#endif
diff --git a/Swiften/Elements/Status.h b/Swiften/Elements/Status.h
index 3ef6401..956f33d 100644
--- a/Swiften/Elements/Status.h
+++ b/Swiften/Elements/Status.h
@@ -4,10 +4,9 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_Status_H
-#define SWIFTEN_Status_H
+#pragma once
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
#include <string>
namespace Swift {
@@ -28,5 +27,3 @@ namespace Swift {
std::string text_;
};
}
-
-#endif
diff --git a/Swiften/Elements/StatusShow.cpp b/Swiften/Elements/StatusShow.cpp
new file mode 100644
index 0000000..656e5c4
--- /dev/null
+++ b/Swiften/Elements/StatusShow.cpp
@@ -0,0 +1,12 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Elements/StatusShow.h>
+
+using namespace Swift;
+
+StatusShow::StatusShow(const Type& type) : type_(type) {
+}
diff --git a/Swiften/Elements/StatusShow.h b/Swiften/Elements/StatusShow.h
index a158239..cd3477e 100644
--- a/Swiften/Elements/StatusShow.h
+++ b/Swiften/Elements/StatusShow.h
@@ -4,19 +4,16 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_StatusShow_H
-#define SWIFTEN_StatusShow_H
+#pragma once
-#include "Swiften/Elements/Payload.h"
-#include <string>
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class StatusShow : public Payload {
public:
enum Type { Online, Away, FFC, XA, DND, None };
- StatusShow(const Type& type = Online) : type_(type) {
- }
+ StatusShow(const Type& type = Online);
void setType(const Type& type) {
type_ = type;
@@ -32,19 +29,17 @@ namespace Swift {
*/
static int typeToAvailabilityOrdering(Type type) {
switch (type) {
- case Online: return 4;
- case FFC: return 5;
- case Away: return 2;
- case XA: return 1;
- case DND: return 3;
- case None: return 0;
+ case Online: return 4;
+ case FFC: return 5;
+ case Away: return 2;
+ case XA: return 1;
+ case DND: return 3;
+ case None: return 0;
}
- return -1;
+ return 0;
}
private:
Type type_;
};
}
-
-#endif
diff --git a/Swiften/Elements/Storage.h b/Swiften/Elements/Storage.h
index a2f244c..8118b3b 100644
--- a/Swiften/Elements/Storage.h
+++ b/Swiften/Elements/Storage.h
@@ -8,9 +8,9 @@
#include <vector>
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
#include <string>
-#include "Swiften/JID/JID.h"
+#include <Swiften/JID/JID.h>
namespace Swift {
class Storage : public Payload {
diff --git a/Swiften/Elements/StreamFeatures.cpp b/Swiften/Elements/StreamFeatures.cpp
new file mode 100644
index 0000000..c6f6c04
--- /dev/null
+++ b/Swiften/Elements/StreamFeatures.cpp
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2010 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Elements/StreamFeatures.h>
+
+#include <algorithm>
+
+namespace Swift {
+
+bool StreamFeatures::hasCompressionMethod(const std::string& mechanism) const {
+ return std::find(compressionMethods_.begin(), compressionMethods_.end(), mechanism) != compressionMethods_.end();
+}
+
+bool StreamFeatures::hasAuthenticationMechanism(const std::string& mechanism) const {
+ return std::find(authenticationMechanisms_.begin(), authenticationMechanisms_.end(), mechanism) != authenticationMechanisms_.end();
+}
+
+}
diff --git a/Swiften/Elements/StreamFeatures.h b/Swiften/Elements/StreamFeatures.h
index fbc0bb8..cae5532 100644
--- a/Swiften/Elements/StreamFeatures.h
+++ b/Swiften/Elements/StreamFeatures.h
@@ -7,17 +7,17 @@
#pragma once
#include <vector>
-#include <algorithm>
-
#include <string>
-#include "Swiften/Elements/Element.h"
+#include <boost/shared_ptr.hpp>
+
+#include <Swiften/Elements/Element.h>
namespace Swift {
class StreamFeatures : public Element {
public:
typedef boost::shared_ptr<StreamFeatures> ref;
- StreamFeatures() : hasStartTLS_(false), hasResourceBind_(false), hasSession_(false), hasStreamManagement_(false) {}
+ StreamFeatures() : hasStartTLS_(false), hasResourceBind_(false), hasSession_(false), hasStreamManagement_(false), hasRosterVersioning_(false) {}
void setHasStartTLS() {
hasStartTLS_ = true;
@@ -51,9 +51,7 @@ namespace Swift {
compressionMethods_.push_back(mechanism);
}
- bool hasCompressionMethod(const std::string& mechanism) const {
- return std::find(compressionMethods_.begin(), compressionMethods_.end(), mechanism) != compressionMethods_.end();
- }
+ bool hasCompressionMethod(const std::string& mechanism) const;
const std::vector<std::string>& getAuthenticationMechanisms() const {
return authenticationMechanisms_;
@@ -63,9 +61,7 @@ namespace Swift {
authenticationMechanisms_.push_back(mechanism);
}
- bool hasAuthenticationMechanism(const std::string& mechanism) const {
- return std::find(authenticationMechanisms_.begin(), authenticationMechanisms_.end(), mechanism) != authenticationMechanisms_.end();
- }
+ bool hasAuthenticationMechanism(const std::string& mechanism) const;
bool hasAuthenticationMechanisms() const {
return !authenticationMechanisms_.empty();
@@ -79,6 +75,14 @@ namespace Swift {
hasStreamManagement_ = true;
}
+ bool hasRosterVersioning() const {
+ return hasRosterVersioning_;
+ }
+
+ void setHasRosterVersioning() {
+ hasRosterVersioning_ = true;
+ }
+
private:
bool hasStartTLS_;
std::vector<std::string> compressionMethods_;
@@ -86,5 +90,6 @@ namespace Swift {
bool hasResourceBind_;
bool hasSession_;
bool hasStreamManagement_;
+ bool hasRosterVersioning_;
};
}
diff --git a/Swiften/Elements/StreamInitiation.h b/Swiften/Elements/StreamInitiation.h
index 6217cbb..c1f0b4d 100644
--- a/Swiften/Elements/StreamInitiation.h
+++ b/Swiften/Elements/StreamInitiation.h
@@ -11,7 +11,7 @@
#include <boost/shared_ptr.hpp>
#include <string>
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
#include <Swiften/Elements/StreamInitiationFileInfo.h>
namespace Swift {
diff --git a/Swiften/Elements/StreamManagementEnabled.cpp b/Swiften/Elements/StreamManagementEnabled.cpp
new file mode 100644
index 0000000..bab7516
--- /dev/null
+++ b/Swiften/Elements/StreamManagementEnabled.cpp
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2011 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Elements/StreamManagementEnabled.h>
+
+using namespace Swift;
+
+StreamManagementEnabled::StreamManagementEnabled() {
+}
+
+StreamManagementEnabled::~StreamManagementEnabled() {
+}
diff --git a/Swiften/Elements/StreamManagementEnabled.h b/Swiften/Elements/StreamManagementEnabled.h
index 0c72b84..02e77f3 100644
--- a/Swiften/Elements/StreamManagementEnabled.h
+++ b/Swiften/Elements/StreamManagementEnabled.h
@@ -1,17 +1,39 @@
/*
- * Copyright (c) 2010 Remko Tronçon
+ * Copyright (c) 2010-2011 Remko Tronçon
* Licensed under the GNU General Public License v3.
* See Documentation/Licenses/GPLv3.txt for more information.
*/
#pragma once
-#include "Swiften/Elements/Element.h"
+#include <string>
+#include <Swiften/Elements/Element.h>
namespace Swift {
class StreamManagementEnabled : public Element {
public:
- StreamManagementEnabled() {}
+ StreamManagementEnabled();
+ ~StreamManagementEnabled();
+
+ void setResumeSupported() {
+ resumeSupported = true;
+ }
+
+ bool getResumeSupported() const {
+ return resumeSupported;
+ }
+
+ void setResumeID(const std::string& id) {
+ resumeID = id;
+ }
+
+ const std::string& getResumeID() const {
+ return resumeID;
+ }
+
+ private:
+ bool resumeSupported;
+ std::string resumeID;
};
}
diff --git a/Swiften/Elements/StreamManagementFailed.h b/Swiften/Elements/StreamManagementFailed.h
index 8302c94..7c6d1b7 100644
--- a/Swiften/Elements/StreamManagementFailed.h
+++ b/Swiften/Elements/StreamManagementFailed.h
@@ -6,7 +6,7 @@
#pragma once
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
diff --git a/Swiften/Elements/StreamResume.cpp b/Swiften/Elements/StreamResume.cpp
new file mode 100644
index 0000000..d55ef78
--- /dev/null
+++ b/Swiften/Elements/StreamResume.cpp
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2011 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Elements/StreamResume.h>
+
+using namespace Swift;
+
+StreamResume::StreamResume() {
+}
+
+StreamResume::~StreamResume() {
+}
diff --git a/Swiften/Elements/StreamResume.h b/Swiften/Elements/StreamResume.h
new file mode 100644
index 0000000..aec0909
--- /dev/null
+++ b/Swiften/Elements/StreamResume.h
@@ -0,0 +1,40 @@
+/*
+ * 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 <string>
+#include <boost/optional.hpp>
+
+#include <Swiften/Elements/Element.h>
+
+namespace Swift {
+ class StreamResume : public Element {
+ public:
+ StreamResume();
+ ~StreamResume();
+
+ void setResumeID(const std::string& id) {
+ resumeID = id;
+ }
+
+ const std::string& getResumeID() const {
+ return resumeID;
+ }
+
+ const boost::optional<unsigned int> getHandledStanzasCount() const {
+ return handledStanzasCount;
+ }
+
+ void setHandledStanzasCount(unsigned int i) {
+ handledStanzasCount = i;
+ }
+
+ private:
+ std::string resumeID;
+ boost::optional<unsigned int> handledStanzasCount;
+ };
+}
diff --git a/Swiften/Elements/StreamResumed.cpp b/Swiften/Elements/StreamResumed.cpp
new file mode 100644
index 0000000..552e654
--- /dev/null
+++ b/Swiften/Elements/StreamResumed.cpp
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2011 Remko Tronçon
+ * Licensed under the GNU General Public License v3.
+ * See Documentation/Licenses/GPLv3.txt for more information.
+ */
+
+#include <Swiften/Elements/StreamResumed.h>
+
+using namespace Swift;
+
+StreamResumed::StreamResumed() {
+}
+
+StreamResumed::~StreamResumed() {
+}
diff --git a/Swiften/Elements/StreamResumed.h b/Swiften/Elements/StreamResumed.h
new file mode 100644
index 0000000..cf9a755
--- /dev/null
+++ b/Swiften/Elements/StreamResumed.h
@@ -0,0 +1,40 @@
+/*
+ * 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 <string>
+#include <boost/optional.hpp>
+
+#include <Swiften/Elements/Element.h>
+
+namespace Swift {
+ class StreamResumed : public Element {
+ public:
+ StreamResumed();
+ ~StreamResumed();
+
+ void setResumeID(const std::string& id) {
+ resumeID = id;
+ }
+
+ const std::string& getResumeID() const {
+ return resumeID;
+ }
+
+ const boost::optional<unsigned int> getHandledStanzasCount() const {
+ return handledStanzasCount;
+ }
+
+ void setHandledStanzasCount(unsigned int i) {
+ handledStanzasCount = i;
+ }
+
+ private:
+ std::string resumeID;
+ boost::optional<unsigned int> handledStanzasCount;
+ };
+}
diff --git a/Swiften/Elements/Subject.h b/Swiften/Elements/Subject.h
index 6b5a916..bc757af 100644
--- a/Swiften/Elements/Subject.h
+++ b/Swiften/Elements/Subject.h
@@ -6,7 +6,7 @@
#pragma once
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
#include <string>
namespace Swift {
diff --git a/Swiften/Elements/TLSProceed.h b/Swiften/Elements/TLSProceed.h
index fbcab04..4bd790a 100644
--- a/Swiften/Elements/TLSProceed.h
+++ b/Swiften/Elements/TLSProceed.h
@@ -4,17 +4,13 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_TLSProceed_H
-#define SWIFTEN_TLSProceed_H
+#pragma once
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
- class TLSProceed : public Element
- {
+ class TLSProceed : public Element {
public:
TLSProceed() {}
};
}
-
-#endif
diff --git a/Swiften/Elements/UnitTest/FormTest.cpp b/Swiften/Elements/UnitTest/FormTest.cpp
index de92d70..1134182 100644
--- a/Swiften/Elements/UnitTest/FormTest.cpp
+++ b/Swiften/Elements/UnitTest/FormTest.cpp
@@ -8,7 +8,7 @@
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/Form.h"
+#include <Swiften/Elements/Form.h>
using namespace Swift;
diff --git a/Swiften/Elements/UnitTest/IQTest.cpp b/Swiften/Elements/UnitTest/IQTest.cpp
index c170d61..23255b8 100644
--- a/Swiften/Elements/UnitTest/IQTest.cpp
+++ b/Swiften/Elements/UnitTest/IQTest.cpp
@@ -8,8 +8,8 @@
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <boost/shared_ptr.hpp>
-#include "Swiften/Elements/IQ.h"
-#include "Swiften/Elements/SoftwareVersion.h"
+#include <Swiften/Elements/IQ.h>
+#include <Swiften/Elements/SoftwareVersion.h>
using namespace Swift;
diff --git a/Swiften/Elements/UnitTest/StanzaTest.cpp b/Swiften/Elements/UnitTest/StanzaTest.cpp
index 4020f8b..0319b52 100644
--- a/Swiften/Elements/UnitTest/StanzaTest.cpp
+++ b/Swiften/Elements/UnitTest/StanzaTest.cpp
@@ -7,11 +7,12 @@
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <boost/shared_ptr.hpp>
+#include <boost/date_time/posix_time/posix_time.hpp>
-#include "Swiften/Elements/Stanza.h"
-#include "Swiften/Elements/Payload.h"
-#include "Swiften/Elements/Message.h"
-#include "Swiften/Elements/Delay.h"
+#include <Swiften/Elements/Stanza.h>
+#include <Swiften/Elements/Payload.h>
+#include <Swiften/Elements/Message.h>
+#include <Swiften/Elements/Delay.h>
using namespace Swift;
diff --git a/Swiften/Elements/UnknownElement.h b/Swiften/Elements/UnknownElement.h
index 549a922..100ba92 100644
--- a/Swiften/Elements/UnknownElement.h
+++ b/Swiften/Elements/UnknownElement.h
@@ -4,10 +4,9 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_UnknownElement_H
-#define SWIFTEN_UnknownElement_H
+#pragma once
-#include "Swiften/Elements/Element.h"
+#include <Swiften/Elements/Element.h>
namespace Swift {
class UnknownElement : public Element {
@@ -15,5 +14,3 @@ namespace Swift {
UnknownElement() {}
};
}
-
-#endif
diff --git a/Swiften/Elements/VCard.cpp b/Swiften/Elements/VCard.cpp
index 8262e07..8bf3eb9 100644
--- a/Swiften/Elements/VCard.cpp
+++ b/Swiften/Elements/VCard.cpp
@@ -4,9 +4,9 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#include "Swiften/Elements/VCard.h"
+#include <Swiften/Elements/VCard.h>
-#include "Swiften/Base/foreach.h"
+#include <Swiften/Base/foreach.h>
namespace Swift {
@@ -16,7 +16,7 @@ VCard::EMailAddress VCard::getPreferredEMailAddress() const {
return address;
}
}
- if (emailAddresses_.size() > 0) {
+ if (!emailAddresses_.empty()) {
return emailAddresses_[0];
}
return EMailAddress();
diff --git a/Swiften/Elements/VCard.h b/Swiften/Elements/VCard.h
index d2423e1..f9822c9 100644
--- a/Swiften/Elements/VCard.h
+++ b/Swiften/Elements/VCard.h
@@ -9,8 +9,8 @@
#include <boost/shared_ptr.hpp>
#include <string>
-#include "Swiften/Base/ByteArray.h"
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Base/ByteArray.h>
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class VCard : public Payload {
@@ -60,10 +60,10 @@ namespace Swift {
const std::string& getNickname() const { return nick_; }
void setPhoto(const ByteArray& photo) { photo_ = photo; }
- const ByteArray& getPhoto() { return photo_; }
+ const ByteArray& getPhoto() const { return photo_; }
void setPhotoType(const std::string& photoType) { photoType_ = photoType; }
- const std::string& getPhotoType() { return photoType_; }
+ const std::string& getPhotoType() const { return photoType_; }
const std::string& getUnknownContent() const { return unknownContent_; }
void addUnknownContent(const std::string& c) {
diff --git a/Swiften/Elements/VCardUpdate.h b/Swiften/Elements/VCardUpdate.h
index bbfd31e..782106c 100644
--- a/Swiften/Elements/VCardUpdate.h
+++ b/Swiften/Elements/VCardUpdate.h
@@ -7,7 +7,7 @@
#pragma once
#include <string>
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
namespace Swift {
class VCardUpdate : public Payload {
@@ -15,7 +15,7 @@ namespace Swift {
VCardUpdate(const std::string& photoHash = "") : photoHash_(photoHash) {}
void setPhotoHash(const std::string& photoHash) { photoHash_ = photoHash; }
- const std::string& getPhotoHash() { return photoHash_; }
+ const std::string& getPhotoHash() const { return photoHash_; }
private:
std::string photoHash_;
diff --git a/Swiften/Elements/Version.h b/Swiften/Elements/Version.h
index 0a65573..350fd91 100644
--- a/Swiften/Elements/Version.h
+++ b/Swiften/Elements/Version.h
@@ -4,15 +4,13 @@
* See Documentation/Licenses/GPLv3.txt for more information.
*/
-#ifndef SWIFTEN_STANZAS_VERSION_H
-#define SWIFTEN_STANZAS_VERSION_H
+#pragma once
#include <string>
-#include "Swiften/Elements/Payload.h"
+#include <Swiften/Elements/Payload.h>
namespace Swift {
- class Version : public Payload
- {
+ class Version : public Payload {
public:
Version(const std::string& name = "", const std::string& version = "", const std::string& os = "") : name_(name), version_(version), os_(os) { }
@@ -26,5 +24,3 @@ namespace Swift {
std::string os_;
};
}
-
-#endif