summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-02-25 13:19:11 (GMT)
committerSwift Review <review@swift.im>2014-04-24 13:06:33 (GMT)
commite4704555946626980014d936dcfe6ede2710501b (patch)
tree59d0db1bad3d4a0f74c89da8834b2002369c3b4b /Swiften/Elements
parent09e9713028b728fad9050c4e20180cc96c4572ce (diff)
downloadswift-e4704555946626980014d936dcfe6ede2710501b.zip
swift-e4704555946626980014d936dcfe6ede2710501b.tar.bz2
Added MAM parsers, serializers and tests.
Change-Id: I589a7c65664bfecfd0ac34240600dcccb4cbd40e
Diffstat (limited to 'Swiften/Elements')
-rw-r--r--Swiften/Elements/Forwarded.cpp12
-rw-r--r--Swiften/Elements/Forwarded.h32
-rw-r--r--Swiften/Elements/MAMArchived.cpp12
-rw-r--r--Swiften/Elements/MAMArchived.h29
-rw-r--r--Swiften/Elements/MAMQuery.cpp12
-rw-r--r--Swiften/Elements/MAMQuery.h36
-rw-r--r--Swiften/Elements/MAMResult.cpp12
-rw-r--r--Swiften/Elements/MAMResult.h29
-rw-r--r--Swiften/Elements/ResultSet.cpp12
-rw-r--r--Swiften/Elements/ResultSet.h44
10 files changed, 230 insertions, 0 deletions
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/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/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..871b699
--- /dev/null
+++ b/Swiften/Elements/ResultSet.h
@@ -0,0 +1,44 @@
+/*
+ * 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 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> after_;
+ };
+}