diff options
Diffstat (limited to 'Swiften/Elements')
102 files changed, 1341 insertions, 409 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/BlockListPayload.h b/Swiften/Elements/BlockListPayload.h new file mode 100644 index 0000000..25cb602 --- /dev/null +++ b/Swiften/Elements/BlockListPayload.h @@ -0,0 +1,31 @@ +/* + * 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 <vector> + +#include <Swiften/JID/JID.h> +#include <Swiften/Elements/Payload.h> + +namespace Swift { + class BlockListPayload : public Payload { + public: + BlockListPayload() { + } + + void addItem(const JID& item) { + items.push_back(item); + } + + const std::vector<JID>& getItems() const { + return items; + } + + private: + std::vector<JID> items; + }; +} diff --git a/Swiften/Elements/BlockPayload.h b/Swiften/Elements/BlockPayload.h new file mode 100644 index 0000000..6dd5170 --- /dev/null +++ b/Swiften/Elements/BlockPayload.h @@ -0,0 +1,31 @@ +/* + * 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 <vector> + +#include <Swiften/JID/JID.h> +#include <Swiften/Elements/Payload.h> + +namespace Swift { + class BlockPayload : public Payload { + public: + BlockPayload() { + } + + void addItem(const JID& jid) { + items.push_back(jid); + } + + const std::vector<JID>& getItems() const { + return items; + } + + private: + std::vector<JID> items; + }; +} 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..35d4d04 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,13 @@ 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"); +const std::string DiscoInfo::JingleFeature = std::string("urn:xmpp:jingle:1"); +const std::string DiscoInfo::JingleFTFeature = std::string("urn:xmpp:jingle:apps:file-transfer:3"); +const std::string DiscoInfo::JingleTransportsIBBFeature = std::string("urn:xmpp:jingle:transports:ibb:1"); +const std::string DiscoInfo::JingleTransportsS5BFeature = std::string("urn:xmpp:jingle:transports:s5b:1"); +const std::string DiscoInfo::Bytestream = std::string("http://jabber.org/protocol/bytestreams"); bool DiscoInfo::Identity::operator<(const Identity& other) const { @@ -33,4 +42,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..6d6e722 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,13 @@ 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; + static const std::string JingleFeature; + static const std::string JingleFTFeature; + static const std::string JingleTransportsIBBFeature; + static const std::string JingleTransportsS5BFeature; + static const std::string Bytestream; class Identity { public: @@ -82,9 +87,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..183b8eb 100644 --- a/Swiften/Elements/JingleContent.h +++ b/Swiften/Elements/JingleContentPayload.h @@ -8,20 +8,20 @@ #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 { + UnknownCreator, InitiatorCreator, ResponderCreator, }; @@ -33,10 +33,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 +57,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 +78,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 +92,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/JingleFileTransferDescription.h b/Swiften/Elements/JingleFileTransferDescription.h index 19644bd..04f3f1f 100644 --- a/Swiften/Elements/JingleFileTransferDescription.h +++ b/Swiften/Elements/JingleFileTransferDescription.h @@ -7,7 +7,7 @@ #pragma once #include <boost/shared_ptr.hpp> -#include <boost/optional.hpp> +#include <vector> #include <Swiften/Elements/JingleDescription.h> #include <Swiften/Elements/StreamInitiationFileInfo.h> @@ -17,15 +17,25 @@ namespace Swift { public: typedef boost::shared_ptr<JingleFileTransferDescription> ref; - void setOffer(const StreamInitiationFileInfo& offer) { - this->offer = offer; + void addOffer(const StreamInitiationFileInfo& offer) { + offers.push_back(offer); } + - const boost::optional<StreamInitiationFileInfo>& getOffer() const { - return offer; + const std::vector<StreamInitiationFileInfo>& getOffers() const { + return offers; + } + + void addRequest(const StreamInitiationFileInfo& request) { + reqeusts.push_back(request); + } + + const std::vector<StreamInitiationFileInfo>& getRequests() const { + return reqeusts; } private: - boost::optional<StreamInitiationFileInfo> offer; + std::vector<StreamInitiationFileInfo> offers; + std::vector<StreamInitiationFileInfo> reqeusts; }; } diff --git a/Swiften/Elements/JingleFileTransferHash.h b/Swiften/Elements/JingleFileTransferHash.h new file mode 100644 index 0000000..5603531 --- /dev/null +++ b/Swiften/Elements/JingleFileTransferHash.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2011 Tobias Markmann + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <boost/shared_ptr.hpp> +#include <map> +#include <string> + +#include <Swiften/Elements/JingleDescription.h> + +namespace Swift { + +class JingleFileTransferHash : public Payload { +public: + typedef std::map<std::string, std::string> HashesMap; +public: + typedef boost::shared_ptr<JingleFileTransferHash> ref; + + void setHash(const std::string& algo, const std::string& hash) { + hashes[algo] = hash; + } + + const HashesMap& getHashes() const { + return hashes; + } + +private: + HashesMap hashes; +}; + +} diff --git a/Swiften/Elements/JingleFileTransferReceived.h b/Swiften/Elements/JingleFileTransferReceived.h new file mode 100644 index 0000000..75c95d9 --- /dev/null +++ b/Swiften/Elements/JingleFileTransferReceived.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2011 Tobias Markmann + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <boost/shared_ptr.hpp> +#include <vector> + +#include <Swiften/Elements/StreamInitiationFileInfo.h> +#include <Swiften/Elements/Payload.h> + +namespace Swift { + +class JingleFileTransferReceived : public Payload { + public: + typedef boost::shared_ptr<JingleFileTransferReceived> ref; + + void setFileInfo(const StreamInitiationFileInfo& fileInfo) { + this->fileInfo = fileInfo; + } + + const StreamInitiationFileInfo& getFileInfo() const { + return this->fileInfo; + } + private: + StreamInitiationFileInfo fileInfo; + +}; + +} diff --git a/Swiften/Elements/JingleIBBTransport.h b/Swiften/Elements/JingleIBBTransportPayload.h index faa5af3..8c174f0 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, @@ -25,14 +29,6 @@ namespace Swift { return stanzaType; } - void setSessionID(const std::string& id) { - sessionID = id; - } - - const std::string& getSessionID() const { - return sessionID; - } - int getBlockSize() const { return blockSize; } @@ -42,7 +38,6 @@ namespace Swift { } private: - std::string sessionID; int blockSize; StanzaType stanzaType; }; diff --git a/Swiften/Elements/JinglePayload.h b/Swiften/Elements/JinglePayload.h index 59fba7b..31d4448 100644 --- a/Swiften/Elements/JinglePayload.h +++ b/Swiften/Elements/JinglePayload.h @@ -7,20 +7,23 @@ #pragma once #include <vector> +#include <boost/shared_ptr.hpp> #include <boost/optional.hpp> #include <string> #include <Swiften/JID/JID.h> #include <Swiften/Elements/Payload.h> -#include <Swiften/Elements/JingleContent.h> +#include <Swiften/Elements/JingleContentPayload.h> +#include <Swiften/Base/Log.h> namespace Swift { class JinglePayload : public Payload { public: typedef boost::shared_ptr<JinglePayload> ref; - struct Reason { + struct Reason : public Payload { enum Type { + UnknownType, AlternativeSession, Busy, Cancel, @@ -39,13 +42,15 @@ namespace Swift { UnsupportedApplications, UnsupportedTransports }; - + Reason() : type(UnknownType), text("") {} Reason(Type type, const std::string& text = "") : type(type), text(text) {} + ~Reason() {} Type type; std::string text; }; enum Action { + UnknownAction, ContentAccept, ContentAdd, ContentModify, @@ -62,8 +67,11 @@ namespace Swift { TransportReject, TransportReplace }; - + JinglePayload() : action(SessionTerminate), sessionID("") { + } + JinglePayload(Action action, const std::string& sessionID) : action(action), sessionID(sessionID) { + } void setAction(Action action) { @@ -98,12 +106,47 @@ namespace Swift { return sessionID; } - void addContent(JingleContent::ref content) { - this->contents.push_back(content); + void addContent(JingleContentPayload::ref content) { + this->payloads.push_back(content); + } + + void addPayload(boost::shared_ptr<Payload> payload) { + this->payloads.push_back(payload); + } + + const std::vector<JingleContentPayload::ref> getContents() const { + return getPayloads<JingleContentPayload>(); + } + + const std::vector<boost::shared_ptr<Payload> > getPayloads() const { + return payloads; + } + + template<typename T> + const std::vector<boost::shared_ptr<T> > getPayloads() const { + std::vector<boost::shared_ptr<T> > matched_payloads; + for (std::vector<boost::shared_ptr<Payload> >::const_iterator i = payloads.begin(); i != payloads.end(); ++i) { + boost::shared_ptr<T> result = boost::dynamic_pointer_cast<T>(*i); + if (result) { + matched_payloads.push_back(result); + } + } + + return matched_payloads; + } - const std::vector<JingleContent::ref>& getContents() const { - return contents; + template<typename T> + const boost::shared_ptr<T> getPayload() const { + boost::shared_ptr<T> result; + for (std::vector<boost::shared_ptr<Payload> >::const_iterator i = payloads.begin(); i != payloads.end(); ++i) { + result = boost::dynamic_pointer_cast<T>(*i); + if (result) { + return result; + } + } + + return result; } void setReason(const Reason& reason) { @@ -119,7 +162,7 @@ namespace Swift { JID initiator; JID responder; std::string sessionID; - std::vector<JingleContent::ref> contents; + std::vector<boost::shared_ptr<Payload> > payloads; boost::optional<Reason> reason; }; } diff --git a/Swiften/Elements/JingleS5BTransport.h b/Swiften/Elements/JingleS5BTransport.h deleted file mode 100644 index 4522417..0000000 --- a/Swiften/Elements/JingleS5BTransport.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 <Swiften/Elements/JingleTransport.h> -#include <Swiften/Elements/Bytestreams.h> - -namespace Swift { - class JingleS5BTransport : public JingleTransport { - public: - const Bytestreams& getInfo() const { - return info; - } - - void setInfo(const Bytestreams& info) { - this->info = info; - } - - private: - Bytestreams info; - }; -} diff --git a/Swiften/Elements/JingleS5BTransportPayload.h b/Swiften/Elements/JingleS5BTransportPayload.h new file mode 100644 index 0000000..980af27 --- /dev/null +++ b/Swiften/Elements/JingleS5BTransportPayload.h @@ -0,0 +1,112 @@ +/* + * 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 <vector> + +#include <boost/shared_ptr.hpp> + +#include <Swiften/Elements/JingleTransportPayload.h> +#include <Swiften/Elements/Bytestreams.h> +#include <Swiften/Network/HostAddressPort.h> + + +namespace Swift { + class JingleS5BTransportPayload : public JingleTransportPayload { + public: + enum Mode { + TCPMode, // default case + UDPMode, + }; + + struct Candidate { + enum Type { + DirectType, // default case + AssistedType, + TunnelType, + ProxyType, + }; + + Candidate() : priority(0), type(DirectType) {} + + std::string cid; + JID jid; + HostAddressPort hostPort; + int priority; + Type type; + }; + + struct CompareCandidate { + bool operator() (const JingleS5BTransportPayload::Candidate& c1, const JingleS5BTransportPayload::Candidate& c2) const { + if (c1.priority < c2.priority) return true; + return false; + } + }; + + public: + JingleS5BTransportPayload() : mode(TCPMode), candidateError(false), proxyError(false) {} + + Mode getMode() const { + return mode; + } + + void setMode(Mode mode) { + this->mode = mode; + } + + const std::vector<Candidate>& getCandidates() { + return candidates; + } + + void addCandidate(const Candidate& candidate) { + candidates.push_back(candidate); + } + + void setCandidateUsed(const std::string& cid) { + candidateUsedCID = cid; + } + + const std::string& getCandidateUsed() const { + return candidateUsedCID; + } + + void setActivated(const std::string& cid) { + activatedCID = cid; + } + + const std::string& getActivated() const { + return activatedCID; + } + + void setCandidateError(bool hasError) { + candidateError = hasError; + } + + bool hasCandidateError() const { + return candidateError; + } + + void setProxyError(bool hasError) { + proxyError = hasError; + } + + bool hasProxyError() const { + return proxyError; + } + public: + typedef boost::shared_ptr<JingleS5BTransportPayload> ref; + + private: + Mode mode; + std::vector<Candidate> candidates; + + std::string candidateUsedCID; + std::string activatedCID; + bool candidateError; + bool proxyError; + }; +} diff --git a/Swiften/Elements/JingleTransportPayload.h b/Swiften/Elements/JingleTransportPayload.h new file mode 100644 index 0000000..b870be9 --- /dev/null +++ b/Swiften/Elements/JingleTransportPayload.h @@ -0,0 +1,30 @@ +/* + * 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/Payload.h> + +namespace Swift { + class JingleTransportPayload : public Payload { + public: + void setSessionID(const std::string& id) { + sessionID = id; + } + + const std::string& getSessionID() const { + return sessionID; + } + + public: + typedef boost::shared_ptr<JingleTransportPayload> ref; + + private: + std::string sessionID; + }; +} 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/MUCAdminPayload.h b/Swiften/Elements/MUCAdminPayload.h new file mode 100644 index 0000000..dc09a24 --- /dev/null +++ b/Swiften/Elements/MUCAdminPayload.h @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2010 Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> +#include <string> +#include <vector> + +#include <Swiften/JID/JID.h> +#include <Swiften/Elements/Payload.h> +#include <Swiften/Elements/MUCOccupant.h> +#include <Swiften/Elements/MUCItem.h> + +namespace Swift { + class MUCAdminPayload : public Payload { + public: + typedef boost::shared_ptr<MUCAdminPayload> ref; + + + MUCAdminPayload() { + } + + void addItem(const MUCItem& item) {items_.push_back(item);} + + const std::vector<MUCItem>& getItems() const {return items_;} + + private: + std::vector<MUCItem> items_; + }; +} diff --git a/Swiften/Elements/MUCDestroyPayload.h b/Swiften/Elements/MUCDestroyPayload.h new file mode 100644 index 0000000..f743ad0 --- /dev/null +++ b/Swiften/Elements/MUCDestroyPayload.h @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2011 Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <string> + +#include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> + +namespace Swift { + class MUCDestroyPayload : public Payload { + public: + typedef boost::shared_ptr<MUCDestroyPayload> ref; + + MUCDestroyPayload() { + } + + void setNewVenue(const JID& jid) { + newVenue_ = jid; + } + + const JID& getNewVenue() const { + return newVenue_; + } + + void setReason(const std::string& reason) { + reason_ = reason; + } + + const std::string& getReason() const { + return reason_; + } + + private: + JID newVenue_; + std::string reason_; + }; +} diff --git a/Swiften/Elements/MUCItem.h b/Swiften/Elements/MUCItem.h new file mode 100644 index 0000000..86217ec --- /dev/null +++ b/Swiften/Elements/MUCItem.h @@ -0,0 +1,21 @@ +/* + * 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/MUCOccupant.h> +#include <Swiften/JID/JID.h> +namespace Swift { +struct MUCItem { + MUCItem() {} + boost::optional<JID> realJID; + boost::optional<std::string> nick; + boost::optional<MUCOccupant::Affiliation> affiliation; + boost::optional<MUCOccupant::Role> role; + boost::optional<JID> actor; + boost::optional<std::string> reason; +}; +} 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..5ccc755 100644 --- a/Swiften/Elements/MUCOwnerPayload.h +++ b/Swiften/Elements/MUCOwnerPayload.h @@ -8,7 +8,8 @@ #include <boost/optional.hpp> -#include "Swiften/Elements/Payload.h" +#include <Swiften/Elements/Payload.h> +#include <Swiften/Elements/Form.h> namespace Swift { class MUCOwnerPayload : public Payload { @@ -26,6 +27,10 @@ namespace Swift { payload = p; } + Form::ref getForm() { + return boost::dynamic_pointer_cast<Form>(payload); + } + private: boost::shared_ptr<Payload> 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..c9ea62c 100644 --- a/Swiften/Elements/MUCUserPayload.h +++ b/Swiften/Elements/MUCUserPayload.h @@ -11,25 +11,19 @@ #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> +#include <Swiften/Elements/MUCItem.h> namespace Swift { class MUCUserPayload : public Payload { public: typedef boost::shared_ptr<MUCUserPayload> ref; - struct Item { - Item(MUCOccupant::Affiliation affiliation = MUCOccupant::NoAffiliation, MUCOccupant::Role role = MUCOccupant::NoRole) : affiliation(affiliation), role(role) {} - boost::optional<JID> realJID; - boost::optional<std::string> nick; - MUCOccupant::Affiliation affiliation; - MUCOccupant::Role role; - }; - struct StatusCode { StatusCode() : code(0) {} + StatusCode(int code) : code(code) {} int code; }; @@ -48,16 +42,25 @@ namespace Swift { MUCUserPayload() { } - void addItem(Item item) {items_.push_back(item);} + void addItem(const MUCItem& item) {items_.push_back(item);} void addStatusCode(StatusCode code) {statusCodes_.push_back(code);} - const std::vector<Item>& getItems() const {return items_;} + const std::vector<MUCItem>& getItems() const {return items_;} const std::vector<StatusCode>& getStatusCodes() const {return statusCodes_;} + boost::shared_ptr<Payload> getPayload() const { + return payload_; + } + + void setPayload(boost::shared_ptr<Payload> p) { + payload_ = p; + } + private: - std::vector<Item> items_; + std::vector<MUCItem> items_; std::vector<StatusCode> statusCodes_; + boost::shared_ptr<Payload> payload_; }; } diff --git a/Swiften/Elements/Message.h b/Swiften/Elements/Message.h index a553eb3..3b9145c 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,11 @@ namespace Swift { } void setSubject(const std::string& subject) { - updatePayload(boost::shared_ptr<Subject>(new Subject(subject))); + updatePayload(boost::make_shared<Subject>(subject)); + } + + bool hasSubject() { + return getPayload<Subject>(); } std::string getBody() const { @@ -45,7 +51,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..f994ebc 100644 --- a/Swiften/Elements/Payload.h +++ b/Swiften/Elements/Payload.h @@ -12,7 +12,7 @@ namespace Swift { class Payload { public: typedef boost::shared_ptr<Payload> ref; - + public: 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/S5BProxyRequest.h b/Swiften/Elements/S5BProxyRequest.h new file mode 100644 index 0000000..fcd0cb2 --- /dev/null +++ b/Swiften/Elements/S5BProxyRequest.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2011 Tobias Markmann + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <string> + +#include <boost/optional.hpp> + +#include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> +#include <Swiften/Network/HostAddressPort.h> + +namespace Swift { + +class S5BProxyRequest : public Payload { +public: + typedef boost::shared_ptr<S5BProxyRequest> ref; + +public: + struct StreamHost { + HostAddressPort addressPort; + JID jid; + }; + +public: + const boost::optional<StreamHost>& getStreamHost() const { + return streamHost; + } + + void setStreamHost(const StreamHost& streamHost) { + this->streamHost = boost::optional<StreamHost>(streamHost); + } + + const std::string& getSID() const { + return sid; + } + + void setSID(const std::string& sid) { + this->sid = sid; + } + + const boost::optional<JID>& getActivate() const { + return activate; + } + + void setActivate(const JID& activate) { + this->activate = activate; + } + +private: + boost::optional<StreamHost> streamHost; + + std::string sid; + boost::optional<JID> activate; +}; + +} 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/StreamInitiationFileInfo.h b/Swiften/Elements/StreamInitiationFileInfo.h index 92b9824..9484bc0 100644 --- a/Swiften/Elements/StreamInitiationFileInfo.h +++ b/Swiften/Elements/StreamInitiationFileInfo.h @@ -6,14 +6,97 @@ #pragma once +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> +#include <boost/date_time/posix_time/posix_time_types.hpp> + #include <string> namespace Swift { - struct StreamInitiationFileInfo { - StreamInitiationFileInfo(const std::string& name = "", const std::string& description = "", int size = -1) : name(name), description(description), size(size) {} - std::string name; - std::string description; - int size; - }; +class StreamInitiationFileInfo : public Payload { +public: + typedef boost::shared_ptr<StreamInitiationFileInfo> ref; + +public: + StreamInitiationFileInfo(const std::string& name = "", const std::string& description = "", int size = 0, + const std::string& hash = "", const boost::posix_time::ptime &date = boost::posix_time::ptime(), const std::string& algo="md5") : + name(name), description(description), size(size), hash(hash), date(date), algo(algo), supportsRangeRequests(false), rangeOffset(0) {} + + void setName(const std::string& name) { + this->name = name;; + } + + const std::string& getName() const { + return this->name; + } + + void setDescription(const std::string& description) { + this->description = description; + } + + const std::string& getDescription() const { + return this->description; + } + + void setSize(const boost::uintmax_t size) { + this->size = size; + } + + boost::uintmax_t getSize() const { + return this->size; + } + + void setHash(const std::string& hash) { + this->hash = hash; + } + + const std::string& getHash() const { + return this->hash; + } + + void setDate(const boost::posix_time::ptime& date) { + this->date = date; + } + + const boost::posix_time::ptime& getDate() const { + return this->date; + } + + void setAlgo(const std::string& algo) { + this->algo = algo; + } + + const std::string& getAlgo() const { + return this->algo; + } + + void setSupportsRangeRequests(const bool supportsIt) { + supportsRangeRequests = supportsIt; + } + + bool getSupportsRangeRequests() const { + return supportsRangeRequests; + } + + void setRangeOffset(const int offset) { + supportsRangeRequests = offset >= 0 ? true : false; + rangeOffset = offset; + } + + int getRangeOffset() const { + return rangeOffset; + } + +private: + std::string name; + std::string description; + boost::uintmax_t size; + std::string hash; + boost::posix_time::ptime date; + std::string algo; + bool supportsRangeRequests; + boost::uintmax_t rangeOffset; +}; + } 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/JingleTransport.h b/Swiften/Elements/StreamResume.cpp index ecd2a34..d55ef78 100644 --- a/Swiften/Elements/JingleTransport.h +++ b/Swiften/Elements/StreamResume.cpp @@ -4,11 +4,12 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#pragma once +#include <Swiften/Elements/StreamResume.h> -#include <Swiften/Elements/Payload.h> +using namespace Swift; -namespace Swift { - class JingleTransport : public Payload { - }; +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/UnblockPayload.h b/Swiften/Elements/UnblockPayload.h new file mode 100644 index 0000000..b6593ab --- /dev/null +++ b/Swiften/Elements/UnblockPayload.h @@ -0,0 +1,31 @@ +/* + * 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 <vector> + +#include <Swiften/JID/JID.h> +#include <Swiften/Elements/Payload.h> + +namespace Swift { + class UnblockPayload : public Payload { + public: + UnblockPayload() { + } + + void addItem(const JID& item) { + items.push_back(item); + } + + const std::vector<JID>& getItems() const { + return items; + } + + private: + std::vector<JID> items; + }; +} 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 |