diff options
Diffstat (limited to 'Swiften/Elements')
181 files changed, 4767 insertions, 232 deletions
diff --git a/Swiften/Elements/AuthChallenge.h b/Swiften/Elements/AuthChallenge.h index f7f2796..6332d69 100644 --- a/Swiften/Elements/AuthChallenge.h +++ b/Swiften/Elements/AuthChallenge.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -10,8 +10,8 @@ #include <vector> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class AuthChallenge : public Element { + class AuthChallenge : public ToplevelElement { public: AuthChallenge() { diff --git a/Swiften/Elements/AuthFailure.h b/Swiften/Elements/AuthFailure.h index ac40956..5088dcf 100644 --- a/Swiften/Elements/AuthFailure.h +++ b/Swiften/Elements/AuthFailure.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -9,8 +9,8 @@ #include <boost/shared_ptr.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class AuthFailure : public Element { + class AuthFailure : public ToplevelElement { public: typedef boost::shared_ptr<AuthFailure> ref; diff --git a/Swiften/Elements/AuthRequest.h b/Swiften/Elements/AuthRequest.h index bfc86c2..bc88b9b 100644 --- a/Swiften/Elements/AuthRequest.h +++ b/Swiften/Elements/AuthRequest.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -11,9 +11,9 @@ #include <boost/optional.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Base/SafeByteArray.h> namespace Swift { - class AuthRequest : public Element { + class AuthRequest : public ToplevelElement { public: AuthRequest(const std::string& mechanism = "") : mechanism_(mechanism) { diff --git a/Swiften/Elements/AuthResponse.h b/Swiften/Elements/AuthResponse.h index db2dcea..f8a075c 100644 --- a/Swiften/Elements/AuthResponse.h +++ b/Swiften/Elements/AuthResponse.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -10,9 +10,9 @@ #include <boost/optional.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/Base/SafeByteArray.h> namespace Swift { - class AuthResponse : public Element { + class AuthResponse : public ToplevelElement { public: AuthResponse() { diff --git a/Swiften/Elements/AuthSuccess.h b/Swiften/Elements/AuthSuccess.h index 3c0f329..8e4591c 100644 --- a/Swiften/Elements/AuthSuccess.h +++ b/Swiften/Elements/AuthSuccess.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -10,8 +10,8 @@ #include <boost/optional.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class AuthSuccess : public Element { + class AuthSuccess : public ToplevelElement { public: AuthSuccess() {} diff --git a/Swiften/Elements/BlockListPayload.h b/Swiften/Elements/BlockListPayload.h index 25cb602..49df75f 100644 --- a/Swiften/Elements/BlockListPayload.h +++ b/Swiften/Elements/BlockListPayload.h @@ -15,5 +15,5 @@ namespace Swift { class BlockListPayload : public Payload { public: - BlockListPayload() { + BlockListPayload(const std::vector<JID>& items = std::vector<JID>()) : items(items) { } diff --git a/Swiften/Elements/BlockPayload.h b/Swiften/Elements/BlockPayload.h index 6dd5170..49a0463 100644 --- a/Swiften/Elements/BlockPayload.h +++ b/Swiften/Elements/BlockPayload.h @@ -15,5 +15,5 @@ namespace Swift { class BlockPayload : public Payload { public: - BlockPayload() { + BlockPayload(const std::vector<JID>& jids = std::vector<JID>()) : items(jids) { } diff --git a/Swiften/Elements/Command.h b/Swiften/Elements/Command.h index 91ae5a3..5454d8d 100644 --- a/Swiften/Elements/Command.h +++ b/Swiften/Elements/Command.h @@ -27,5 +27,5 @@ namespace Swift { enum Type {Info, Warn, Error}; - Note(std::string note, Type type) : note(note), type(type) {}; + Note(std::string note, Type type) : note(note), type(type) {} std::string note; diff --git a/Swiften/Elements/ComponentHandshake.h b/Swiften/Elements/ComponentHandshake.h index 5992b8c..b2f9b21 100644 --- a/Swiften/Elements/ComponentHandshake.h +++ b/Swiften/Elements/ComponentHandshake.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -10,8 +10,8 @@ #include <string> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class ComponentHandshake : public Element { + class ComponentHandshake : public ToplevelElement { public: typedef boost::shared_ptr<ComponentHandshake> ref; diff --git a/Swiften/Elements/CompressFailure.h b/Swiften/Elements/CompressFailure.h index 7dd8867..75e1d1d 100644 --- a/Swiften/Elements/CompressFailure.h +++ b/Swiften/Elements/CompressFailure.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -8,8 +8,8 @@ -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class CompressFailure : public Element { + class CompressFailure : public ToplevelElement { public: CompressFailure() {} diff --git a/Swiften/Elements/CompressRequest.h b/Swiften/Elements/CompressRequest.h index b6fcc64..9e2e267 100644 --- a/Swiften/Elements/CompressRequest.h +++ b/Swiften/Elements/CompressRequest.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -7,8 +7,8 @@ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class CompressRequest : public Element + class CompressRequest : public ToplevelElement { public: diff --git a/Swiften/Elements/Compressed.h b/Swiften/Elements/Compressed.h index 2affec5..f593412 100644 --- a/Swiften/Elements/Compressed.h +++ b/Swiften/Elements/Compressed.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -7,8 +7,8 @@ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class Compressed : public Element { + class Compressed : public ToplevelElement { public: Compressed() {} diff --git a/Swiften/Elements/ContainerPayload.h b/Swiften/Elements/ContainerPayload.h new file mode 100644 index 0000000..e2a4682 --- /dev/null +++ b/Swiften/Elements/ContainerPayload.h @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> +#include <vector> + +namespace Swift { + template<typename T> + class SWIFTEN_API ContainerPayload : public Payload { + public: + ContainerPayload() {} + ContainerPayload(boost::shared_ptr<T> payload) : payload(payload) {} + + void setPayload(boost::shared_ptr<T> payload) { + this->payload = payload; + } + + boost::shared_ptr<T> getPayload() const { + return payload; + } + + private: + boost::shared_ptr<T> payload; + }; +} diff --git a/Swiften/Elements/Delay.h b/Swiften/Elements/Delay.h index f7c4570..f4376dc 100644 --- a/Swiften/Elements/Delay.h +++ b/Swiften/Elements/Delay.h @@ -16,12 +16,12 @@ namespace Swift { class Delay : public Payload { public: - Delay() {}; - Delay(const boost::posix_time::ptime& time, const JID& from = JID()) : time_(time), from_(from) {}; + Delay() {} + Delay(const boost::posix_time::ptime& time, const JID& from = JID()) : time_(time), from_(from) {} - const boost::posix_time::ptime& getStamp() const {return time_;}; - void setStamp(const boost::posix_time::ptime& time) {time_ = time;}; + const boost::posix_time::ptime& getStamp() const {return time_;} + void setStamp(const boost::posix_time::ptime& time) {time_ = time;} - const boost::optional<JID>& getFrom() const {return from_;}; - void setFrom(const JID& from) {from_ = from;}; + const boost::optional<JID>& getFrom() const {return from_;} + void setFrom(const JID& from) {from_ = from;} private: diff --git a/Swiften/Elements/DiscoInfo.cpp b/Swiften/Elements/DiscoInfo.cpp index a4ce079..f353c42 100644 --- a/Swiften/Elements/DiscoInfo.cpp +++ b/Swiften/Elements/DiscoInfo.cpp @@ -23,4 +23,6 @@ const std::string DiscoInfo::JingleTransportsS5BFeature = std::string("urn:xmpp: const std::string DiscoInfo::Bytestream = std::string("http://jabber.org/protocol/bytestreams"); const std::string DiscoInfo::MessageDeliveryReceiptsFeature = std::string("urn:xmpp:receipts"); +const std::string DiscoInfo::WhiteboardFeature = std::string("http://swift.im/whiteboard"); +const std::string DiscoInfo::BlockingCommandFeature = std::string("urn:xmpp:blocking"); bool DiscoInfo::Identity::operator<(const Identity& other) const { diff --git a/Swiften/Elements/DiscoInfo.h b/Swiften/Elements/DiscoInfo.h index fec60d6..3701096 100644 --- a/Swiften/Elements/DiscoInfo.h +++ b/Swiften/Elements/DiscoInfo.h @@ -10,4 +10,5 @@ #include <string> +#include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> #include <Swiften/Elements/Form.h> @@ -17,5 +18,5 @@ namespace Swift { * disco#info from XEP-0030 */ - class DiscoInfo : public Payload { + class SWIFTEN_API DiscoInfo : public Payload { public: typedef boost::shared_ptr<DiscoInfo> ref; @@ -33,4 +34,6 @@ namespace Swift { static const std::string Bytestream; static const std::string MessageDeliveryReceiptsFeature; + static const std::string WhiteboardFeature; + static const std::string BlockingCommandFeature; class Identity { diff --git a/Swiften/Elements/Element.cpp b/Swiften/Elements/Element.cpp index 94829ba..6014ea2 100644 --- a/Swiften/Elements/Element.cpp +++ b/Swiften/Elements/Element.cpp @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. diff --git a/Swiften/Elements/Element.h b/Swiften/Elements/Element.h index 1e6a9d0..6bcf93e 100644 --- a/Swiften/Elements/Element.h +++ b/Swiften/Elements/Element.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -7,8 +7,14 @@ #pragma once +#include <Swiften/Base/API.h> + namespace Swift { - class Element { + class SWIFTEN_API Element { public: + Element() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Element) virtual ~Element(); + + SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(Element) }; } diff --git a/Swiften/Elements/EnableStreamManagement.h b/Swiften/Elements/EnableStreamManagement.h index 15a091e..732b225 100644 --- a/Swiften/Elements/EnableStreamManagement.h +++ b/Swiften/Elements/EnableStreamManagement.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -7,9 +7,9 @@ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class EnableStreamManagement : public Element { + class EnableStreamManagement : public ToplevelElement { public: EnableStreamManagement() {} diff --git a/Swiften/Elements/Form.cpp b/Swiften/Elements/Form.cpp index cf9ecf6..4915e2a 100644 --- a/Swiften/Elements/Form.cpp +++ b/Swiften/Elements/Form.cpp @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -12,6 +12,8 @@ namespace Swift { std::string Form::getFormType() const { FormField::ref field = getField("FORM_TYPE"); - boost::shared_ptr<HiddenFormField> f = boost::dynamic_pointer_cast<HiddenFormField>(field); - return (f ? f->getValue() : ""); + if (field && field->getType() == FormField::HiddenType) { + return field->getValues().empty() ? "" : field->getValues()[0]; + } + return ""; } @@ -41,3 +43,23 @@ const std::vector<Form::FormItem>& Form::getItems() const { } +void Form::clearEmptyTextFields() { + std::vector<FormField::ref> populatedFields; + foreach (FormField::ref field, fields_) { + if (field->getType() == FormField::TextSingleType) { + if (!field->getTextSingleValue().empty()) { + populatedFields.push_back(field); + } + } + else if (field->getType() == FormField::TextMultiType) { + if (!field->getTextMultiValue().empty()) { + populatedFields.push_back(field); + } + } + else { + populatedFields.push_back(field); + } + } + fields_ = populatedFields; +} + } diff --git a/Swiften/Elements/Form.h b/Swiften/Elements/Form.h index 2c6f963..16cef98 100644 --- a/Swiften/Elements/Form.h +++ b/Swiften/Elements/Form.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Kevin Smith + * Copyright (c) 2010-2014 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -10,4 +10,5 @@ #include <string> +#include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> #include <Swiften/Elements/FormField.h> @@ -20,5 +21,5 @@ namespace Swift { * the strange multi-value instead of newline thing by transforming them. */ - class Form : public Payload { + class SWIFTEN_API Form : public Payload { public: typedef boost::shared_ptr<Form> ref; @@ -35,4 +36,5 @@ namespace Swift { void addField(boost::shared_ptr<FormField> field) {assert(field); fields_.push_back(field); } const std::vector<boost::shared_ptr<FormField> >& getFields() const { return fields_; } + void clearFields() { fields_.clear(); } void setTitle(const std::string& title) { title_ = title; } const std::string& getTitle() const { return title_; } @@ -50,7 +52,12 @@ namespace Swift { void addReportedField(FormField::ref field); const std::vector<FormField::ref>& getReportedFields() const; + void clearReportedFields() { reportedFields_.clear(); } void addItem(const FormItem& item); const std::vector<FormItem>& getItems() const; + void clearItems() { items_.clear(); } + + void clearEmptyTextFields(); + private: std::vector<boost::shared_ptr<FormField> > fields_; diff --git a/Swiften/Elements/FormField.cpp b/Swiften/Elements/FormField.cpp new file mode 100644 index 0000000..e9e4f77 --- /dev/null +++ b/Swiften/Elements/FormField.cpp @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#include <Swiften/Elements/FormField.h> + +#include <boost/algorithm/string/split.hpp> +#include <boost/algorithm/string/join.hpp> +#include <boost/algorithm/string/classification.hpp> + +using namespace Swift; + +FormField::~FormField() { +} + +std::string FormField::getTextMultiValue() const { + assert(type == TextMultiType || type == UnknownType); + return boost::algorithm::join(values, "\n"); +} + +void FormField::setTextMultiValue(const std::string& value) { + assert(type == TextMultiType || type == UnknownType); + values.clear(); + boost::split(values, value, boost::is_any_of("\n")); +} + +void FormField::setBoolValue(bool b) { + values.clear(); + values.push_back(b ? "1" : "0"); +} diff --git a/Swiften/Elements/FormField.h b/Swiften/Elements/FormField.h index e8fe3a0..f0bebd9 100644 --- a/Swiften/Elements/FormField.h +++ b/Swiften/Elements/FormField.h @@ -1,11 +1,8 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2013 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ -// FIXME: We currently keep 2 values: the raw values, and the actual value. -// We should only store the raw values, and deduce the actual values from this - #pragma once @@ -21,5 +18,23 @@ namespace Swift { typedef boost::shared_ptr<FormField> ref; - virtual ~FormField() {} + enum Type { + UnknownType, + BooleanType, + FixedType, + HiddenType, + ListSingleType, + TextMultiType, + TextPrivateType, + TextSingleType, + JIDSingleType, + JIDMultiType, + ListMultiType + }; + + FormField(Type type = UnknownType) : type(type), required(false) {} + FormField(Type type, const std::string& value) : type(type), required(false) { + addValue(value); + } + virtual ~FormField(); struct Option { @@ -49,66 +64,75 @@ namespace Swift { } - const std::vector<std::string>& getRawValues() const { - return rawValues; + void clearOptions() { + options.clear(); } - void addRawValue(const std::string& value) { - rawValues.push_back(value); + const std::vector<std::string>& getValues() const { + return values; } - protected: - FormField() : required(false) {} + void addValue(const std::string& value) { + values.push_back(value); + } - private: - std::string name; - std::string label; - std::string description; - bool required; - std::vector<Option> options; - std::vector<std::string> rawValues; - }; + Type getType() const { + return type; + } - template<typename T> class GenericFormField : public FormField { - public: - const T& getValue() const { - return value; + void setType(Type type) { + this->type = type; + } + + // Type specific + + bool getBoolValue() const { + assert(type == BooleanType || type == UnknownType); + if (values.empty()) { + return false; + } + return values[0] == "true" || values[0] == "1"; + } + + void setBoolValue(bool b); + + JID getJIDSingleValue() const { + assert(type == JIDSingleType || type == UnknownType); + return values.empty() ? JID() : JID(values[0]); + } + + JID getJIDMultiValue(size_t index) const { + assert(type == JIDMultiType || type == UnknownType); + return values.empty() ? JID() : JID(values[index]); + } + + std::string getTextPrivateValue() const { + assert(type == TextPrivateType || type == UnknownType); + return values.empty() ? "" : values[0]; + } + + std::string getFixedValue() const { + assert(type == FixedType || type == UnknownType); + return values.empty() ? "" : values[0]; } - void setValue(const T& value) { - this->value = value; + std::string getTextSingleValue() const { + assert(type == TextSingleType || type == UnknownType); + return values.empty() ? "" : values[0]; } + std::string getTextMultiValue() const; + void setTextMultiValue(const std::string& value); + protected: - GenericFormField() : value() {} - GenericFormField(const T& value) : value(value) {} private: - T value; - }; - -#define SWIFTEN_DECLARE_FORM_FIELD(name, valueType) \ - class name##FormField : public GenericFormField< valueType > { \ - public: \ - typedef boost::shared_ptr<name##FormField> ref; \ - static ref create(const valueType& value) { \ - return ref(new name##FormField(value)); \ - } \ - static ref create() { \ - return ref(new name##FormField()); \ - } \ - private: \ - name##FormField(valueType value) : GenericFormField< valueType >(value) {} \ - name##FormField() : GenericFormField< valueType >() {} \ + Type type; + std::string name; + std::string label; + std::string description; + bool required; + std::vector<Option> options; + std::vector<std::string> values; }; - SWIFTEN_DECLARE_FORM_FIELD(Boolean, bool); - SWIFTEN_DECLARE_FORM_FIELD(Fixed, std::string); - SWIFTEN_DECLARE_FORM_FIELD(Hidden, std::string); - SWIFTEN_DECLARE_FORM_FIELD(ListSingle, std::string); - SWIFTEN_DECLARE_FORM_FIELD(TextMulti, std::string); - SWIFTEN_DECLARE_FORM_FIELD(TextPrivate, std::string); - SWIFTEN_DECLARE_FORM_FIELD(TextSingle, std::string); - SWIFTEN_DECLARE_FORM_FIELD(JIDSingle, JID); - SWIFTEN_DECLARE_FORM_FIELD(JIDMulti, std::vector<JID>); - SWIFTEN_DECLARE_FORM_FIELD(ListMulti, std::vector<std::string>); } diff --git a/Swiften/Elements/Forwarded.cpp b/Swiften/Elements/Forwarded.cpp new file mode 100644 index 0000000..590c1ca --- /dev/null +++ b/Swiften/Elements/Forwarded.cpp @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/Forwarded.h> + +using namespace Swift; + +Forwarded::~Forwarded() { +} diff --git a/Swiften/Elements/Forwarded.h b/Swiften/Elements/Forwarded.h new file mode 100644 index 0000000..f1a718c --- /dev/null +++ b/Swiften/Elements/Forwarded.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <boost/optional.hpp> +#include <boost/date_time/posix_time/posix_time.hpp> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> + +namespace Swift { + class Delay; + class Stanza; + + class SWIFTEN_API Forwarded : public Payload { + public: + virtual ~Forwarded(); + + void setDelay(boost::shared_ptr<Delay> delay) { delay_ = delay; } + const boost::shared_ptr<Delay>& getDelay() const { return delay_; } + + void setStanza(boost::shared_ptr<Stanza> stanza) { stanza_ = stanza; } + const boost::shared_ptr<Stanza>& getStanza() const { return stanza_; } + + private: + boost::shared_ptr<Delay> delay_; + boost::shared_ptr<Stanza> stanza_; + }; +} diff --git a/Swiften/Elements/IBB.h b/Swiften/Elements/IBB.h index 64c9f14..fb33eaf 100644 --- a/Swiften/Elements/IBB.h +++ b/Swiften/Elements/IBB.h @@ -22,9 +22,9 @@ namespace Swift { Open, Close, - Data, + Data }; enum StanzaType { IQStanza, - MessageStanza, + MessageStanza }; diff --git a/Swiften/Elements/IQ.cpp b/Swiften/Elements/IQ.cpp index 8e6d7cc..8c0f692 100644 --- a/Swiften/Elements/IQ.cpp +++ b/Swiften/Elements/IQ.cpp @@ -45,18 +45,22 @@ 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::createError(const JID& to, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type, boost::shared_ptr<Payload> payload) { boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(IQ::Error); iq->setTo(to); iq->setID(id); - iq->addPayload(boost::make_shared<Swift::ErrorPayload>(condition, type)); + boost::shared_ptr<ErrorPayload> errorPayload = boost::make_shared<Swift::ErrorPayload>(condition, type); + errorPayload->setPayload(payload); + iq->addPayload(errorPayload); 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::createError(const JID& to, const JID& from, const std::string& id, ErrorPayload::Condition condition, ErrorPayload::Type type, boost::shared_ptr<Payload> payload) { boost::shared_ptr<IQ> iq = boost::make_shared<IQ>(IQ::Error); iq->setTo(to); iq->setFrom(from); iq->setID(id); - iq->addPayload(boost::make_shared<Swift::ErrorPayload>(condition, type)); + boost::shared_ptr<ErrorPayload> errorPayload = boost::make_shared<Swift::ErrorPayload>(condition, type); + errorPayload->setPayload(payload); + iq->addPayload(errorPayload); return iq; } diff --git a/Swiften/Elements/IQ.h b/Swiften/Elements/IQ.h index 05cd96a..ff978b3 100644 --- a/Swiften/Elements/IQ.h +++ b/Swiften/Elements/IQ.h @@ -9,9 +9,10 @@ #include <boost/shared_ptr.hpp> +#include <Swiften/Base/API.h> #include <Swiften/Elements/Stanza.h> #include <Swiften/Elements/ErrorPayload.h> namespace Swift { - class IQ : public Stanza { + class SWIFTEN_API IQ : public Stanza { public: typedef boost::shared_ptr<IQ> ref; @@ -42,5 +43,6 @@ namespace Swift { const std::string& id, ErrorPayload::Condition condition = ErrorPayload::BadRequest, - ErrorPayload::Type type = ErrorPayload::Cancel); + ErrorPayload::Type type = ErrorPayload::Cancel, + boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()); static boost::shared_ptr<IQ> createError( const JID& to, @@ -48,5 +50,6 @@ namespace Swift { const std::string& id, ErrorPayload::Condition condition = ErrorPayload::BadRequest, - ErrorPayload::Type type = ErrorPayload::Cancel); + ErrorPayload::Type type = ErrorPayload::Cancel, + boost::shared_ptr<Payload> payload = boost::shared_ptr<Payload>()); private: diff --git a/Swiften/Elements/Idle.h b/Swiften/Elements/Idle.h new file mode 100644 index 0000000..572eba2 --- /dev/null +++ b/Swiften/Elements/Idle.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013 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 <boost/date_time/posix_time/posix_time_types.hpp> + +#include <Swiften/Elements/Payload.h> + +namespace Swift { + + class Idle : public Payload { + public: + typedef boost::shared_ptr<Idle> ref; + + public: + Idle() {} + Idle(boost::posix_time::ptime since) : since_(since) { + } + + void setSince(boost::posix_time::ptime since) { + since_ = since; + } + + boost::posix_time::ptime getSince() const { + return since_; + } + + private: + boost::posix_time::ptime since_; + }; + +} diff --git a/Swiften/Elements/IsodeIQDelegation.cpp b/Swiften/Elements/IsodeIQDelegation.cpp new file mode 100644 index 0000000..ce13e2a --- /dev/null +++ b/Swiften/Elements/IsodeIQDelegation.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2014 Remko Tronçon and Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/IsodeIQDelegation.h> + +using namespace Swift; + +IsodeIQDelegation::IsodeIQDelegation() { +} + +IsodeIQDelegation::~IsodeIQDelegation() { +} diff --git a/Swiften/Elements/IsodeIQDelegation.h b/Swiften/Elements/IsodeIQDelegation.h new file mode 100644 index 0000000..7935a4f --- /dev/null +++ b/Swiften/Elements/IsodeIQDelegation.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2014 Remko Tronçon and Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> + +#include <Swiften/Elements/Forwarded.h> + +namespace Swift { + class SWIFTEN_API IsodeIQDelegation : public Payload { + public: + + IsodeIQDelegation(); + + virtual ~IsodeIQDelegation(); + + boost::shared_ptr<Forwarded> getForward() const { + return forward; + } + + void setForward(boost::shared_ptr<Forwarded> value) { + this->forward = value ; + } + + + private: + boost::shared_ptr<Forwarded> forward; + }; +} diff --git a/Swiften/Elements/JingleContentPayload.h b/Swiften/Elements/JingleContentPayload.h index 183b8eb..ac62866 100644 --- a/Swiften/Elements/JingleContentPayload.h +++ b/Swiften/Elements/JingleContentPayload.h @@ -24,7 +24,10 @@ namespace Swift { UnknownCreator, InitiatorCreator, - ResponderCreator, + ResponderCreator }; + JingleContentPayload() : creator(UnknownCreator) { + } + /*enum Senders { NoSenders, diff --git a/Swiften/Elements/JingleIBBTransportPayload.h b/Swiften/Elements/JingleIBBTransportPayload.h index 8c174f0..5704c00 100644 --- a/Swiften/Elements/JingleIBBTransportPayload.h +++ b/Swiften/Elements/JingleIBBTransportPayload.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -8,4 +8,5 @@ #include <boost/shared_ptr.hpp> +#include <boost/optional.hpp> #include <string> @@ -19,7 +20,10 @@ namespace Swift { enum StanzaType { IQStanza, - MessageStanza, + MessageStanza }; + JingleIBBTransportPayload() : stanzaType(IQStanza) { + } + void setStanzaType(StanzaType stanzaType) { this->stanzaType = stanzaType; @@ -30,14 +34,14 @@ namespace Swift { } - int getBlockSize() const { + boost::optional<unsigned int> getBlockSize() const { return blockSize; } - void setBlockSize(int blockSize) { + void setBlockSize(unsigned int blockSize) { this->blockSize = blockSize; } private: - int blockSize; + boost::optional<unsigned int> blockSize; StanzaType stanzaType; }; diff --git a/Swiften/Elements/JinglePayload.h b/Swiften/Elements/JinglePayload.h index 31d4448..7d7160b 100644 --- a/Swiften/Elements/JinglePayload.h +++ b/Swiften/Elements/JinglePayload.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -12,10 +12,9 @@ #include <string> +#include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> #include <Swiften/Elements/Payload.h> #include <Swiften/Elements/JingleContentPayload.h> -#include <Swiften/Base/Log.h> - namespace Swift { class JinglePayload : public Payload { @@ -45,5 +44,4 @@ namespace Swift { Reason() : type(UnknownType), text("") {} Reason(Type type, const std::string& text = "") : type(type), text(text) {} - ~Reason() {} Type type; std::string text; diff --git a/Swiften/Elements/JingleS5BTransportPayload.h b/Swiften/Elements/JingleS5BTransportPayload.h index 995933c..41bf809 100644 --- a/Swiften/Elements/JingleS5BTransportPayload.h +++ b/Swiften/Elements/JingleS5BTransportPayload.h @@ -21,5 +21,5 @@ namespace Swift { enum Mode { TCPMode, // default case - UDPMode, + UDPMode }; @@ -29,5 +29,5 @@ namespace Swift { AssistedType, TunnelType, - ProxyType, + ProxyType }; diff --git a/Swiften/Elements/Last.h b/Swiften/Elements/Last.h index fe0323a..cb7e0c6 100644 --- a/Swiften/Elements/Last.h +++ b/Swiften/Elements/Last.h @@ -12,5 +12,5 @@ namespace Swift { class Last : public Payload { public: - Last(int seconds = 0) : seconds_(seconds) {}; + Last(int seconds = 0) : seconds_(seconds) {} int getSeconds() const {return seconds_;} diff --git a/Swiften/Elements/MAMArchived.cpp b/Swiften/Elements/MAMArchived.cpp new file mode 100644 index 0000000..4ec5750 --- /dev/null +++ b/Swiften/Elements/MAMArchived.cpp @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/MAMArchived.h> + +using namespace Swift; + +MAMArchived::~MAMArchived() { +} diff --git a/Swiften/Elements/MAMArchived.h b/Swiften/Elements/MAMArchived.h new file mode 100644 index 0000000..df83427 --- /dev/null +++ b/Swiften/Elements/MAMArchived.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <boost/optional.hpp> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <Swiften/JID/JID.h> + +namespace Swift { + class SWIFTEN_API MAMArchived : public Payload { + public: + virtual ~MAMArchived(); + + void setBy(const JID& by) { by_ = by; } + const JID& getBy() const { return by_; } + + void setID(const std::string& id) { id_ = id; } + const std::string& getID() const { return id_; } + + private: + JID by_; + std::string id_; + }; +} diff --git a/Swiften/Elements/MAMQuery.cpp b/Swiften/Elements/MAMQuery.cpp new file mode 100644 index 0000000..ff71bcc --- /dev/null +++ b/Swiften/Elements/MAMQuery.cpp @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/MAMQuery.h> + +using namespace Swift; + +MAMQuery::~MAMQuery() { +} diff --git a/Swiften/Elements/MAMQuery.h b/Swiften/Elements/MAMQuery.h new file mode 100644 index 0000000..3f3724e --- /dev/null +++ b/Swiften/Elements/MAMQuery.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <boost/optional.hpp> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Form.h> +#include <Swiften/Elements/Forwarded.h> +#include <Swiften/Elements/MAMResult.h> +#include <Swiften/Elements/Payload.h> +#include <Swiften/Elements/ResultSet.h> + +namespace Swift { + class SWIFTEN_API MAMQuery : public Payload { + public: + virtual ~MAMQuery(); + + void setQueryID(const boost::optional<std::string>& queryID) { queryID_ = queryID; } + const boost::optional<std::string>& getQueryID() const { return queryID_; } + + void setForm(boost::shared_ptr<Form> form) { form_ = form; } + const boost::shared_ptr<Form>& getForm() const { return form_; } + + void setResultSet(boost::shared_ptr<ResultSet> resultSet) { resultSet_ = resultSet; } + const boost::shared_ptr<ResultSet>& getResultSet() const { return resultSet_; } + + private: + boost::optional<std::string> queryID_; + boost::shared_ptr<Form> form_; + boost::shared_ptr<ResultSet> resultSet_; + }; +} diff --git a/Swiften/Elements/MAMResult.cpp b/Swiften/Elements/MAMResult.cpp new file mode 100644 index 0000000..79913d3 --- /dev/null +++ b/Swiften/Elements/MAMResult.cpp @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/MAMResult.h> + +using namespace Swift; + +MAMResult::~MAMResult() { +} diff --git a/Swiften/Elements/MAMResult.h b/Swiften/Elements/MAMResult.h new file mode 100644 index 0000000..7d43902 --- /dev/null +++ b/Swiften/Elements/MAMResult.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <boost/optional.hpp> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/ContainerPayload.h> +#include <Swiften/Elements/Forwarded.h> + +namespace Swift { + class SWIFTEN_API MAMResult : public ContainerPayload<Forwarded> { + public: + virtual ~MAMResult(); + + void setID(const std::string& id) { id_ = id; } + const std::string& getID() const { return id_; } + + void setQueryID(const boost::optional<std::string>& queryID) { queryID_ = queryID; } + const boost::optional<std::string>& getQueryID() const { return queryID_; } + + private: + std::string id_; + boost::optional<std::string> queryID_; + }; +} diff --git a/Swiften/Elements/MUCInvitationPayload.h b/Swiften/Elements/MUCInvitationPayload.h index ebae61a..290c585 100644 --- a/Swiften/Elements/MUCInvitationPayload.h +++ b/Swiften/Elements/MUCInvitationPayload.h @@ -16,5 +16,5 @@ namespace Swift { public: typedef boost::shared_ptr<MUCInvitationPayload> ref; - MUCInvitationPayload() : continuation_(false) { + MUCInvitationPayload() : continuation_(false), impromptu_(false) { } @@ -27,4 +27,12 @@ namespace Swift { } + void setIsImpromptu(bool b) { + impromptu_ = b; + } + + bool getIsImpromptu() const { + return impromptu_; + } + void setJID(const JID& jid) { jid_ = jid; @@ -61,4 +69,5 @@ namespace Swift { private: bool continuation_; + bool impromptu_; JID jid_; std::string password_; diff --git a/Swiften/Elements/MUCOccupant.h b/Swiften/Elements/MUCOccupant.h index 931f544..023643c 100644 --- a/Swiften/Elements/MUCOccupant.h +++ b/Swiften/Elements/MUCOccupant.h @@ -8,6 +8,7 @@ #include <boost/optional.hpp> - #include <string> + +#include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> @@ -15,5 +16,5 @@ namespace Swift { class Client; - class MUCOccupant { + class SWIFTEN_API MUCOccupant { public: enum Role {Moderator, Participant, Visitor, NoRole}; diff --git a/Swiften/Elements/Message.h b/Swiften/Elements/Message.h index 3b9145c..ea99814 100644 --- a/Swiften/Elements/Message.h +++ b/Swiften/Elements/Message.h @@ -39,6 +39,8 @@ namespace Swift { } + // Explicitly convert to bool. In C++11, it would be cleaner to + // compare to nullptr. bool hasSubject() { - return getPayload<Subject>(); + return static_cast<bool>(getPayload<Subject>()); } diff --git a/Swiften/Elements/Payload.h b/Swiften/Elements/Payload.h index f994ebc..7cc00da 100644 --- a/Swiften/Elements/Payload.h +++ b/Swiften/Elements/Payload.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -9,10 +9,17 @@ #include <boost/shared_ptr.hpp> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Element.h> + namespace Swift { - class Payload { + class SWIFTEN_API Payload : public Element { public: typedef boost::shared_ptr<Payload> ref; public: + Payload() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Payload) virtual ~Payload(); + + SWIFTEN_DEFAULT_COPY_ASSIGMNENT_OPERATOR(Payload) }; } diff --git a/Swiften/Elements/Presence.h b/Swiften/Elements/Presence.h index 28a9ee5..d16be2a 100644 --- a/Swiften/Elements/Presence.h +++ b/Swiften/Elements/Presence.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -9,9 +9,11 @@ #include <boost/smart_ptr/make_shared.hpp> +#include <Swiften/Base/API.h> #include <Swiften/Elements/Stanza.h> #include <Swiften/Elements/StatusShow.h> + namespace Swift { - class Presence : public Stanza { + class SWIFTEN_API Presence : public Stanza { public: typedef boost::shared_ptr<Presence> ref; @@ -21,4 +23,5 @@ namespace Swift { Presence(); Presence(const std::string& status); + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Presence) virtual ~Presence(); diff --git a/Swiften/Elements/PubSub.cpp b/Swiften/Elements/PubSub.cpp new file mode 100644 index 0000000..30a6376 --- /dev/null +++ b/Swiften/Elements/PubSub.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#include <Swiften/Elements/PubSub.h> + +using namespace Swift; + +PubSub::PubSub() { +} + +PubSub::~PubSub() { +} diff --git a/Swiften/Elements/PubSub.h b/Swiften/Elements/PubSub.h new file mode 100644 index 0000000..cd8bf43 --- /dev/null +++ b/Swiften/Elements/PubSub.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/ContainerPayload.h> + +#include <Swiften/Elements/PubSubPayload.h> + +namespace Swift { + class SWIFTEN_API PubSub : public ContainerPayload<PubSubPayload> { + public: + PubSub(); + virtual ~PubSub(); + }; +} diff --git a/Swiften/Elements/PubSubAffiliation.cpp b/Swiften/Elements/PubSubAffiliation.cpp new file mode 100644 index 0000000..aa8ab77 --- /dev/null +++ b/Swiften/Elements/PubSubAffiliation.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubAffiliation.h> + +using namespace Swift; + +PubSubAffiliation::PubSubAffiliation() : type(None) { +} + +PubSubAffiliation::~PubSubAffiliation() { +} diff --git a/Swiften/Elements/PubSubAffiliation.h b/Swiften/Elements/PubSubAffiliation.h new file mode 100644 index 0000000..6b9bc09 --- /dev/null +++ b/Swiften/Elements/PubSubAffiliation.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <string> + + + +namespace Swift { + class SWIFTEN_API PubSubAffiliation : public Payload { + public: + enum Type { + None, + Member, + Outcast, + Owner, + Publisher, + PublishOnly + }; + + PubSubAffiliation(); + PubSubAffiliation(const std::string& node) : node(node), type(None) {} + virtual ~PubSubAffiliation(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + Type getType() const { + return type; + } + + void setType(Type value) { + this->type = value ; + } + + + private: + std::string node; + Type type; + }; +} diff --git a/Swiften/Elements/PubSubAffiliations.cpp b/Swiften/Elements/PubSubAffiliations.cpp new file mode 100644 index 0000000..d112f35 --- /dev/null +++ b/Swiften/Elements/PubSubAffiliations.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubAffiliations.h> + +using namespace Swift; + +PubSubAffiliations::PubSubAffiliations() { +} + +PubSubAffiliations::~PubSubAffiliations() { +} diff --git a/Swiften/Elements/PubSubAffiliations.h b/Swiften/Elements/PubSubAffiliations.h new file mode 100644 index 0000000..4a6d0f7 --- /dev/null +++ b/Swiften/Elements/PubSubAffiliations.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> +#include <string> +#include <vector> + +#include <Swiften/Elements/PubSubAffiliation.h> +#include <Swiften/Elements/PubSubPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubAffiliations : public PubSubPayload { + public: + + PubSubAffiliations(); + + virtual ~PubSubAffiliations(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + const std::vector< boost::shared_ptr<PubSubAffiliation> >& getAffiliations() const { + return affiliations; + } + + void setAffiliations(const std::vector< boost::shared_ptr<PubSubAffiliation> >& value) { + this->affiliations = value ; + } + + void addAffiliation(boost::shared_ptr<PubSubAffiliation> value) { + this->affiliations.push_back(value); + } + + + private: + boost::optional< std::string > node; + std::vector< boost::shared_ptr<PubSubAffiliation> > affiliations; + }; +} diff --git a/Swiften/Elements/PubSubConfigure.cpp b/Swiften/Elements/PubSubConfigure.cpp new file mode 100644 index 0000000..0098ca6 --- /dev/null +++ b/Swiften/Elements/PubSubConfigure.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubConfigure.h> + +using namespace Swift; + +PubSubConfigure::PubSubConfigure() { +} + +PubSubConfigure::~PubSubConfigure() { +} diff --git a/Swiften/Elements/PubSubConfigure.h b/Swiften/Elements/PubSubConfigure.h new file mode 100644 index 0000000..84f5b82 --- /dev/null +++ b/Swiften/Elements/PubSubConfigure.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> + +#include <Swiften/Elements/Form.h> + +namespace Swift { + class SWIFTEN_API PubSubConfigure : public Payload { + public: + + PubSubConfigure(); + + virtual ~PubSubConfigure(); + + boost::shared_ptr<Form> getData() const { + return data; + } + + void setData(boost::shared_ptr<Form> value) { + this->data = value ; + } + + + private: + boost::shared_ptr<Form> data; + }; +} diff --git a/Swiften/Elements/PubSubCreate.cpp b/Swiften/Elements/PubSubCreate.cpp new file mode 100644 index 0000000..0ec3c38 --- /dev/null +++ b/Swiften/Elements/PubSubCreate.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubCreate.h> + +using namespace Swift; + +PubSubCreate::PubSubCreate() { +} + +PubSubCreate::~PubSubCreate() { +} diff --git a/Swiften/Elements/PubSubCreate.h b/Swiften/Elements/PubSubCreate.h new file mode 100644 index 0000000..f53fb9e --- /dev/null +++ b/Swiften/Elements/PubSubCreate.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> +#include <string> + +#include <Swiften/Elements/PubSubConfigure.h> +#include <Swiften/Elements/PubSubPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubCreate : public PubSubPayload { + public: + + PubSubCreate(); + PubSubCreate(const std::string& node) : node(node) {} + virtual ~PubSubCreate(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + boost::shared_ptr<PubSubConfigure> getConfigure() const { + return configure; + } + + void setConfigure(boost::shared_ptr<PubSubConfigure> value) { + this->configure = value ; + } + + + private: + std::string node; + boost::shared_ptr<PubSubConfigure> configure; + }; +} diff --git a/Swiften/Elements/PubSubDefault.cpp b/Swiften/Elements/PubSubDefault.cpp new file mode 100644 index 0000000..1ea5d2e3 --- /dev/null +++ b/Swiften/Elements/PubSubDefault.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubDefault.h> + +using namespace Swift; + +PubSubDefault::PubSubDefault() : type(None) { +} + +PubSubDefault::~PubSubDefault() { +} diff --git a/Swiften/Elements/PubSubDefault.h b/Swiften/Elements/PubSubDefault.h new file mode 100644 index 0000000..ef3117c --- /dev/null +++ b/Swiften/Elements/PubSubDefault.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/optional.hpp> +#include <string> + +#include <Swiften/Elements/PubSubPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubDefault : public PubSubPayload { + public: + enum Type { + None, + Collection, + Leaf + }; + + PubSubDefault(); + + virtual ~PubSubDefault(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + Type getType() const { + return type; + } + + void setType(Type value) { + this->type = value ; + } + + + private: + boost::optional< std::string > node; + Type type; + }; +} diff --git a/Swiften/Elements/PubSubError.cpp b/Swiften/Elements/PubSubError.cpp new file mode 100644 index 0000000..db07972 --- /dev/null +++ b/Swiften/Elements/PubSubError.cpp @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#include <Swiften/Elements/PubSubError.h> + +using namespace Swift; + +PubSubError::~PubSubError() { +} diff --git a/Swiften/Elements/PubSubError.h b/Swiften/Elements/PubSubError.h new file mode 100644 index 0000000..3748e44 --- /dev/null +++ b/Swiften/Elements/PubSubError.h @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#pragma once + +#include <Swiften/Elements/Payload.h> + +namespace Swift { + class SWIFTEN_API PubSubError : public Payload { + public: + enum Type { + UnknownType = 0, + ClosedNode, + ConfigurationRequired, + InvalidJID, + InvalidOptions, + InvalidPayload, + InvalidSubscriptionID, + ItemForbidden, + ItemRequired, + JIDRequired, + MaximumItemsExceeded, + MaximumNodesExceeded, + NodeIDRequired, + NotInRosterGroup, + NotSubscribed, + PayloadTooBig, + PayloadRequired, + PendingSubscription, + PresenceSubscriptionRequired, + SubscriptionIDRequired, + TooManySubscriptions, + Unsupported, + UnsupportedAccessModel + }; + + enum UnsupportedFeatureType { + UnknownUnsupportedFeatureType = 0, + AccessAuthorize, + AccessOpen, + AccessPresence, + AccessRoster, + AccessWhitelist, + AutoCreate, + AutoSubscribe, + Collections, + ConfigNode, + CreateAndConfigure, + CreateNodes, + DeleteItems, + DeleteNodes, + FilteredNotifications, + GetPending, + InstantNodes, + ItemIDs, + LastPublished, + LeasedSubscription, + ManageSubscriptions, + MemberAffiliation, + MetaData, + ModifyAffiliations, + MultiCollection, + MultiSubscribe, + OutcastAffiliation, + PersistentItems, + PresenceNotifications, + PresenceSubscribe, + Publish, + PublishOptions, + PublishOnlyAffiliation, + PublisherAffiliation, + PurgeNodes, + RetractItems, + RetrieveAffiliations, + RetrieveDefault, + RetrieveItems, + RetrieveSubscriptions, + Subscribe, + SubscriptionOptions, + SubscriptionNotifications + }; + + PubSubError(Type type = UnknownType) : type(type), unsupportedType(UnknownUnsupportedFeatureType) { + } + + virtual ~PubSubError(); + + Type getType() const { + return type; + } + + void setType(Type type) { + this->type = type; + } + + UnsupportedFeatureType getUnsupportedFeatureType() const { + return unsupportedType; + } + + void setUnsupportedFeatureType(UnsupportedFeatureType unsupportedType) { + this->unsupportedType = unsupportedType; + } + + private: + Type type; + UnsupportedFeatureType unsupportedType; + }; +} diff --git a/Swiften/Elements/PubSubEvent.cpp b/Swiften/Elements/PubSubEvent.cpp new file mode 100644 index 0000000..1b63134 --- /dev/null +++ b/Swiften/Elements/PubSubEvent.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#include <Swiften/Elements/PubSubEvent.h> + +using namespace Swift; + +PubSubEvent::PubSubEvent() { +} + +PubSubEvent::~PubSubEvent() { +} diff --git a/Swiften/Elements/PubSubEvent.h b/Swiften/Elements/PubSubEvent.h new file mode 100644 index 0000000..9ef6d89 --- /dev/null +++ b/Swiften/Elements/PubSubEvent.h @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> + +#include <Swiften/Elements/ContainerPayload.h> +#include <Swiften/Elements/PubSubEventPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubEvent : public ContainerPayload<PubSubEventPayload> { + public: + PubSubEvent(); + virtual ~PubSubEvent(); + }; +} diff --git a/Swiften/Elements/PubSubEventAssociate.cpp b/Swiften/Elements/PubSubEventAssociate.cpp new file mode 100644 index 0000000..be1c35b --- /dev/null +++ b/Swiften/Elements/PubSubEventAssociate.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubEventAssociate.h> + +using namespace Swift; + +PubSubEventAssociate::PubSubEventAssociate() { +} + +PubSubEventAssociate::~PubSubEventAssociate() { +} diff --git a/Swiften/Elements/PubSubEventAssociate.h b/Swiften/Elements/PubSubEventAssociate.h new file mode 100644 index 0000000..be4f8f4 --- /dev/null +++ b/Swiften/Elements/PubSubEventAssociate.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <string> + + + +namespace Swift { + class SWIFTEN_API PubSubEventAssociate : public Payload { + public: + + PubSubEventAssociate(); + + virtual ~PubSubEventAssociate(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + + private: + std::string node; + }; +} diff --git a/Swiften/Elements/PubSubEventCollection.cpp b/Swiften/Elements/PubSubEventCollection.cpp new file mode 100644 index 0000000..ca98be2 --- /dev/null +++ b/Swiften/Elements/PubSubEventCollection.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubEventCollection.h> + +using namespace Swift; + +PubSubEventCollection::PubSubEventCollection() { +} + +PubSubEventCollection::~PubSubEventCollection() { +} diff --git a/Swiften/Elements/PubSubEventCollection.h b/Swiften/Elements/PubSubEventCollection.h new file mode 100644 index 0000000..9c1d7cc --- /dev/null +++ b/Swiften/Elements/PubSubEventCollection.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> +#include <string> + +#include <Swiften/Elements/PubSubEventAssociate.h> +#include <Swiften/Elements/PubSubEventDisassociate.h> +#include <Swiften/Elements/PubSubEventPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubEventCollection : public PubSubEventPayload { + public: + + PubSubEventCollection(); + + virtual ~PubSubEventCollection(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + boost::shared_ptr<PubSubEventDisassociate> getDisassociate() const { + return disassociate; + } + + void setDisassociate(boost::shared_ptr<PubSubEventDisassociate> value) { + this->disassociate = value ; + } + + boost::shared_ptr<PubSubEventAssociate> getAssociate() const { + return associate; + } + + void setAssociate(boost::shared_ptr<PubSubEventAssociate> value) { + this->associate = value ; + } + + + private: + boost::optional< std::string > node; + boost::shared_ptr<PubSubEventDisassociate> disassociate; + boost::shared_ptr<PubSubEventAssociate> associate; + }; +} diff --git a/Swiften/Elements/PubSubEventConfiguration.cpp b/Swiften/Elements/PubSubEventConfiguration.cpp new file mode 100644 index 0000000..98c43ad --- /dev/null +++ b/Swiften/Elements/PubSubEventConfiguration.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubEventConfiguration.h> + +using namespace Swift; + +PubSubEventConfiguration::PubSubEventConfiguration() { +} + +PubSubEventConfiguration::~PubSubEventConfiguration() { +} diff --git a/Swiften/Elements/PubSubEventConfiguration.h b/Swiften/Elements/PubSubEventConfiguration.h new file mode 100644 index 0000000..4a2197e --- /dev/null +++ b/Swiften/Elements/PubSubEventConfiguration.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> +#include <string> + +#include <Swiften/Elements/Form.h> +#include <Swiften/Elements/PubSubEventPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubEventConfiguration : public PubSubEventPayload { + public: + + PubSubEventConfiguration(); + + virtual ~PubSubEventConfiguration(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + boost::shared_ptr<Form> getData() const { + return data; + } + + void setData(boost::shared_ptr<Form> value) { + this->data = value ; + } + + + private: + std::string node; + boost::shared_ptr<Form> data; + }; +} diff --git a/Swiften/Elements/PubSubEventDelete.cpp b/Swiften/Elements/PubSubEventDelete.cpp new file mode 100644 index 0000000..35c4569 --- /dev/null +++ b/Swiften/Elements/PubSubEventDelete.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubEventDelete.h> + +using namespace Swift; + +PubSubEventDelete::PubSubEventDelete() { +} + +PubSubEventDelete::~PubSubEventDelete() { +} diff --git a/Swiften/Elements/PubSubEventDelete.h b/Swiften/Elements/PubSubEventDelete.h new file mode 100644 index 0000000..3c27c82 --- /dev/null +++ b/Swiften/Elements/PubSubEventDelete.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> +#include <string> + +#include <Swiften/Elements/PubSubEventPayload.h> +#include <Swiften/Elements/PubSubEventRedirect.h> + +namespace Swift { + class SWIFTEN_API PubSubEventDelete : public PubSubEventPayload { + public: + + PubSubEventDelete(); + + virtual ~PubSubEventDelete(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + boost::shared_ptr<PubSubEventRedirect> getRedirects() const { + return redirects; + } + + void setRedirects(boost::shared_ptr<PubSubEventRedirect> value) { + this->redirects = value ; + } + + + private: + std::string node; + boost::shared_ptr<PubSubEventRedirect> redirects; + }; +} diff --git a/Swiften/Elements/PubSubEventDisassociate.cpp b/Swiften/Elements/PubSubEventDisassociate.cpp new file mode 100644 index 0000000..7060345 --- /dev/null +++ b/Swiften/Elements/PubSubEventDisassociate.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubEventDisassociate.h> + +using namespace Swift; + +PubSubEventDisassociate::PubSubEventDisassociate() { +} + +PubSubEventDisassociate::~PubSubEventDisassociate() { +} diff --git a/Swiften/Elements/PubSubEventDisassociate.h b/Swiften/Elements/PubSubEventDisassociate.h new file mode 100644 index 0000000..22a971f --- /dev/null +++ b/Swiften/Elements/PubSubEventDisassociate.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <string> + + + +namespace Swift { + class SWIFTEN_API PubSubEventDisassociate : public Payload { + public: + + PubSubEventDisassociate(); + + virtual ~PubSubEventDisassociate(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + + private: + std::string node; + }; +} diff --git a/Swiften/Elements/PubSubEventItem.cpp b/Swiften/Elements/PubSubEventItem.cpp new file mode 100644 index 0000000..0922f60 --- /dev/null +++ b/Swiften/Elements/PubSubEventItem.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubEventItem.h> + +using namespace Swift; + +PubSubEventItem::PubSubEventItem() { +} + +PubSubEventItem::~PubSubEventItem() { +} diff --git a/Swiften/Elements/PubSubEventItem.h b/Swiften/Elements/PubSubEventItem.h new file mode 100644 index 0000000..b25a79f --- /dev/null +++ b/Swiften/Elements/PubSubEventItem.h @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> +#include <string> +#include <vector> + +#include <Swiften/Elements/Payload.h> + +namespace Swift { + class SWIFTEN_API PubSubEventItem : public Payload { + public: + + PubSubEventItem(); + + virtual ~PubSubEventItem(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + const boost::optional< std::string >& getPublisher() const { + return publisher; + } + + void setPublisher(const boost::optional< std::string >& value) { + this->publisher = value ; + } + + const std::vector< boost::shared_ptr<Payload> >& getData() const { + return data; + } + + void setData(const std::vector< boost::shared_ptr<Payload> >& value) { + this->data = value ; + } + + void addData(boost::shared_ptr<Payload> value) { + this->data.push_back(value); + } + + const boost::optional< std::string >& getID() const { + return id; + } + + void setID(const boost::optional< std::string >& value) { + this->id = value ; + } + + + private: + boost::optional< std::string > node; + boost::optional< std::string > publisher; + std::vector< boost::shared_ptr<Payload> > data; + boost::optional< std::string > id; + }; +} diff --git a/Swiften/Elements/PubSubEventItems.cpp b/Swiften/Elements/PubSubEventItems.cpp new file mode 100644 index 0000000..624c844 --- /dev/null +++ b/Swiften/Elements/PubSubEventItems.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubEventItems.h> + +using namespace Swift; + +PubSubEventItems::PubSubEventItems() { +} + +PubSubEventItems::~PubSubEventItems() { +} diff --git a/Swiften/Elements/PubSubEventItems.h b/Swiften/Elements/PubSubEventItems.h new file mode 100644 index 0000000..78b2ef0 --- /dev/null +++ b/Swiften/Elements/PubSubEventItems.h @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> +#include <string> +#include <vector> + +#include <Swiften/Elements/PubSubEventItem.h> +#include <Swiften/Elements/PubSubEventPayload.h> +#include <Swiften/Elements/PubSubEventRetract.h> + +namespace Swift { + class SWIFTEN_API PubSubEventItems : public PubSubEventPayload { + public: + + PubSubEventItems(); + + virtual ~PubSubEventItems(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const std::vector< boost::shared_ptr<PubSubEventItem> >& getItems() const { + return items; + } + + void setItems(const std::vector< boost::shared_ptr<PubSubEventItem> >& value) { + this->items = value ; + } + + void addItem(boost::shared_ptr<PubSubEventItem> value) { + this->items.push_back(value); + } + + const std::vector< boost::shared_ptr<PubSubEventRetract> >& getRetracts() const { + return retracts; + } + + void setRetracts(const std::vector< boost::shared_ptr<PubSubEventRetract> >& value) { + this->retracts = value ; + } + + void addRetract(boost::shared_ptr<PubSubEventRetract> value) { + this->retracts.push_back(value); + } + + + private: + std::string node; + std::vector< boost::shared_ptr<PubSubEventItem> > items; + std::vector< boost::shared_ptr<PubSubEventRetract> > retracts; + }; +} diff --git a/Swiften/Elements/PubSubEventPayload.cpp b/Swiften/Elements/PubSubEventPayload.cpp new file mode 100644 index 0000000..0019942 --- /dev/null +++ b/Swiften/Elements/PubSubEventPayload.cpp @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#include <Swiften/Elements/PubSubEventPayload.h> + +using namespace Swift; + +PubSubEventPayload::~PubSubEventPayload() { +} diff --git a/Swiften/Elements/PubSubEventPayload.h b/Swiften/Elements/PubSubEventPayload.h new file mode 100644 index 0000000..81fb9a8 --- /dev/null +++ b/Swiften/Elements/PubSubEventPayload.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#pragma once + +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> + +namespace Swift { + class SWIFTEN_API PubSubEventPayload : public Payload { + public: + virtual ~PubSubEventPayload(); + }; +} diff --git a/Swiften/Elements/PubSubEventPurge.cpp b/Swiften/Elements/PubSubEventPurge.cpp new file mode 100644 index 0000000..3a62486 --- /dev/null +++ b/Swiften/Elements/PubSubEventPurge.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubEventPurge.h> + +using namespace Swift; + +PubSubEventPurge::PubSubEventPurge() { +} + +PubSubEventPurge::~PubSubEventPurge() { +} diff --git a/Swiften/Elements/PubSubEventPurge.h b/Swiften/Elements/PubSubEventPurge.h new file mode 100644 index 0000000..bd1eaf8 --- /dev/null +++ b/Swiften/Elements/PubSubEventPurge.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <string> + +#include <Swiften/Elements/PubSubEventPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubEventPurge : public PubSubEventPayload { + public: + + PubSubEventPurge(); + + virtual ~PubSubEventPurge(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + + private: + std::string node; + }; +} diff --git a/Swiften/Elements/PubSubEventRedirect.cpp b/Swiften/Elements/PubSubEventRedirect.cpp new file mode 100644 index 0000000..6c54371 --- /dev/null +++ b/Swiften/Elements/PubSubEventRedirect.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubEventRedirect.h> + +using namespace Swift; + +PubSubEventRedirect::PubSubEventRedirect() { +} + +PubSubEventRedirect::~PubSubEventRedirect() { +} diff --git a/Swiften/Elements/PubSubEventRedirect.h b/Swiften/Elements/PubSubEventRedirect.h new file mode 100644 index 0000000..22d30b8 --- /dev/null +++ b/Swiften/Elements/PubSubEventRedirect.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <string> + + + +namespace Swift { + class SWIFTEN_API PubSubEventRedirect : public Payload { + public: + + PubSubEventRedirect(); + + virtual ~PubSubEventRedirect(); + + const std::string& getURI() const { + return uri; + } + + void setURI(const std::string& value) { + this->uri = value ; + } + + + private: + std::string uri; + }; +} diff --git a/Swiften/Elements/PubSubEventRetract.cpp b/Swiften/Elements/PubSubEventRetract.cpp new file mode 100644 index 0000000..be28264 --- /dev/null +++ b/Swiften/Elements/PubSubEventRetract.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubEventRetract.h> + +using namespace Swift; + +PubSubEventRetract::PubSubEventRetract() { +} + +PubSubEventRetract::~PubSubEventRetract() { +} diff --git a/Swiften/Elements/PubSubEventRetract.h b/Swiften/Elements/PubSubEventRetract.h new file mode 100644 index 0000000..075b48c --- /dev/null +++ b/Swiften/Elements/PubSubEventRetract.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <string> + + + +namespace Swift { + class SWIFTEN_API PubSubEventRetract : public Payload { + public: + + PubSubEventRetract(); + + virtual ~PubSubEventRetract(); + + const std::string& getID() const { + return id; + } + + void setID(const std::string& value) { + this->id = value ; + } + + + private: + std::string id; + }; +} diff --git a/Swiften/Elements/PubSubEventSubscription.cpp b/Swiften/Elements/PubSubEventSubscription.cpp new file mode 100644 index 0000000..5943c32 --- /dev/null +++ b/Swiften/Elements/PubSubEventSubscription.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubEventSubscription.h> + +using namespace Swift; + +PubSubEventSubscription::PubSubEventSubscription() : subscription(None) { +} + +PubSubEventSubscription::~PubSubEventSubscription() { +} diff --git a/Swiften/Elements/PubSubEventSubscription.h b/Swiften/Elements/PubSubEventSubscription.h new file mode 100644 index 0000000..8d681b7 --- /dev/null +++ b/Swiften/Elements/PubSubEventSubscription.h @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/optional.hpp> +#include <string> + +#include <Swiften/Elements/PubSubEventPayload.h> +#include <Swiften/JID/JID.h> + +namespace Swift { + class SWIFTEN_API PubSubEventSubscription : public PubSubEventPayload { + public: + enum SubscriptionType { + None, + Pending, + Subscribed, + Unconfigured + }; + + PubSubEventSubscription(); + + virtual ~PubSubEventSubscription(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + SubscriptionType getSubscription() const { + return subscription; + } + + void setSubscription(SubscriptionType value) { + this->subscription = value ; + } + + const boost::optional< std::string >& getSubscriptionID() const { + return subscriptionID; + } + + void setSubscriptionID(const boost::optional< std::string >& value) { + this->subscriptionID = value ; + } + + const boost::posix_time::ptime& getExpiry() const { + return expiry; + } + + void setExpiry(const boost::posix_time::ptime& value) { + this->expiry = value ; + } + + + private: + std::string node; + JID jid; + SubscriptionType subscription; + boost::optional< std::string > subscriptionID; + boost::posix_time::ptime expiry; + }; +} diff --git a/Swiften/Elements/PubSubItem.cpp b/Swiften/Elements/PubSubItem.cpp new file mode 100644 index 0000000..c6cae54 --- /dev/null +++ b/Swiften/Elements/PubSubItem.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubItem.h> + +using namespace Swift; + +PubSubItem::PubSubItem() { +} + +PubSubItem::~PubSubItem() { +} diff --git a/Swiften/Elements/PubSubItem.h b/Swiften/Elements/PubSubItem.h new file mode 100644 index 0000000..7d65904 --- /dev/null +++ b/Swiften/Elements/PubSubItem.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> +#include <string> +#include <vector> + +#include <Swiften/Elements/Payload.h> + +namespace Swift { + class SWIFTEN_API PubSubItem : public Payload { + public: + + PubSubItem(); + + virtual ~PubSubItem(); + + const std::vector< boost::shared_ptr<Payload> >& getData() const { + return data; + } + + void setData(const std::vector< boost::shared_ptr<Payload> >& value) { + this->data = value ; + } + + void addData(boost::shared_ptr<Payload> value) { + this->data.push_back(value); + } + + const std::string& getID() const { + return id; + } + + void setID(const std::string& value) { + this->id = value ; + } + + + private: + std::vector< boost::shared_ptr<Payload> > data; + std::string id; + }; +} diff --git a/Swiften/Elements/PubSubItems.cpp b/Swiften/Elements/PubSubItems.cpp new file mode 100644 index 0000000..966b8d6 --- /dev/null +++ b/Swiften/Elements/PubSubItems.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubItems.h> + +using namespace Swift; + +PubSubItems::PubSubItems() { +} + +PubSubItems::~PubSubItems() { +} diff --git a/Swiften/Elements/PubSubItems.h b/Swiften/Elements/PubSubItems.h new file mode 100644 index 0000000..f2147ef --- /dev/null +++ b/Swiften/Elements/PubSubItems.h @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> +#include <string> +#include <vector> + +#include <Swiften/Elements/PubSubItem.h> +#include <Swiften/Elements/PubSubPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubItems : public PubSubPayload { + public: + + PubSubItems(); + PubSubItems(const std::string& node) : node(node) {} + virtual ~PubSubItems(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const std::vector< boost::shared_ptr<PubSubItem> >& getItems() const { + return items; + } + + void setItems(const std::vector< boost::shared_ptr<PubSubItem> >& value) { + this->items = value ; + } + + void addItem(boost::shared_ptr<PubSubItem> value) { + this->items.push_back(value); + } + + const boost::optional< unsigned int >& getMaximumItems() const { + return maximumItems; + } + + void setMaximumItems(const boost::optional< unsigned int >& value) { + this->maximumItems = value ; + } + + const boost::optional< std::string >& getSubscriptionID() const { + return subscriptionID; + } + + void setSubscriptionID(const boost::optional< std::string >& value) { + this->subscriptionID = value ; + } + + + private: + std::string node; + std::vector< boost::shared_ptr<PubSubItem> > items; + boost::optional< unsigned int > maximumItems; + boost::optional< std::string > subscriptionID; + }; +} diff --git a/Swiften/Elements/PubSubOptions.cpp b/Swiften/Elements/PubSubOptions.cpp new file mode 100644 index 0000000..a72ff5d --- /dev/null +++ b/Swiften/Elements/PubSubOptions.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubOptions.h> + +using namespace Swift; + +PubSubOptions::PubSubOptions() { +} + +PubSubOptions::~PubSubOptions() { +} diff --git a/Swiften/Elements/PubSubOptions.h b/Swiften/Elements/PubSubOptions.h new file mode 100644 index 0000000..0f47c26 --- /dev/null +++ b/Swiften/Elements/PubSubOptions.h @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> +#include <string> + +#include <Swiften/Elements/Form.h> +#include <Swiften/Elements/PubSubPayload.h> +#include <Swiften/JID/JID.h> + +namespace Swift { + class SWIFTEN_API PubSubOptions : public PubSubPayload { + public: + + PubSubOptions(); + + virtual ~PubSubOptions(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + boost::shared_ptr<Form> getData() const { + return data; + } + + void setData(boost::shared_ptr<Form> value) { + this->data = value ; + } + + const boost::optional< std::string >& getSubscriptionID() const { + return subscriptionID; + } + + void setSubscriptionID(const boost::optional< std::string >& value) { + this->subscriptionID = value ; + } + + + private: + std::string node; + JID jid; + boost::shared_ptr<Form> data; + boost::optional< std::string > subscriptionID; + }; +} diff --git a/Swiften/Elements/PubSubOwnerAffiliation.cpp b/Swiften/Elements/PubSubOwnerAffiliation.cpp new file mode 100644 index 0000000..12c871d --- /dev/null +++ b/Swiften/Elements/PubSubOwnerAffiliation.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubOwnerAffiliation.h> + +using namespace Swift; + +PubSubOwnerAffiliation::PubSubOwnerAffiliation() : type(None) { +} + +PubSubOwnerAffiliation::~PubSubOwnerAffiliation() { +} diff --git a/Swiften/Elements/PubSubOwnerAffiliation.h b/Swiften/Elements/PubSubOwnerAffiliation.h new file mode 100644 index 0000000..67853f7 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerAffiliation.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> + + +#include <Swiften/JID/JID.h> + +namespace Swift { + class SWIFTEN_API PubSubOwnerAffiliation : public Payload { + public: + enum Type { + None, + Member, + Outcast, + Owner, + Publisher, + PublishOnly + }; + + PubSubOwnerAffiliation(); + + virtual ~PubSubOwnerAffiliation(); + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + Type getType() const { + return type; + } + + void setType(Type value) { + this->type = value ; + } + + + private: + JID jid; + Type type; + }; +} diff --git a/Swiften/Elements/PubSubOwnerAffiliations.cpp b/Swiften/Elements/PubSubOwnerAffiliations.cpp new file mode 100644 index 0000000..7093298 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerAffiliations.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubOwnerAffiliations.h> + +using namespace Swift; + +PubSubOwnerAffiliations::PubSubOwnerAffiliations() { +} + +PubSubOwnerAffiliations::~PubSubOwnerAffiliations() { +} diff --git a/Swiften/Elements/PubSubOwnerAffiliations.h b/Swiften/Elements/PubSubOwnerAffiliations.h new file mode 100644 index 0000000..4aeb278 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerAffiliations.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> +#include <string> +#include <vector> + +#include <Swiften/Elements/PubSubOwnerAffiliation.h> +#include <Swiften/Elements/PubSubOwnerPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubOwnerAffiliations : public PubSubOwnerPayload { + public: + + PubSubOwnerAffiliations(); + + virtual ~PubSubOwnerAffiliations(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const std::vector< boost::shared_ptr<PubSubOwnerAffiliation> >& getAffiliations() const { + return affiliations; + } + + void setAffiliations(const std::vector< boost::shared_ptr<PubSubOwnerAffiliation> >& value) { + this->affiliations = value ; + } + + void addAffiliation(boost::shared_ptr<PubSubOwnerAffiliation> value) { + this->affiliations.push_back(value); + } + + + private: + std::string node; + std::vector< boost::shared_ptr<PubSubOwnerAffiliation> > affiliations; + }; +} diff --git a/Swiften/Elements/PubSubOwnerConfigure.cpp b/Swiften/Elements/PubSubOwnerConfigure.cpp new file mode 100644 index 0000000..57405fa --- /dev/null +++ b/Swiften/Elements/PubSubOwnerConfigure.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubOwnerConfigure.h> + +using namespace Swift; + +PubSubOwnerConfigure::PubSubOwnerConfigure() { +} + +PubSubOwnerConfigure::~PubSubOwnerConfigure() { +} diff --git a/Swiften/Elements/PubSubOwnerConfigure.h b/Swiften/Elements/PubSubOwnerConfigure.h new file mode 100644 index 0000000..5dae983 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerConfigure.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> +#include <string> + +#include <Swiften/Elements/Form.h> +#include <Swiften/Elements/PubSubOwnerPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubOwnerConfigure : public PubSubOwnerPayload { + public: + + PubSubOwnerConfigure(); + PubSubOwnerConfigure(const std::string& node) : node(node) {} + virtual ~PubSubOwnerConfigure(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + boost::shared_ptr<Form> getData() const { + return data; + } + + void setData(boost::shared_ptr<Form> value) { + this->data = value ; + } + + + private: + boost::optional< std::string > node; + boost::shared_ptr<Form> data; + }; +} diff --git a/Swiften/Elements/PubSubOwnerDefault.cpp b/Swiften/Elements/PubSubOwnerDefault.cpp new file mode 100644 index 0000000..7aad448 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerDefault.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubOwnerDefault.h> + +using namespace Swift; + +PubSubOwnerDefault::PubSubOwnerDefault() { +} + +PubSubOwnerDefault::~PubSubOwnerDefault() { +} diff --git a/Swiften/Elements/PubSubOwnerDefault.h b/Swiften/Elements/PubSubOwnerDefault.h new file mode 100644 index 0000000..2133dff --- /dev/null +++ b/Swiften/Elements/PubSubOwnerDefault.h @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> + +#include <Swiften/Elements/Form.h> +#include <Swiften/Elements/PubSubOwnerPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubOwnerDefault : public PubSubOwnerPayload { + public: + + PubSubOwnerDefault(); + + virtual ~PubSubOwnerDefault(); + + boost::shared_ptr<Form> getData() const { + return data; + } + + void setData(boost::shared_ptr<Form> value) { + this->data = value ; + } + + + private: + boost::shared_ptr<Form> data; + }; +} diff --git a/Swiften/Elements/PubSubOwnerDelete.cpp b/Swiften/Elements/PubSubOwnerDelete.cpp new file mode 100644 index 0000000..8659611 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerDelete.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubOwnerDelete.h> + +using namespace Swift; + +PubSubOwnerDelete::PubSubOwnerDelete() { +} + +PubSubOwnerDelete::~PubSubOwnerDelete() { +} diff --git a/Swiften/Elements/PubSubOwnerDelete.h b/Swiften/Elements/PubSubOwnerDelete.h new file mode 100644 index 0000000..f15e363 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerDelete.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> +#include <string> + +#include <Swiften/Elements/PubSubOwnerPayload.h> +#include <Swiften/Elements/PubSubOwnerRedirect.h> + +namespace Swift { + class SWIFTEN_API PubSubOwnerDelete : public PubSubOwnerPayload { + public: + + PubSubOwnerDelete(); + PubSubOwnerDelete(const std::string& node) : node(node) {} + virtual ~PubSubOwnerDelete(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + boost::shared_ptr<PubSubOwnerRedirect> getRedirect() const { + return redirect; + } + + void setRedirect(boost::shared_ptr<PubSubOwnerRedirect> value) { + this->redirect = value ; + } + + + private: + std::string node; + boost::shared_ptr<PubSubOwnerRedirect> redirect; + }; +} diff --git a/Swiften/Elements/PubSubOwnerPayload.cpp b/Swiften/Elements/PubSubOwnerPayload.cpp new file mode 100644 index 0000000..92c1dd2 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerPayload.cpp @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#include <Swiften/Elements/PubSubOwnerPayload.h> + +using namespace Swift; + +PubSubOwnerPayload::~PubSubOwnerPayload() { +} diff --git a/Swiften/Elements/PubSubOwnerPayload.h b/Swiften/Elements/PubSubOwnerPayload.h new file mode 100644 index 0000000..a2ddaaa --- /dev/null +++ b/Swiften/Elements/PubSubOwnerPayload.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#pragma once + +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> + +namespace Swift { + class SWIFTEN_API PubSubOwnerPayload : public Payload { + public: + virtual ~PubSubOwnerPayload(); + }; +} diff --git a/Swiften/Elements/PubSubOwnerPubSub.cpp b/Swiften/Elements/PubSubOwnerPubSub.cpp new file mode 100644 index 0000000..022452d --- /dev/null +++ b/Swiften/Elements/PubSubOwnerPubSub.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#include <Swiften/Elements/PubSubOwnerPubSub.h> + +using namespace Swift; + +PubSubOwnerPubSub::PubSubOwnerPubSub() { +} + +PubSubOwnerPubSub::~PubSubOwnerPubSub() { +} diff --git a/Swiften/Elements/PubSubOwnerPubSub.h b/Swiften/Elements/PubSubOwnerPubSub.h new file mode 100644 index 0000000..dd72abe --- /dev/null +++ b/Swiften/Elements/PubSubOwnerPubSub.h @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/ContainerPayload.h> + +#include <Swiften/Elements/PubSubOwnerPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubOwnerPubSub : public ContainerPayload<PubSubOwnerPayload> { + public: + PubSubOwnerPubSub(); + virtual ~PubSubOwnerPubSub(); + }; +} diff --git a/Swiften/Elements/PubSubOwnerPurge.cpp b/Swiften/Elements/PubSubOwnerPurge.cpp new file mode 100644 index 0000000..6331cf2 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerPurge.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubOwnerPurge.h> + +using namespace Swift; + +PubSubOwnerPurge::PubSubOwnerPurge() { +} + +PubSubOwnerPurge::~PubSubOwnerPurge() { +} diff --git a/Swiften/Elements/PubSubOwnerPurge.h b/Swiften/Elements/PubSubOwnerPurge.h new file mode 100644 index 0000000..05dfb63 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerPurge.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <string> + +#include <Swiften/Elements/PubSubOwnerPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubOwnerPurge : public PubSubOwnerPayload { + public: + + PubSubOwnerPurge(); + + virtual ~PubSubOwnerPurge(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + + private: + std::string node; + }; +} diff --git a/Swiften/Elements/PubSubOwnerRedirect.cpp b/Swiften/Elements/PubSubOwnerRedirect.cpp new file mode 100644 index 0000000..75e9819 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerRedirect.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubOwnerRedirect.h> + +using namespace Swift; + +PubSubOwnerRedirect::PubSubOwnerRedirect() { +} + +PubSubOwnerRedirect::~PubSubOwnerRedirect() { +} diff --git a/Swiften/Elements/PubSubOwnerRedirect.h b/Swiften/Elements/PubSubOwnerRedirect.h new file mode 100644 index 0000000..50ba66f --- /dev/null +++ b/Swiften/Elements/PubSubOwnerRedirect.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <string> + + + +namespace Swift { + class SWIFTEN_API PubSubOwnerRedirect : public Payload { + public: + + PubSubOwnerRedirect(); + + virtual ~PubSubOwnerRedirect(); + + const std::string& getURI() const { + return uri; + } + + void setURI(const std::string& value) { + this->uri = value ; + } + + + private: + std::string uri; + }; +} diff --git a/Swiften/Elements/PubSubOwnerSubscription.cpp b/Swiften/Elements/PubSubOwnerSubscription.cpp new file mode 100644 index 0000000..0e83951 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerSubscription.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubOwnerSubscription.h> + +using namespace Swift; + +PubSubOwnerSubscription::PubSubOwnerSubscription() : subscription(None) { +} + +PubSubOwnerSubscription::~PubSubOwnerSubscription() { +} diff --git a/Swiften/Elements/PubSubOwnerSubscription.h b/Swiften/Elements/PubSubOwnerSubscription.h new file mode 100644 index 0000000..7ba5e3a --- /dev/null +++ b/Swiften/Elements/PubSubOwnerSubscription.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> + + +#include <Swiften/JID/JID.h> + +namespace Swift { + class SWIFTEN_API PubSubOwnerSubscription : public Payload { + public: + enum SubscriptionType { + None, + Pending, + Subscribed, + Unconfigured + }; + + PubSubOwnerSubscription(); + + virtual ~PubSubOwnerSubscription(); + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + SubscriptionType getSubscription() const { + return subscription; + } + + void setSubscription(SubscriptionType value) { + this->subscription = value ; + } + + + private: + JID jid; + SubscriptionType subscription; + }; +} diff --git a/Swiften/Elements/PubSubOwnerSubscriptions.cpp b/Swiften/Elements/PubSubOwnerSubscriptions.cpp new file mode 100644 index 0000000..02a1f34 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerSubscriptions.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubOwnerSubscriptions.h> + +using namespace Swift; + +PubSubOwnerSubscriptions::PubSubOwnerSubscriptions() { +} + +PubSubOwnerSubscriptions::~PubSubOwnerSubscriptions() { +} diff --git a/Swiften/Elements/PubSubOwnerSubscriptions.h b/Swiften/Elements/PubSubOwnerSubscriptions.h new file mode 100644 index 0000000..ea64517 --- /dev/null +++ b/Swiften/Elements/PubSubOwnerSubscriptions.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> +#include <string> +#include <vector> + +#include <Swiften/Elements/PubSubOwnerPayload.h> +#include <Swiften/Elements/PubSubOwnerSubscription.h> + +namespace Swift { + class SWIFTEN_API PubSubOwnerSubscriptions : public PubSubOwnerPayload { + public: + + PubSubOwnerSubscriptions(); + + virtual ~PubSubOwnerSubscriptions(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const std::vector< boost::shared_ptr<PubSubOwnerSubscription> >& getSubscriptions() const { + return subscriptions; + } + + void setSubscriptions(const std::vector< boost::shared_ptr<PubSubOwnerSubscription> >& value) { + this->subscriptions = value ; + } + + void addSubscription(boost::shared_ptr<PubSubOwnerSubscription> value) { + this->subscriptions.push_back(value); + } + + + private: + std::string node; + std::vector< boost::shared_ptr<PubSubOwnerSubscription> > subscriptions; + }; +} diff --git a/Swiften/Elements/PubSubPayload.cpp b/Swiften/Elements/PubSubPayload.cpp new file mode 100644 index 0000000..b529959 --- /dev/null +++ b/Swiften/Elements/PubSubPayload.cpp @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#include <Swiften/Elements/PubSubPayload.h> + +using namespace Swift; + +PubSubPayload::~PubSubPayload() { +} diff --git a/Swiften/Elements/PubSubPayload.h b/Swiften/Elements/PubSubPayload.h new file mode 100644 index 0000000..476939b --- /dev/null +++ b/Swiften/Elements/PubSubPayload.h @@ -0,0 +1,17 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License. + * See the COPYING file for more information. + */ + +#pragma once + +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> + +namespace Swift { + class SWIFTEN_API PubSubPayload : public Payload { + public: + virtual ~PubSubPayload(); + }; +} diff --git a/Swiften/Elements/PubSubPublish.cpp b/Swiften/Elements/PubSubPublish.cpp new file mode 100644 index 0000000..90cf6bb --- /dev/null +++ b/Swiften/Elements/PubSubPublish.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubPublish.h> + +using namespace Swift; + +PubSubPublish::PubSubPublish() { +} + +PubSubPublish::~PubSubPublish() { +} diff --git a/Swiften/Elements/PubSubPublish.h b/Swiften/Elements/PubSubPublish.h new file mode 100644 index 0000000..916ed05 --- /dev/null +++ b/Swiften/Elements/PubSubPublish.h @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> +#include <string> +#include <vector> + +#include <Swiften/Elements/PubSubItem.h> +#include <Swiften/Elements/PubSubPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubPublish : public PubSubPayload { + public: + + PubSubPublish(); + + virtual ~PubSubPublish(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const std::vector< boost::shared_ptr<PubSubItem> >& getItems() const { + return items; + } + + void setItems(const std::vector< boost::shared_ptr<PubSubItem> >& value) { + this->items = value ; + } + + void addItem(boost::shared_ptr<PubSubItem> value) { + this->items.push_back(value); + } + + + private: + std::string node; + std::vector< boost::shared_ptr<PubSubItem> > items; + }; +} diff --git a/Swiften/Elements/PubSubRetract.cpp b/Swiften/Elements/PubSubRetract.cpp new file mode 100644 index 0000000..41b9346 --- /dev/null +++ b/Swiften/Elements/PubSubRetract.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubRetract.h> + +using namespace Swift; + +PubSubRetract::PubSubRetract() : notify(false) { +} + +PubSubRetract::~PubSubRetract() { +} diff --git a/Swiften/Elements/PubSubRetract.h b/Swiften/Elements/PubSubRetract.h new file mode 100644 index 0000000..13fa594 --- /dev/null +++ b/Swiften/Elements/PubSubRetract.h @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/shared_ptr.hpp> +#include <string> +#include <vector> + +#include <Swiften/Elements/PubSubItem.h> +#include <Swiften/Elements/PubSubPayload.h> + +namespace Swift { + class SWIFTEN_API PubSubRetract : public PubSubPayload { + public: + + PubSubRetract(); + + virtual ~PubSubRetract(); + + const std::string& getNode() const { + return node; + } + + void setNode(const std::string& value) { + this->node = value ; + } + + const std::vector< boost::shared_ptr<PubSubItem> >& getItems() const { + return items; + } + + void setItems(const std::vector< boost::shared_ptr<PubSubItem> >& value) { + this->items = value ; + } + + void addItem(boost::shared_ptr<PubSubItem> value) { + this->items.push_back(value); + } + + bool isNotify() const { + return notify; + } + + void setNotify(bool value) { + this->notify = value ; + } + + + private: + std::string node; + std::vector< boost::shared_ptr<PubSubItem> > items; + bool notify; + }; +} diff --git a/Swiften/Elements/PubSubSubscribe.cpp b/Swiften/Elements/PubSubSubscribe.cpp new file mode 100644 index 0000000..0d13525 --- /dev/null +++ b/Swiften/Elements/PubSubSubscribe.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubSubscribe.h> + +using namespace Swift; + +PubSubSubscribe::PubSubSubscribe() { +} + +PubSubSubscribe::~PubSubSubscribe() { +} diff --git a/Swiften/Elements/PubSubSubscribe.h b/Swiften/Elements/PubSubSubscribe.h new file mode 100644 index 0000000..93eb3a5 --- /dev/null +++ b/Swiften/Elements/PubSubSubscribe.h @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> +#include <string> + +#include <Swiften/Elements/PubSubOptions.h> +#include <Swiften/Elements/PubSubPayload.h> +#include <Swiften/JID/JID.h> + +namespace Swift { + class SWIFTEN_API PubSubSubscribe : public PubSubPayload { + public: + + PubSubSubscribe(); + + virtual ~PubSubSubscribe(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + boost::shared_ptr<PubSubOptions> getOptions() const { + return options; + } + + void setOptions(boost::shared_ptr<PubSubOptions> value) { + this->options = value ; + } + + + private: + boost::optional< std::string > node; + JID jid; + boost::shared_ptr<PubSubOptions> options; + }; +} diff --git a/Swiften/Elements/PubSubSubscribeOptions.cpp b/Swiften/Elements/PubSubSubscribeOptions.cpp new file mode 100644 index 0000000..19cf084 --- /dev/null +++ b/Swiften/Elements/PubSubSubscribeOptions.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubSubscribeOptions.h> + +using namespace Swift; + +PubSubSubscribeOptions::PubSubSubscribeOptions() : required(false) { +} + +PubSubSubscribeOptions::~PubSubSubscribeOptions() { +} diff --git a/Swiften/Elements/PubSubSubscribeOptions.h b/Swiften/Elements/PubSubSubscribeOptions.h new file mode 100644 index 0000000..9801136 --- /dev/null +++ b/Swiften/Elements/PubSubSubscribeOptions.h @@ -0,0 +1,36 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> + + + + +namespace Swift { + class SWIFTEN_API PubSubSubscribeOptions : public Payload { + public: + + PubSubSubscribeOptions(); + + virtual ~PubSubSubscribeOptions(); + + bool isRequired() const { + return required; + } + + void setRequired(bool value) { + this->required = value ; + } + + + private: + bool required; + }; +} diff --git a/Swiften/Elements/PubSubSubscription.cpp b/Swiften/Elements/PubSubSubscription.cpp new file mode 100644 index 0000000..8d6d2d7 --- /dev/null +++ b/Swiften/Elements/PubSubSubscription.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubSubscription.h> + +using namespace Swift; + +PubSubSubscription::PubSubSubscription() : subscription(None) { +} + +PubSubSubscription::~PubSubSubscription() { +} diff --git a/Swiften/Elements/PubSubSubscription.h b/Swiften/Elements/PubSubSubscription.h new file mode 100644 index 0000000..07a85ec --- /dev/null +++ b/Swiften/Elements/PubSubSubscription.h @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> +#include <string> + +#include <Swiften/Elements/PubSubPayload.h> +#include <Swiften/Elements/PubSubSubscribeOptions.h> +#include <Swiften/JID/JID.h> + +namespace Swift { + class SWIFTEN_API PubSubSubscription : public PubSubPayload { + public: + enum SubscriptionType { + None, + Pending, + Subscribed, + Unconfigured + }; + + PubSubSubscription(); + + virtual ~PubSubSubscription(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + const boost::optional< std::string >& getSubscriptionID() const { + return subscriptionID; + } + + void setSubscriptionID(const boost::optional< std::string >& value) { + this->subscriptionID = value ; + } + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + boost::shared_ptr<PubSubSubscribeOptions> getOptions() const { + return options; + } + + void setOptions(boost::shared_ptr<PubSubSubscribeOptions> value) { + this->options = value ; + } + + SubscriptionType getSubscription() const { + return subscription; + } + + void setSubscription(SubscriptionType value) { + this->subscription = value ; + } + + + private: + boost::optional< std::string > node; + boost::optional< std::string > subscriptionID; + JID jid; + boost::shared_ptr<PubSubSubscribeOptions> options; + SubscriptionType subscription; + }; +} diff --git a/Swiften/Elements/PubSubSubscriptions.cpp b/Swiften/Elements/PubSubSubscriptions.cpp new file mode 100644 index 0000000..895f1b6 --- /dev/null +++ b/Swiften/Elements/PubSubSubscriptions.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubSubscriptions.h> + +using namespace Swift; + +PubSubSubscriptions::PubSubSubscriptions() { +} + +PubSubSubscriptions::~PubSubSubscriptions() { +} diff --git a/Swiften/Elements/PubSubSubscriptions.h b/Swiften/Elements/PubSubSubscriptions.h new file mode 100644 index 0000000..a5e8b14 --- /dev/null +++ b/Swiften/Elements/PubSubSubscriptions.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/optional.hpp> +#include <boost/shared_ptr.hpp> +#include <string> +#include <vector> + +#include <Swiften/Elements/PubSubPayload.h> +#include <Swiften/Elements/PubSubSubscription.h> + +namespace Swift { + class SWIFTEN_API PubSubSubscriptions : public PubSubPayload { + public: + + PubSubSubscriptions(); + PubSubSubscriptions(const std::string& node) : node(node) {} + virtual ~PubSubSubscriptions(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + const std::vector< boost::shared_ptr<PubSubSubscription> >& getSubscriptions() const { + return subscriptions; + } + + void setSubscriptions(const std::vector< boost::shared_ptr<PubSubSubscription> >& value) { + this->subscriptions = value ; + } + + void addSubscription(boost::shared_ptr<PubSubSubscription> value) { + this->subscriptions.push_back(value); + } + + + private: + boost::optional< std::string > node; + std::vector< boost::shared_ptr<PubSubSubscription> > subscriptions; + }; +} diff --git a/Swiften/Elements/PubSubUnsubscribe.cpp b/Swiften/Elements/PubSubUnsubscribe.cpp new file mode 100644 index 0000000..a9c8e71 --- /dev/null +++ b/Swiften/Elements/PubSubUnsubscribe.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/PubSubUnsubscribe.h> + +using namespace Swift; + +PubSubUnsubscribe::PubSubUnsubscribe() { +} + +PubSubUnsubscribe::~PubSubUnsubscribe() { +} diff --git a/Swiften/Elements/PubSubUnsubscribe.h b/Swiften/Elements/PubSubUnsubscribe.h new file mode 100644 index 0000000..21f857b --- /dev/null +++ b/Swiften/Elements/PubSubUnsubscribe.h @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/optional.hpp> +#include <string> + +#include <Swiften/Elements/PubSubPayload.h> +#include <Swiften/JID/JID.h> + +namespace Swift { + class SWIFTEN_API PubSubUnsubscribe : public PubSubPayload { + public: + + PubSubUnsubscribe(); + + virtual ~PubSubUnsubscribe(); + + const boost::optional< std::string >& getNode() const { + return node; + } + + void setNode(const boost::optional< std::string >& value) { + this->node = value ; + } + + const JID& getJID() const { + return jid; + } + + void setJID(const JID& value) { + this->jid = value ; + } + + const boost::optional< std::string >& getSubscriptionID() const { + return subscriptionID; + } + + void setSubscriptionID(const boost::optional< std::string >& value) { + this->subscriptionID = value ; + } + + + private: + boost::optional< std::string > node; + JID jid; + boost::optional< std::string > subscriptionID; + }; +} diff --git a/Swiften/Elements/Replace.h b/Swiften/Elements/Replace.h index 230bce7..96935f5 100644 --- a/Swiften/Elements/Replace.h +++ b/Swiften/Elements/Replace.h @@ -16,5 +16,5 @@ namespace Swift { public: typedef boost::shared_ptr<Replace> ref; - Replace(const std::string& id = std::string()) : replaceID_(id) {}; + Replace(const std::string& id = std::string()) : replaceID_(id) {} const std::string& getID() const { return replaceID_; diff --git a/Swiften/Elements/ResultSet.cpp b/Swiften/Elements/ResultSet.cpp new file mode 100644 index 0000000..2565bbb --- /dev/null +++ b/Swiften/Elements/ResultSet.cpp @@ -0,0 +1,12 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/ResultSet.h> + +using namespace Swift; + +ResultSet::~ResultSet() { +} diff --git a/Swiften/Elements/ResultSet.h b/Swiften/Elements/ResultSet.h new file mode 100644 index 0000000..e84be35 --- /dev/null +++ b/Swiften/Elements/ResultSet.h @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2014 Kevin Smith and Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <boost/optional.hpp> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> + +namespace Swift { + class SWIFTEN_API ResultSet : public Payload { + public: + virtual ~ResultSet(); + + void setMaxItems(const boost::optional<int>& maxItems) { maxItems_ = maxItems; } + const boost::optional<int>& getMaxItems() const { return maxItems_; } + + void setCount(const boost::optional<int>& count) { count_ = count; } + const boost::optional<int>& getCount() const { return count_; } + + void setFirstIDIndex(const boost::optional<int>& firstIndex) { firstIndex_ = firstIndex; } + const boost::optional<int>& getFirstIDIndex() const { return firstIndex_; } + + void setFirstID(const boost::optional<std::string>& firstID) { firstID_ = firstID; } + const boost::optional<std::string>& getFirstID() const { return firstID_; } + + void setLastID(const boost::optional<std::string>& lastID) { lastID_ = lastID; } + const boost::optional<std::string>& getLastID() const { return lastID_; } + + void setBefore(const boost::optional<std::string>& before) { before_ = before; } + const boost::optional<std::string>& getBefore() const { return before_; } + + void setAfter(const boost::optional<std::string>& after) { after_ = after; } + const boost::optional<std::string>& getAfter() const { return after_; } + + private: + boost::optional<int> maxItems_; + boost::optional<int> count_; + boost::optional<int> firstIndex_; + boost::optional<std::string> firstID_; + boost::optional<std::string> lastID_; + boost::optional<std::string> before_; + boost::optional<std::string> after_; + }; +} diff --git a/Swiften/Elements/RosterItemExchangePayload.h b/Swiften/Elements/RosterItemExchangePayload.h index f9aa2c8..622c775 100644 --- a/Swiften/Elements/RosterItemExchangePayload.h +++ b/Swiften/Elements/RosterItemExchangePayload.h @@ -11,14 +11,14 @@ #include <boost/shared_ptr.hpp> +#include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> #include <Swiften/JID/JID.h> - namespace Swift { - class RosterItemExchangePayload : public Payload { + class SWIFTEN_API RosterItemExchangePayload : public Payload { public: typedef boost::shared_ptr<RosterItemExchangePayload> ref; - class Item { + class SWIFTEN_API Item { public: enum Action { Add, Modify, Delete }; diff --git a/Swiften/Elements/RosterPayload.h b/Swiften/Elements/RosterPayload.h index c4907cb..47d27f2 100644 --- a/Swiften/Elements/RosterPayload.h +++ b/Swiften/Elements/RosterPayload.h @@ -11,4 +11,5 @@ #include <boost/shared_ptr.hpp> +#include <Swiften/Base/API.h> #include <Swiften/Elements/RosterItemPayload.h> #include <Swiften/Elements/Payload.h> @@ -16,5 +17,5 @@ namespace Swift { - class RosterPayload : public Payload { + class SWIFTEN_API RosterPayload : public Payload { public: typedef boost::shared_ptr<RosterPayload> ref; diff --git a/Swiften/Elements/SecurityLabel.cpp b/Swiften/Elements/SecurityLabel.cpp new file mode 100644 index 0000000..f2981c8 --- /dev/null +++ b/Swiften/Elements/SecurityLabel.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2010-2014 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/SecurityLabel.h> + +using namespace Swift; + +SecurityLabel::SecurityLabel() { +} + +SecurityLabel::~SecurityLabel() { +} diff --git a/Swiften/Elements/SecurityLabel.h b/Swiften/Elements/SecurityLabel.h index a1714c8..9a61123 100644 --- a/Swiften/Elements/SecurityLabel.h +++ b/Swiften/Elements/SecurityLabel.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -7,55 +7,71 @@ #pragma once +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <string> #include <vector> -#include <string> -#include <Swiften/Elements/Payload.h> + namespace Swift { - class SecurityLabel : public Payload { + class SWIFTEN_API SecurityLabel : public Payload { public: - typedef boost::shared_ptr<SecurityLabel> ref; - SecurityLabel() {} - const std::string& getDisplayMarking() const { return displayMarking_; } + SecurityLabel(); + + virtual ~SecurityLabel(); + + const std::vector< std::string >& getEquivalentLabels() const { + return equivalentLabels; + } - void setDisplayMarking(const std::string& displayMarking) { - displayMarking_ = displayMarking; + void setEquivalentLabels(const std::vector< std::string >& value) { + this->equivalentLabels = value ; + } + + void addEquivalentLabel(const std::string& value) { + this->equivalentLabels.push_back(value); } const std::string& getForegroundColor() const { - return foregroundColor_; + return foregroundColor; } - void setForegroundColor(const std::string& foregroundColor) { - foregroundColor_ = foregroundColor; + void setForegroundColor(const std::string& value) { + this->foregroundColor = value ; } - const std::string& getBackgroundColor() const { - return backgroundColor_; + const std::string& getDisplayMarking() const { + return displayMarking; } - void setBackgroundColor(const std::string& backgroundColor) { - backgroundColor_ = backgroundColor; + void setDisplayMarking(const std::string& value) { + this->displayMarking = value ; } - const std::string& getLabel() const { return label_; } + const std::string& getBackgroundColor() const { + return backgroundColor; + } - void setLabel(const std::string& label) { - label_ = label; + void setBackgroundColor(const std::string& value) { + this->backgroundColor = value ; } - const std::vector<std::string>& getEquivalentLabels() const { return equivalentLabels_; } + const std::string& getLabel() const { + return label; + } - void addEquivalentLabel(const std::string& label) { - equivalentLabels_.push_back(label); + void setLabel(const std::string& value) { + this->label = value ; } + private: - std::string displayMarking_; - std::string foregroundColor_; - std::string backgroundColor_; - std::string label_; - std::vector<std::string> equivalentLabels_; + std::vector< std::string > equivalentLabels; + std::string foregroundColor; + std::string displayMarking; + std::string backgroundColor; + std::string label; }; } diff --git a/Swiften/Elements/SecurityLabelsCatalog.h b/Swiften/Elements/SecurityLabelsCatalog.h index 5498fcf..000240e 100644 --- a/Swiften/Elements/SecurityLabelsCatalog.h +++ b/Swiften/Elements/SecurityLabelsCatalog.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -11,4 +11,5 @@ #include <boost/shared_ptr.hpp> +#include <Swiften/Base/API.h> #include <Swiften/JID/JID.h> #include <Swiften/Elements/Payload.h> @@ -16,5 +17,5 @@ namespace Swift { - class SecurityLabelsCatalog : public Payload { + class SWIFTEN_API SecurityLabelsCatalog : public Payload { public: typedef boost::shared_ptr<SecurityLabelsCatalog> ref; @@ -22,9 +23,9 @@ namespace Swift { public: Item() : default_(false) {} - SecurityLabel::ref getLabel() const { + boost::shared_ptr<SecurityLabel> getLabel() const { return label_; } - void setLabel(SecurityLabel::ref label) { + void setLabel(boost::shared_ptr<SecurityLabel> label) { label_ = label; } @@ -42,5 +43,5 @@ namespace Swift { } private: - SecurityLabel::ref label_; + boost::shared_ptr<SecurityLabel> label_; std::string selector_; bool default_; diff --git a/Swiften/Elements/SoftwareVersion.h b/Swiften/Elements/SoftwareVersion.h index c49b47b..e0eeaa3 100644 --- a/Swiften/Elements/SoftwareVersion.h +++ b/Swiften/Elements/SoftwareVersion.h @@ -10,8 +10,9 @@ #include <boost/shared_ptr.hpp> +#include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> namespace Swift { - class SoftwareVersion : public Payload { + class SWIFTEN_API SoftwareVersion : public Payload { public: typedef boost::shared_ptr<SoftwareVersion> ref; diff --git a/Swiften/Elements/Stanza.h b/Swiften/Elements/Stanza.h index 9e082cc..648c4df 100644 --- a/Swiften/Elements/Stanza.h +++ b/Swiften/Elements/Stanza.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -13,5 +13,6 @@ #include <boost/date_time/posix_time/ptime.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/ToplevelElement.h> #include <Swiften/JID/JID.h> @@ -19,10 +20,14 @@ namespace Swift { class Payload; - class Stanza : public Element { + class SWIFTEN_API Stanza : public ToplevelElement { public: typedef boost::shared_ptr<Stanza> ref; + protected: Stanza(); + + public: virtual ~Stanza(); + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(Stanza) template<typename T> @@ -58,4 +63,9 @@ namespace Swift { } + template<typename InputIterator> + void addPayloads(InputIterator begin, InputIterator end) { + payloads_.insert(payloads_.end(), begin, end); + } + void updatePayload(boost::shared_ptr<Payload> payload); diff --git a/Swiften/Elements/StanzaAck.cpp b/Swiften/Elements/StanzaAck.cpp new file mode 100644 index 0000000..5bcab73 --- /dev/null +++ b/Swiften/Elements/StanzaAck.cpp @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/StanzaAck.h> + +#include <boost/numeric/conversion/cast.hpp> + +using namespace Swift; + +StanzaAck::~StanzaAck() { +} + +void StanzaAck::setHandledStanzasCount(int i) { + handledStanzasCount = boost::numeric_cast<unsigned int>(i); + valid = true; +} diff --git a/Swiften/Elements/StanzaAck.h b/Swiften/Elements/StanzaAck.h index 3aa2dfd..0d99c5b 100644 --- a/Swiften/Elements/StanzaAck.h +++ b/Swiften/Elements/StanzaAck.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -7,9 +7,10 @@ #pragma once -#include <Swiften/Elements/Element.h> +#include <boost/shared_ptr.hpp> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StanzaAck : public Element { + class StanzaAck : public ToplevelElement { public: typedef boost::shared_ptr<StanzaAck> ref; @@ -17,4 +18,5 @@ namespace Swift { StanzaAck() : valid(false), handledStanzasCount(0) {} StanzaAck(unsigned int handledStanzasCount) : valid(true), handledStanzasCount(handledStanzasCount) {} + virtual ~StanzaAck(); unsigned int getHandledStanzasCount() const { @@ -22,8 +24,5 @@ namespace Swift { } - void setHandledStanzasCount(int i) { - handledStanzasCount = i; - valid = true; - } + void setHandledStanzasCount(int i); bool isValid() const { diff --git a/Swiften/Elements/StanzaAckRequest.h b/Swiften/Elements/StanzaAckRequest.h index 81b3871..0ae11ad 100644 --- a/Swiften/Elements/StanzaAckRequest.h +++ b/Swiften/Elements/StanzaAckRequest.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -7,9 +7,9 @@ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StanzaAckRequest : public Element { + class StanzaAckRequest : public ToplevelElement { }; } diff --git a/Swiften/Elements/StartTLSFailure.h b/Swiften/Elements/StartTLSFailure.h index 5e233fb..ce13fd6 100644 --- a/Swiften/Elements/StartTLSFailure.h +++ b/Swiften/Elements/StartTLSFailure.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -7,8 +7,8 @@ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StartTLSFailure : public Element { + class StartTLSFailure : public ToplevelElement { public: StartTLSFailure() {} diff --git a/Swiften/Elements/StartTLSRequest.h b/Swiften/Elements/StartTLSRequest.h index e284f75..4b4f1f1 100644 --- a/Swiften/Elements/StartTLSRequest.h +++ b/Swiften/Elements/StartTLSRequest.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -7,8 +7,8 @@ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StartTLSRequest : public Element { + class StartTLSRequest : public ToplevelElement { public: StartTLSRequest() {} diff --git a/Swiften/Elements/StatusShow.h b/Swiften/Elements/StatusShow.h index cd3477e..afa30de 100644 --- a/Swiften/Elements/StatusShow.h +++ b/Swiften/Elements/StatusShow.h @@ -7,8 +7,10 @@ #pragma once +#include <Swiften/Base/API.h> #include <Swiften/Elements/Payload.h> +#include <cassert> namespace Swift { - class StatusShow : public Payload { + class SWIFTEN_API StatusShow : public Payload { public: enum Type { Online, Away, FFC, XA, DND, None }; @@ -37,4 +39,5 @@ namespace Swift { case None: return 0; } + assert(false); return 0; } diff --git a/Swiften/Elements/StreamError.h b/Swiften/Elements/StreamError.h index 0d0551c..300f1c7 100644 --- a/Swiften/Elements/StreamError.h +++ b/Swiften/Elements/StreamError.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -9,9 +9,9 @@ #include <boost/shared_ptr.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> #include <string> namespace Swift { - class StreamError : public Element { + class StreamError : public ToplevelElement { public: typedef boost::shared_ptr<StreamError> ref; @@ -42,5 +42,5 @@ namespace Swift { UnsupportedEncoding, UnsupportedStanzaType, - UnsupportedVersion, + UnsupportedVersion }; diff --git a/Swiften/Elements/StreamFeatures.h b/Swiften/Elements/StreamFeatures.h index cae5532..ed40544 100644 --- a/Swiften/Elements/StreamFeatures.h +++ b/Swiften/Elements/StreamFeatures.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -11,8 +11,9 @@ #include <boost/shared_ptr.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StreamFeatures : public Element { + class SWIFTEN_API StreamFeatures : public ToplevelElement { public: typedef boost::shared_ptr<StreamFeatures> ref; diff --git a/Swiften/Elements/StreamInitiationFileInfo.h b/Swiften/Elements/StreamInitiationFileInfo.h index 9484bc0..d7907b9 100644 --- a/Swiften/Elements/StreamInitiationFileInfo.h +++ b/Swiften/Elements/StreamInitiationFileInfo.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2013 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -20,5 +20,5 @@ public: public: - StreamInitiationFileInfo(const std::string& name = "", const std::string& description = "", int size = 0, + StreamInitiationFileInfo(const std::string& name = "", const std::string& description = "", unsigned long long 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) {} @@ -40,9 +40,9 @@ public: } - void setSize(const boost::uintmax_t size) { + void setSize(const unsigned long long size) { this->size = size; } - boost::uintmax_t getSize() const { + unsigned long long getSize() const { return this->size; } @@ -80,10 +80,10 @@ public: } - void setRangeOffset(const int offset) { - supportsRangeRequests = offset >= 0 ? true : false; + void setRangeOffset(unsigned long long offset) { + supportsRangeRequests = true; rangeOffset = offset; } - int getRangeOffset() const { + unsigned long long getRangeOffset() const { return rangeOffset; } @@ -92,10 +92,10 @@ private: std::string name; std::string description; - boost::uintmax_t size; + unsigned long long size; std::string hash; boost::posix_time::ptime date; std::string algo; bool supportsRangeRequests; - boost::uintmax_t rangeOffset; + unsigned long long rangeOffset; }; diff --git a/Swiften/Elements/StreamManagementEnabled.cpp b/Swiften/Elements/StreamManagementEnabled.cpp index bab7516..1f1a1f5 100644 --- a/Swiften/Elements/StreamManagementEnabled.cpp +++ b/Swiften/Elements/StreamManagementEnabled.cpp @@ -1,4 +1,4 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -9,5 +9,5 @@ using namespace Swift; -StreamManagementEnabled::StreamManagementEnabled() { +StreamManagementEnabled::StreamManagementEnabled() : resumeSupported(false) { } diff --git a/Swiften/Elements/StreamManagementEnabled.h b/Swiften/Elements/StreamManagementEnabled.h index 02e77f3..bb1f858 100644 --- a/Swiften/Elements/StreamManagementEnabled.h +++ b/Swiften/Elements/StreamManagementEnabled.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010-2011 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -9,8 +9,9 @@ #include <string> -#include <Swiften/Elements/Element.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StreamManagementEnabled : public Element { + class SWIFTEN_API StreamManagementEnabled : public ToplevelElement { public: StreamManagementEnabled(); diff --git a/Swiften/Elements/StreamManagementFailed.h b/Swiften/Elements/StreamManagementFailed.h index 7c6d1b7..a90bddd 100644 --- a/Swiften/Elements/StreamManagementFailed.h +++ b/Swiften/Elements/StreamManagementFailed.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -7,9 +7,9 @@ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StreamManagementFailed : public Element { + class StreamManagementFailed : public ToplevelElement { public: StreamManagementFailed() {} diff --git a/Swiften/Elements/StreamResume.h b/Swiften/Elements/StreamResume.h index aec0909..e87dabb 100644 --- a/Swiften/Elements/StreamResume.h +++ b/Swiften/Elements/StreamResume.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -10,8 +10,8 @@ #include <boost/optional.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StreamResume : public Element { + class StreamResume : public ToplevelElement { public: StreamResume(); diff --git a/Swiften/Elements/StreamResumed.h b/Swiften/Elements/StreamResumed.h index cf9a755..7890901 100644 --- a/Swiften/Elements/StreamResumed.h +++ b/Swiften/Elements/StreamResumed.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2011 Remko Tronçon + * Copyright (c) 2011-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -10,8 +10,8 @@ #include <boost/optional.hpp> -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class StreamResumed : public Element { + class StreamResumed : public ToplevelElement { public: StreamResumed(); diff --git a/Swiften/Elements/TLSProceed.h b/Swiften/Elements/TLSProceed.h index 4bd790a..27faf26 100644 --- a/Swiften/Elements/TLSProceed.h +++ b/Swiften/Elements/TLSProceed.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -7,8 +7,8 @@ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class TLSProceed : public Element { + class TLSProceed : public ToplevelElement { public: TLSProceed() {} diff --git a/Swiften/Elements/ToplevelElement.cpp b/Swiften/Elements/ToplevelElement.cpp new file mode 100644 index 0000000..c58a914 --- /dev/null +++ b/Swiften/Elements/ToplevelElement.cpp @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2010-2014 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/ToplevelElement.h> + +namespace Swift { + +ToplevelElement::~ToplevelElement() { +} + +} diff --git a/Swiften/Elements/ToplevelElement.h b/Swiften/Elements/ToplevelElement.h new file mode 100644 index 0000000..bce90b9 --- /dev/null +++ b/Swiften/Elements/ToplevelElement.h @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2010-2014 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Element.h> + +namespace Swift { + class SWIFTEN_API ToplevelElement : public Element { + public: + ToplevelElement() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(ToplevelElement) + virtual ~ToplevelElement(); + }; +} diff --git a/Swiften/Elements/UnblockPayload.h b/Swiften/Elements/UnblockPayload.h index b6593ab..c5e7c80 100644 --- a/Swiften/Elements/UnblockPayload.h +++ b/Swiften/Elements/UnblockPayload.h @@ -15,5 +15,5 @@ namespace Swift { class UnblockPayload : public Payload { public: - UnblockPayload() { + UnblockPayload(const std::vector<JID>& jids = std::vector<JID>()) : items(jids) { } diff --git a/Swiften/Elements/UnitTest/FormTest.cpp b/Swiften/Elements/UnitTest/FormTest.cpp index 1134182..3000c22 100644 --- a/Swiften/Elements/UnitTest/FormTest.cpp +++ b/Swiften/Elements/UnitTest/FormTest.cpp @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2013 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -8,4 +8,5 @@ #include <cppunit/extensions/TestFactoryRegistry.h> #include <boost/shared_ptr.hpp> +#include <boost/smart_ptr/make_shared.hpp> #include <Swiften/Elements/Form.h> @@ -24,11 +25,11 @@ class FormTest : public CppUnit::TestFixture { Form form; - form.addField(FixedFormField::create("Foo")); + form.addField(boost::make_shared<FormField>(FormField::FixedType, "Foo")); - FormField::ref field = HiddenFormField::create("jabber:bot"); + FormField::ref field = boost::make_shared<FormField>(FormField::HiddenType, "jabber:bot"); field->setName("FORM_TYPE"); form.addField(field); - form.addField(FixedFormField::create("Bar")); + form.addField(boost::make_shared<FormField>(FormField::FixedType, "Bar")); CPPUNIT_ASSERT_EQUAL(std::string("jabber:bot"), form.getFormType()); @@ -38,5 +39,5 @@ class FormTest : public CppUnit::TestFixture { Form form; - FormField::ref field = FixedFormField::create("jabber:bot"); + FormField::ref field = boost::make_shared<FormField>(FormField::FixedType, "jabber:bot"); field->setName("FORM_TYPE"); form.addField(field); @@ -48,5 +49,5 @@ class FormTest : public CppUnit::TestFixture { Form form; - form.addField(FixedFormField::create("Foo")); + form.addField(boost::make_shared<FormField>(FormField::FixedType, "Foo")); CPPUNIT_ASSERT_EQUAL(std::string(""), form.getFormType()); diff --git a/Swiften/Elements/UnknownElement.h b/Swiften/Elements/UnknownElement.h index 100ba92..48072ef 100644 --- a/Swiften/Elements/UnknownElement.h +++ b/Swiften/Elements/UnknownElement.h @@ -1,4 +1,4 @@ /* - * Copyright (c) 2010 Remko Tronçon + * Copyright (c) 2010-2014 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. @@ -7,8 +7,8 @@ #pragma once -#include <Swiften/Elements/Element.h> +#include <Swiften/Elements/ToplevelElement.h> namespace Swift { - class UnknownElement : public Element { + class UnknownElement : public ToplevelElement { public: UnknownElement() {} diff --git a/Swiften/Elements/UserLocation.cpp b/Swiften/Elements/UserLocation.cpp new file mode 100644 index 0000000..6f78ccb --- /dev/null +++ b/Swiften/Elements/UserLocation.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/UserLocation.h> + +using namespace Swift; + +UserLocation::UserLocation() { +} + +UserLocation::~UserLocation() { +} diff --git a/Swiften/Elements/UserLocation.h b/Swiften/Elements/UserLocation.h new file mode 100644 index 0000000..817b259 --- /dev/null +++ b/Swiften/Elements/UserLocation.h @@ -0,0 +1,227 @@ +/* + * Copyright (c) 2013 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/optional.hpp> +#include <string> + + + +namespace Swift { + class SWIFTEN_API UserLocation : public Payload { + public: + + UserLocation(); + + virtual ~UserLocation(); + + const boost::optional< std::string >& getArea() const { + return area; + } + + void setArea(const boost::optional< std::string >& value) { + this->area = value ; + } + + const boost::optional< float >& getAltitude() const { + return altitude; + } + + void setAltitude(const boost::optional< float >& value) { + this->altitude = value ; + } + + const boost::optional< std::string >& getLocality() const { + return locality; + } + + void setLocality(const boost::optional< std::string >& value) { + this->locality = value ; + } + + const boost::optional< float >& getLatitude() const { + return latitude; + } + + void setLatitude(const boost::optional< float >& value) { + this->latitude = value ; + } + + const boost::optional< float >& getAccuracy() const { + return accuracy; + } + + void setAccuracy(const boost::optional< float >& value) { + this->accuracy = value ; + } + + const boost::optional< std::string >& getDescription() const { + return description; + } + + void setDescription(const boost::optional< std::string >& value) { + this->description = value ; + } + + const boost::optional< std::string >& getCountryCode() const { + return countryCode; + } + + void setCountryCode(const boost::optional< std::string >& value) { + this->countryCode = value ; + } + + const boost::optional< boost::posix_time::ptime >& getTimestamp() const { + return timestamp; + } + + void setTimestamp(const boost::optional< boost::posix_time::ptime >& value) { + this->timestamp = value ; + } + + const boost::optional< std::string >& getFloor() const { + return floor; + } + + void setFloor(const boost::optional< std::string >& value) { + this->floor = value ; + } + + const boost::optional< std::string >& getBuilding() const { + return building; + } + + void setBuilding(const boost::optional< std::string >& value) { + this->building = value ; + } + + const boost::optional< std::string >& getRoom() const { + return room; + } + + void setRoom(const boost::optional< std::string >& value) { + this->room = value ; + } + + const boost::optional< std::string >& getCountry() const { + return country; + } + + void setCountry(const boost::optional< std::string >& value) { + this->country = value ; + } + + const boost::optional< std::string >& getRegion() const { + return region; + } + + void setRegion(const boost::optional< std::string >& value) { + this->region = value ; + } + + const boost::optional< std::string >& getURI() const { + return uri; + } + + void setURI(const boost::optional< std::string >& value) { + this->uri = value ; + } + + const boost::optional< float >& getLongitude() const { + return longitude; + } + + void setLongitude(const boost::optional< float >& value) { + this->longitude = value ; + } + + const boost::optional< float >& getError() const { + return error; + } + + void setError(const boost::optional< float >& value) { + this->error = value ; + } + + const boost::optional< std::string >& getPostalCode() const { + return postalCode; + } + + void setPostalCode(const boost::optional< std::string >& value) { + this->postalCode = value ; + } + + const boost::optional< float >& getBearing() const { + return bearing; + } + + void setBearing(const boost::optional< float >& value) { + this->bearing = value ; + } + + const boost::optional< std::string >& getText() const { + return text; + } + + void setText(const boost::optional< std::string >& value) { + this->text = value ; + } + + const boost::optional< std::string >& getDatum() const { + return datum; + } + + void setDatum(const boost::optional< std::string >& value) { + this->datum = value ; + } + + const boost::optional< std::string >& getStreet() const { + return street; + } + + void setStreet(const boost::optional< std::string >& value) { + this->street = value ; + } + + const boost::optional< float >& getSpeed() const { + return speed; + } + + void setSpeed(const boost::optional< float >& value) { + this->speed = value ; + } + + + private: + boost::optional< std::string > area; + boost::optional< float > altitude; + boost::optional< std::string > locality; + boost::optional< float > latitude; + boost::optional< float > accuracy; + boost::optional< std::string > description; + boost::optional< std::string > countryCode; + boost::optional< boost::posix_time::ptime > timestamp; + boost::optional< std::string > floor; + boost::optional< std::string > building; + boost::optional< std::string > room; + boost::optional< std::string > country; + boost::optional< std::string > region; + boost::optional< std::string > uri; + boost::optional< float > longitude; + boost::optional< float > error; + boost::optional< std::string > postalCode; + boost::optional< float > bearing; + boost::optional< std::string > text; + boost::optional< std::string > datum; + boost::optional< std::string > street; + boost::optional< float > speed; + }; +} diff --git a/Swiften/Elements/UserTune.cpp b/Swiften/Elements/UserTune.cpp new file mode 100644 index 0000000..4b99e0a --- /dev/null +++ b/Swiften/Elements/UserTune.cpp @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2014 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#include <Swiften/Elements/UserTune.h> + +using namespace Swift; + +UserTune::UserTune() { +} + +UserTune::~UserTune() { +} diff --git a/Swiften/Elements/UserTune.h b/Swiften/Elements/UserTune.h new file mode 100644 index 0000000..968da17 --- /dev/null +++ b/Swiften/Elements/UserTune.h @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2014 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/Override.h> +#include <Swiften/Base/API.h> +#include <Swiften/Elements/Payload.h> +#include <boost/optional.hpp> +#include <string> + + + +namespace Swift { + class SWIFTEN_API UserTune : public Payload { + public: + + UserTune(); + + virtual ~UserTune(); + + const boost::optional< unsigned int >& getRating() const { + return rating; + } + + void setRating(const boost::optional< unsigned int >& value) { + this->rating = value ; + } + + const boost::optional< std::string >& getTitle() const { + return title; + } + + void setTitle(const boost::optional< std::string >& value) { + this->title = value ; + } + + const boost::optional< std::string >& getTrack() const { + return track; + } + + void setTrack(const boost::optional< std::string >& value) { + this->track = value ; + } + + const boost::optional< std::string >& getArtist() const { + return artist; + } + + void setArtist(const boost::optional< std::string >& value) { + this->artist = value ; + } + + const boost::optional< std::string >& getURI() const { + return uri; + } + + void setURI(const boost::optional< std::string >& value) { + this->uri = value ; + } + + const boost::optional< std::string >& getSource() const { + return source; + } + + void setSource(const boost::optional< std::string >& value) { + this->source = value ; + } + + const boost::optional< unsigned int >& getLength() const { + return length; + } + + void setLength(const boost::optional< unsigned int >& value) { + this->length = value ; + } + + + private: + boost::optional< unsigned int > rating; + boost::optional< std::string > title; + boost::optional< std::string > track; + boost::optional< std::string > artist; + boost::optional< std::string > uri; + boost::optional< std::string > source; + boost::optional< unsigned int > length; + }; +} diff --git a/Swiften/Elements/VCard.h b/Swiften/Elements/VCard.h index f9822c9..409a8ab 100644 --- a/Swiften/Elements/VCard.h +++ b/Swiften/Elements/VCard.h @@ -8,6 +8,8 @@ #include <boost/shared_ptr.hpp> +#include <boost/date_time/posix_time/ptime.hpp> #include <string> +#include <Swiften/JID/JID.h> #include <Swiften/Base/ByteArray.h> #include <Swiften/Elements/Payload.h> @@ -30,4 +32,69 @@ namespace Swift { }; + struct Telephone { + Telephone() : isHome(false), isWork(false), isVoice(false), isFax(false), isPager(false), isMSG(false), isCell(false), + isVideo(false), isBBS(false), isModem(false), isISDN(false), isPCS(false), isPreferred(false) { + } + + bool isHome; + bool isWork; + bool isVoice; + bool isFax; + bool isPager; + bool isMSG; + bool isCell; + bool isVideo; + bool isBBS; + bool isModem; + bool isISDN; + bool isPCS; + bool isPreferred; + std::string number; + }; + + enum DeliveryType { + DomesticDelivery, + InternationalDelivery, + None + }; + + struct Address { + Address() : isHome(false), isWork(false), isPostal(false), isParcel(false), deliveryType(None), isPreferred(false) { + } + + bool isHome; + bool isWork; + bool isPostal; + bool isParcel; + DeliveryType deliveryType; + bool isPreferred; + + std::string poBox; + std::string addressExtension; + std::string street; + std::string locality; + std::string region; + std::string postalCode; + std::string country; + }; + + struct AddressLabel { + AddressLabel() : isHome(false), isWork(false), isPostal(false), isParcel(false), deliveryType(None), isPreferred(false) { + } + + bool isHome; + bool isWork; + bool isPostal; + bool isParcel; + DeliveryType deliveryType; + bool isPreferred; + std::vector<std::string> lines; + }; + + struct Organization { + std::string name; + std::vector<std::string> units; + }; + VCard() {} @@ -79,6 +146,132 @@ namespace Swift { } + void clearEMailAddresses() { + emailAddresses_.clear(); + } + EMailAddress getPreferredEMailAddress() const; + void setBirthday(const boost::posix_time::ptime& birthday) { + birthday_ = birthday; + } + + const boost::posix_time::ptime& getBirthday() const { + return birthday_; + } + + const std::vector<Telephone>& getTelephones() const { + return telephones_; + } + + void addTelephone(const Telephone& phone) { + telephones_.push_back(phone); + } + + void clearTelephones() { + telephones_.clear(); + } + + const std::vector<Address>& getAddresses() const { + return addresses_; + } + + void addAddress(const Address& address) { + addresses_.push_back(address); + } + + void clearAddresses() { + addresses_.clear(); + } + + const std::vector<AddressLabel>& getAddressLabels() const { + return addressLabels_; + } + + void addAddressLabel(const AddressLabel& addressLabel) { + addressLabels_.push_back(addressLabel); + } + + void clearAddressLabels() { + addressLabels_.clear(); + } + + const std::vector<JID>& getJIDs() const { + return jids_; + } + + void addJID(const JID& jid) { + jids_.push_back(jid); + } + + void clearJIDs() { + jids_.clear(); + } + + const std::string& getDescription() const { + return description_; + } + + void setDescription(const std::string& description) { + this->description_ = description; + } + + const std::vector<Organization>& getOrganizations() const { + return organizations_; + } + + void addOrganization(const Organization& organization) { + organizations_.push_back(organization); + } + + void clearOrganizations() { + organizations_.clear(); + } + + const std::vector<std::string>& getTitles() const { + return titles_; + } + + void addTitle(const std::string& title) { + titles_.push_back(title); + } + + void clearTitles() { + titles_.clear(); + } + + const std::vector<std::string>& getRoles() const { + return roles_; + } + + void addRole(const std::string& role) { + roles_.push_back(role); + } + + void clearRoles() { + roles_.clear(); + } + + const std::vector<std::string>& getURLs() const { + return urls_; + } + + void addURL(const std::string& url) { + urls_.push_back(url); + } + + void clearURLs() { + urls_.clear(); + } + + bool isEmpty() const { + bool empty = version_.empty() && fullName_.empty() && familyName_.empty() && givenName_.empty() && middleName_.empty() && prefix_.empty() && suffix_.empty(); + empty &= photo_.empty() && photoType_.empty() && nick_.empty(); + empty &= birthday_.is_not_a_date_time(); + empty &= unknownContent_.empty(); + empty &= emailAddresses_.empty() && telephones_.empty() && addresses_.empty() && addressLabels_.empty() && jids_.empty(); + empty &= description_.empty() && organizations_.empty() && titles_.empty() && roles_.empty() && urls_.empty(); + return empty; + } + private: std::string version_; @@ -93,6 +286,16 @@ namespace Swift { std::string photoType_; std::string nick_; + boost::posix_time::ptime birthday_; std::string unknownContent_; std::vector<EMailAddress> emailAddresses_; + std::vector<Telephone> telephones_; + std::vector<Address> addresses_; + std::vector<AddressLabel> addressLabels_; + std::vector<JID> jids_; + std::string description_; + std::vector<Organization> organizations_; + std::vector<std::string> titles_; + std::vector<std::string> roles_; + std::vector<std::string> urls_; }; } diff --git a/Swiften/Elements/Whiteboard/WhiteboardColor.cpp b/Swiften/Elements/Whiteboard/WhiteboardColor.cpp new file mode 100644 index 0000000..f4ff01a --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardColor.cpp @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#include <Swiften/Elements/Whiteboard/WhiteboardColor.h> +#include <Swiften/Base/String.h> +#include <cstdio> +#include <iomanip> +#include <sstream> +#include <iostream> + +namespace Swift { + WhiteboardColor::WhiteboardColor() : red_(0), green_(0), blue_(0), alpha_(255) { + } + + WhiteboardColor::WhiteboardColor(int red, int green, int blue, int alpha) : red_(red), green_(green), blue_(blue), alpha_(alpha) { + } + + WhiteboardColor::WhiteboardColor(const std::string& hex) : alpha_(255) { + int value = String::convertHexStringToInt(hex.substr(1)); + red_ = (value >> 16)&0xFF; + green_ = (value >> 8)&0xFF; + blue_ = value&0xFF; + } + + std::string WhiteboardColor::toHex() const { + std::string value = String::convertIntToHexString((red_ << 16) + (green_ << 8) + blue_); + while (value.size() < 6) { + value.insert(0, "0"); + } + return "#"+value; + } + + int WhiteboardColor::getRed() const { + return red_; + } + + int WhiteboardColor::getGreen() const { + return green_; + } + + int WhiteboardColor::getBlue() const { + return blue_; + } + + int WhiteboardColor::getAlpha() const { + return alpha_; + } + + void WhiteboardColor::setAlpha(int alpha) { + alpha_ = alpha; + } +} diff --git a/Swiften/Elements/Whiteboard/WhiteboardColor.h b/Swiften/Elements/Whiteboard/WhiteboardColor.h new file mode 100644 index 0000000..3b3d93c --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardColor.h @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <string> + +#include <Swiften/Base/API.h> + +namespace Swift { + class SWIFTEN_API WhiteboardColor { + public: + WhiteboardColor(); + WhiteboardColor(int red, int green, int blue, int alpha = 255); + WhiteboardColor(const std::string& hex); + std::string toHex() const; + int getRed() const; + int getGreen() const; + int getBlue() const; + int getAlpha() const; + void setAlpha(int alpha); + + private: + int red_, green_, blue_; + int alpha_; + }; +} diff --git a/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h b/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h new file mode 100644 index 0000000..95015c9 --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardDeleteOperation.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/Elements/Whiteboard/WhiteboardOperation.h> + +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> + +namespace Swift { + class WhiteboardDeleteOperation : public WhiteboardOperation { + public: + typedef boost::shared_ptr<WhiteboardDeleteOperation> ref; + public: + std::string getElementID() const { + return elementID_; + } + + void setElementID(const std::string& elementID) { + elementID_ = elementID; + } + + private: + std::string elementID_; + }; +} diff --git a/Swiften/Elements/Whiteboard/WhiteboardElement.h b/Swiften/Elements/Whiteboard/WhiteboardElement.h new file mode 100644 index 0000000..df774d9 --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardElement.h @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <boost/shared_ptr.hpp> +#include <Swiften/Elements/Whiteboard/WhiteboardElementVisitor.h> + +namespace Swift { + class WhiteboardElement { + public: + typedef boost::shared_ptr<WhiteboardElement> ref; + + public: + virtual ~WhiteboardElement() {} + virtual void accept(WhiteboardElementVisitor& visitor) = 0; + + const std::string& getID() const { + return id_; + } + + void setID(const std::string& id) { + id_ = id; + } + + private: + std::string id_; + }; +} diff --git a/Swiften/Elements/Whiteboard/WhiteboardElementVisitor.h b/Swiften/Elements/Whiteboard/WhiteboardElementVisitor.h new file mode 100644 index 0000000..413d6cf --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardElementVisitor.h @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +namespace Swift { + class WhiteboardLineElement; + class WhiteboardFreehandPathElement; + class WhiteboardRectElement; + class WhiteboardPolygonElement; + class WhiteboardTextElement; + class WhiteboardEllipseElement; + + class WhiteboardElementVisitor { + public: + virtual ~WhiteboardElementVisitor() {} + virtual void visit(WhiteboardLineElement& /*element*/) = 0; + virtual void visit(WhiteboardFreehandPathElement& /*element*/) = 0; + virtual void visit(WhiteboardRectElement& /*element*/) = 0; + virtual void visit(WhiteboardPolygonElement& /*element*/) = 0; + virtual void visit(WhiteboardTextElement& /*element*/) = 0; + virtual void visit(WhiteboardEllipseElement& /*element*/) = 0; + }; +} diff --git a/Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h b/Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h new file mode 100644 index 0000000..0078479 --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardEllipseElement.h @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> +#include <Swiften/Elements/Whiteboard/WhiteboardColor.h> + +namespace Swift { + class WhiteboardEllipseElement : public WhiteboardElement { + public: + typedef boost::shared_ptr<WhiteboardEllipseElement> ref; + public: + WhiteboardEllipseElement(int cx, int cy, int rx, int ry) { + cx_ = cx; + cy_ = cy; + rx_ = rx; + ry_ = ry; + } + + int getCX() const { + return cx_; + } + + int getCY() const { + return cy_; + } + + int getRX() const { + return rx_; + } + + int getRY() const { + return ry_; + } + + const WhiteboardColor& getPenColor() const { + return penColor_; + } + + void setPenColor(const WhiteboardColor& color) { + penColor_ = color; + } + + const WhiteboardColor& getBrushColor() const { + return brushColor_; + } + + void setBrushColor(const WhiteboardColor& color) { + brushColor_ = color; + } + + int getPenWidth() const { + return penWidth_; + } + + void setPenWidth(const int penWidth) { + penWidth_ = penWidth; + } + + void accept(WhiteboardElementVisitor& visitor) { + visitor.visit(*this); + } + + private: + int cx_, cy_, rx_, ry_; + WhiteboardColor penColor_; + WhiteboardColor brushColor_; + int penWidth_; + }; +} diff --git a/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h b/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h new file mode 100644 index 0000000..bcf3bf9 --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardFreehandPathElement.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> +#include <Swiften/Elements/Whiteboard/WhiteboardColor.h> + +#include <vector> +#include <utility> + +namespace Swift { + class WhiteboardFreehandPathElement : public WhiteboardElement { + typedef std::pair<int, int> Point; + public: + typedef boost::shared_ptr<WhiteboardFreehandPathElement> ref; + public: + WhiteboardFreehandPathElement() { + } + + void setPoints(const std::vector<Point>& points) { + points_ = points; + } + + const std::vector<Point>& getPoints() const { + return points_; + } + + const WhiteboardColor& getColor() const { + return color_; + } + + void setColor(const WhiteboardColor& color) { + color_ = color; + } + + int getPenWidth() const { + return penWidth_; + } + + void setPenWidth(const int penWidth) { + penWidth_ = penWidth; + } + + void accept(WhiteboardElementVisitor& visitor) { + visitor.visit(*this); + } + + private: + std::vector<Point> points_; + WhiteboardColor color_; + int penWidth_; + }; +} diff --git a/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h b/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h new file mode 100644 index 0000000..fd52405 --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardInsertOperation.h @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/Elements/Whiteboard/WhiteboardOperation.h> + +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> + +namespace Swift { + class WhiteboardInsertOperation : public WhiteboardOperation { + public: + typedef boost::shared_ptr<WhiteboardInsertOperation> ref; + public: + WhiteboardElement::ref getElement() const { + return element_; + } + + void setElement(WhiteboardElement::ref element) { + element_ = element; + } + + private: + WhiteboardElement::ref element_; + }; +} diff --git a/Swiften/Elements/Whiteboard/WhiteboardLineElement.h b/Swiften/Elements/Whiteboard/WhiteboardLineElement.h new file mode 100644 index 0000000..df6e7d6 --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardLineElement.h @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +/* + * Copyright (c) 2014 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + + +#pragma once + +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> +#include <Swiften/Elements/Whiteboard/WhiteboardColor.h> + +namespace Swift { + class WhiteboardLineElement : public WhiteboardElement { + public: + typedef boost::shared_ptr<WhiteboardLineElement> ref; + public: + WhiteboardLineElement(int x1, int y1, int x2, int y2) : penWidth_(1) { + x1_ = x1; + y1_ = y1; + x2_ = x2; + y2_ = y2; + } + + int x1() const { + return x1_; + } + + int y1() const { + return y1_; + } + + int x2() const { + return x2_; + } + + int y2() const { + return y2_; + } + + const WhiteboardColor& getColor() const { + return color_; + } + + void setColor(const WhiteboardColor& color) { + color_ = color; + } + + int getPenWidth() const { + return penWidth_; + } + + void setPenWidth(const int penWidth) { + penWidth_ = penWidth; + } + + void accept(WhiteboardElementVisitor& visitor) { + visitor.visit(*this); + } + + private: + int x1_, y1_, x2_, y2_; + WhiteboardColor color_; + int penWidth_; + }; +} diff --git a/Swiften/Elements/Whiteboard/WhiteboardOperation.h b/Swiften/Elements/Whiteboard/WhiteboardOperation.h new file mode 100644 index 0000000..497d551 --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardOperation.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/Base/API.h> +#include <boost/smart_ptr/shared_ptr.hpp> +#include <string> + +namespace Swift { + class WhiteboardOperation { + public: + typedef boost::shared_ptr<WhiteboardOperation> ref; + public: + WhiteboardOperation() {} + SWIFTEN_DEFAULT_COPY_CONSTRUCTOR(WhiteboardOperation) + virtual ~WhiteboardOperation(){} + + std::string getID() const { + return id_; + } + + void setID(const std::string& id) { + id_ = id; + } + + std::string getParentID() const { + return parentID_; + } + + void setParentID(const std::string& parentID) { + parentID_ = parentID; + } + + int getPos() const { + return pos_; + } + + void setPos(int pos) { + pos_ = pos; + } + + private: + std::string id_; + std::string parentID_; + int pos_; + }; +} diff --git a/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h b/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h new file mode 100644 index 0000000..679ac01 --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardPolygonElement.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> +#include <Swiften/Elements/Whiteboard/WhiteboardColor.h> + +namespace Swift { + class WhiteboardPolygonElement : public WhiteboardElement { + typedef std::pair<int, int> Point; + public: + typedef boost::shared_ptr<WhiteboardPolygonElement> ref; + public: + WhiteboardPolygonElement() { + } + + const std::vector<Point>& getPoints() const { + return points_; + } + + void setPoints(const std::vector<Point>& points) { + points_ = points; + } + + const WhiteboardColor& getPenColor() const { + return penColor_; + } + + void setPenColor(const WhiteboardColor& color) { + penColor_ = color; + } + + const WhiteboardColor& getBrushColor() const { + return brushColor_; + } + + void setBrushColor(const WhiteboardColor& color) { + brushColor_ = color; + } + + int getPenWidth() const { + return penWidth_; + } + + void setPenWidth(const int penWidth) { + penWidth_ = penWidth; + } + + void accept(WhiteboardElementVisitor& visitor) { + visitor.visit(*this); + } + + private: + std::vector<Point> points_; + WhiteboardColor penColor_; + WhiteboardColor brushColor_; + int penWidth_; + }; +} diff --git a/Swiften/Elements/Whiteboard/WhiteboardRectElement.h b/Swiften/Elements/Whiteboard/WhiteboardRectElement.h new file mode 100644 index 0000000..0fd1338 --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardRectElement.h @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +/* + * Copyright (c) 2014 Remko Tronçon + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> +#include <Swiften/Elements/Whiteboard/WhiteboardColor.h> + +namespace Swift { + class WhiteboardRectElement : public WhiteboardElement { + public: + typedef boost::shared_ptr<WhiteboardRectElement> ref; + public: + WhiteboardRectElement(int x, int y, int width, int height) : penWidth_(1) { + x_ = x; + y_ = y; + width_ = width; + height_ = height; + } + + int getX() const { + return x_; + } + + int getY() const { + return y_; + } + + int getWidth() const { + return width_; + } + + int getHeight() const { + return height_; + } + + const WhiteboardColor& getPenColor() const { + return penColor_; + } + + void setPenColor(const WhiteboardColor& color) { + penColor_ = color; + } + + const WhiteboardColor& getBrushColor() const { + return brushColor_; + } + + void setBrushColor(const WhiteboardColor& color) { + brushColor_ = color; + } + + int getPenWidth() const { + return penWidth_; + } + + void setPenWidth(const int penWidth) { + penWidth_ = penWidth; + } + + void accept(WhiteboardElementVisitor& visitor) { + visitor.visit(*this); + } + + private: + int x_, y_, width_, height_; + WhiteboardColor penColor_; + WhiteboardColor brushColor_; + int penWidth_; + }; +} diff --git a/Swiften/Elements/Whiteboard/WhiteboardTextElement.h b/Swiften/Elements/Whiteboard/WhiteboardTextElement.h new file mode 100644 index 0000000..7118ac9 --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardTextElement.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> +#include <Swiften/Elements/Whiteboard/WhiteboardColor.h> + +namespace Swift { + class WhiteboardTextElement : public WhiteboardElement { + public: + typedef boost::shared_ptr<WhiteboardTextElement> ref; + public: + WhiteboardTextElement(int x, int y) { + x_ = x; + y_ = y; + } + + void setText(const std::string text) { + text_ = text; + } + + const std::string& getText() const { + return text_; + } + + int getX() const { + return x_; + } + + int getY() const { + return y_; + } + + const WhiteboardColor& getColor() const { + return color_; + } + + void setColor(const WhiteboardColor& color) { + color_ = color; + } + + int getSize() const { + return size_; + } + + void setSize(const int size) { + size_ = size; + } + + void accept(WhiteboardElementVisitor& visitor) { + visitor.visit(*this); + } + + private: + int x_, y_; + int size_; + std::string text_; + WhiteboardColor color_; + }; +} diff --git a/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h b/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h new file mode 100644 index 0000000..a68cc7d --- /dev/null +++ b/Swiften/Elements/Whiteboard/WhiteboardUpdateOperation.h @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <Swiften/Elements/Whiteboard/WhiteboardOperation.h> + +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> + +namespace Swift { + class WhiteboardUpdateOperation : public WhiteboardOperation { + public: + typedef boost::shared_ptr<WhiteboardUpdateOperation> ref; + public: + WhiteboardElement::ref getElement() const { + return element_; + } + + void setElement(WhiteboardElement::ref element) { + element_ = element; + } + + int getNewPos() const { + return newPos_; + } + + void setNewPos(int newPos) { + newPos_ = newPos; + } + + private: + WhiteboardElement::ref element_; + int newPos_; + }; +} diff --git a/Swiften/Elements/WhiteboardPayload.h b/Swiften/Elements/WhiteboardPayload.h new file mode 100644 index 0000000..ceb2b27 --- /dev/null +++ b/Swiften/Elements/WhiteboardPayload.h @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2012 Mateusz Piękos + * Licensed under the simplified BSD license. + * See Documentation/Licenses/BSD-simplified.txt for more information. + */ + +#pragma once + +#include <string> + +#include <Swiften/Elements/Payload.h> +#include <Swiften/Elements/Whiteboard/WhiteboardElement.h> +#include <Swiften/Elements/Whiteboard/WhiteboardOperation.h> + +namespace Swift { + class WhiteboardPayload : public Payload { + public: + typedef boost::shared_ptr<WhiteboardPayload> ref; + + public: + enum Type {UnknownType, Data, SessionRequest, SessionAccept, SessionTerminate}; + + WhiteboardPayload(Type type = WhiteboardPayload::Data) : type_(type) { + } + + void setData(const std::string &data) { + data_ = data; + } + + std::string getData() const { + return data_; + } + + Type getType() const { + return type_; + } + + void setType(Type type) { + type_ = type; + } + + WhiteboardElement::ref getElement() const { + return element_; + } + + void setElement(WhiteboardElement::ref element) { + element_ = element; + } + + WhiteboardOperation::ref getOperation() const { + return operation_; + } + + void setOperation(WhiteboardOperation::ref operation) { + operation_ = operation; + } + + private: + std::string data_; + Type type_; + WhiteboardElement::ref element_; + WhiteboardOperation::ref operation_; + }; +} |