summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Elements')
-rw-r--r--Swiften/Elements/DiscoInfo.cpp3
-rw-r--r--Swiften/Elements/DiscoInfo.h3
-rw-r--r--Swiften/Elements/ReferencePayload.cpp63
-rw-r--r--Swiften/Elements/ReferencePayload.h62
4 files changed, 129 insertions, 2 deletions
diff --git a/Swiften/Elements/DiscoInfo.cpp b/Swiften/Elements/DiscoInfo.cpp
index 11f0623..701ed40 100644
--- a/Swiften/Elements/DiscoInfo.cpp
+++ b/Swiften/Elements/DiscoInfo.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2015 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -26,6 +26,7 @@ const std::string DiscoInfo::MessageDeliveryReceiptsFeature = std::string("urn:x
const std::string DiscoInfo::WhiteboardFeature = std::string("http://swift.im/whiteboard");
const std::string DiscoInfo::BlockingCommandFeature = std::string("urn:xmpp:blocking");
const std::string DiscoInfo::MessageCarbonsFeature = std::string("urn:xmpp:carbons:2");
+const std::string DiscoInfo::ReferencesFeature = std::string("urn:xmpp:references:0");
bool DiscoInfo::Identity::operator<(const Identity& other) const {
if (category_ == other.category_) {
diff --git a/Swiften/Elements/DiscoInfo.h b/Swiften/Elements/DiscoInfo.h
index c8009ee..713eaba 100644
--- a/Swiften/Elements/DiscoInfo.h
+++ b/Swiften/Elements/DiscoInfo.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2018 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -37,6 +37,7 @@ namespace Swift {
static const std::string WhiteboardFeature;
static const std::string BlockingCommandFeature;
static const std::string MessageCarbonsFeature;
+ static const std::string ReferencesFeature;
class Identity {
public:
diff --git a/Swiften/Elements/ReferencePayload.cpp b/Swiften/Elements/ReferencePayload.cpp
new file mode 100644
index 0000000..288f28f
--- /dev/null
+++ b/Swiften/Elements/ReferencePayload.cpp
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2018 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#include <Swiften/Elements/ReferencePayload.h>
+
+namespace Swift {
+
+ReferencePayload::ReferencePayload()
+ : type_(Type::Data) {
+}
+
+const ReferencePayload::Type& ReferencePayload::getType() const {
+ return type_;
+}
+
+void ReferencePayload::setType(const ReferencePayload::Type& type) {
+ type_ = type;
+}
+
+const boost::optional<std::string>& ReferencePayload::getUri() const {
+ return uri_;
+}
+
+void ReferencePayload::setUri(const boost::optional<std::string>& uri) {
+ uri_ = uri;
+}
+
+const boost::optional<std::string>& ReferencePayload::getBegin() const {
+ return begin_;
+}
+
+void ReferencePayload::setBegin(const boost::optional<std::string>& begin) {
+ begin_ = begin;
+}
+
+const boost::optional<std::string>& ReferencePayload::getEnd() const {
+ return end_;
+}
+
+void ReferencePayload::setEnd(const boost::optional<std::string>& end) {
+ end_ = end;
+}
+
+const boost::optional<std::string>& ReferencePayload::getAnchor() const {
+ return anchor_;
+}
+
+void ReferencePayload::setAnchor(const boost::optional<std::string>& anchor) {
+ anchor_ = anchor;
+}
+
+const std::vector<std::shared_ptr<Payload>>& ReferencePayload::getPayloads() const {
+ return payloads_;
+}
+
+void ReferencePayload::addPayload(const std::shared_ptr<Payload>& payload) {
+ payloads_.push_back(payload);
+}
+
+}
diff --git a/Swiften/Elements/ReferencePayload.h b/Swiften/Elements/ReferencePayload.h
new file mode 100644
index 0000000..b9a394e
--- /dev/null
+++ b/Swiften/Elements/ReferencePayload.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2018 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <string>
+#include <vector>
+
+#include <boost/optional.hpp>
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/Payload.h>
+
+namespace Swift {
+ /**
+ * reference from XEP-0372
+ */
+ class SWIFTEN_API ReferencePayload : public Payload {
+
+ public:
+
+ typedef std::shared_ptr<ReferencePayload> ref;
+
+ enum class Type {
+ Data,
+ Mention,
+ PubSub,
+ Unknown
+ };
+
+ ReferencePayload();
+
+ const Type& getType() const;
+ const boost::optional<std::string>& getUri() const;
+ const boost::optional<std::string>& getBegin() const;
+ const boost::optional<std::string>& getEnd() const;
+ const boost::optional<std::string>& getAnchor() const;
+
+ const std::vector<std::shared_ptr<Payload>>& getPayloads() const;
+
+ void setType(const Type& type);
+ void setUri(const boost::optional<std::string>& uri);
+ void setBegin(const boost::optional<std::string>& begin);
+ void setEnd(const boost::optional<std::string>& end);
+ void setAnchor(const boost::optional<std::string>& anchor);
+
+ void addPayload(const std::shared_ptr<Payload>& payload);
+
+ private:
+
+ Type type_;
+ boost::optional<std::string> uri_;
+ boost::optional<std::string> begin_;
+ boost::optional<std::string> end_;
+ boost::optional<std::string> anchor_;
+
+ std::vector<std::shared_ptr<Payload>> payloads_;
+ };
+}