summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-06-10 10:59:04 (GMT)
committerKevin Smith <kevin.smith@isode.com>2016-07-01 12:18:48 (GMT)
commitb16a2d1483f59ad93a2171c6c286e12f4ebbf3be (patch)
treef49c9ba36649797070a84955423e4611dae7dd8a /Swiften
parenta1be6105b97dddc1e03db0075f6ca3fc47fa8e1d (diff)
downloadswift-b16a2d1483f59ad93a2171c6c286e12f4ebbf3be.zip
swift-b16a2d1483f59ad93a2171c6c286e12f4ebbf3be.tar.bz2
Implement Message Carbons in Swift and Swift/Controllers
If the server supports message carbons, Swift will try to enable it. Carbon copied messages will open a chat window in the background if no chat window exists for the conversation. Test-Information: Tested with a XMPP server Swift and a mobile Android client all supporting message carbons. Tested direct messages and MUC PM messages. All working as expected. Added unit tests for message carbons of sent messages and message carbons of received messages. All unit tests pass on OS X 10.11.5 Change-Id: I8d5b5d9975651a2353909dea976f58e4bf12e014
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Elements/DiscoInfo.cpp1
-rw-r--r--Swiften/Elements/DiscoInfo.h1
-rw-r--r--Swiften/Elements/Forwarded.h6
-rw-r--r--Swiften/Queries/Requests/EnableCarbonsRequest.h28
4 files changed, 34 insertions, 2 deletions
diff --git a/Swiften/Elements/DiscoInfo.cpp b/Swiften/Elements/DiscoInfo.cpp
index 29676b5..51a4450 100644
--- a/Swiften/Elements/DiscoInfo.cpp
+++ b/Swiften/Elements/DiscoInfo.cpp
@@ -24,6 +24,7 @@ const std::string DiscoInfo::Bytestream = std::string("http://jabber.org/protoco
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");
+const std::string DiscoInfo::MessageCarbonsFeature = std::string("urn:xmpp:carbons:2");
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 6ce3fbb..ebc598c 100644
--- a/Swiften/Elements/DiscoInfo.h
+++ b/Swiften/Elements/DiscoInfo.h
@@ -35,6 +35,7 @@ namespace Swift {
static const std::string MessageDeliveryReceiptsFeature;
static const std::string WhiteboardFeature;
static const std::string BlockingCommandFeature;
+ static const std::string MessageCarbonsFeature;
class Identity {
public:
diff --git a/Swiften/Elements/Forwarded.h b/Swiften/Elements/Forwarded.h
index 1a31b89..a7eb492 100644
--- a/Swiften/Elements/Forwarded.h
+++ b/Swiften/Elements/Forwarded.h
@@ -6,8 +6,7 @@
#pragma once
-#include <boost/date_time/posix_time/posix_time.hpp>
-#include <boost/optional.hpp>
+#include <memory>
#include <Swiften/Base/API.h>
#include <Swiften/Elements/Payload.h>
@@ -18,6 +17,9 @@ namespace Swift {
class SWIFTEN_API Forwarded : public Payload {
public:
+ typedef std::shared_ptr<Forwarded> ref;
+
+ public:
virtual ~Forwarded();
void setDelay(std::shared_ptr<Delay> delay) { delay_ = delay; }
diff --git a/Swiften/Queries/Requests/EnableCarbonsRequest.h b/Swiften/Queries/Requests/EnableCarbonsRequest.h
new file mode 100644
index 0000000..7762e68
--- /dev/null
+++ b/Swiften/Queries/Requests/EnableCarbonsRequest.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2016 Isode Limited.
+ * All rights reserved.
+ * See the COPYING file for more information.
+ */
+
+#pragma once
+
+#include <memory>
+
+#include <Swiften/Base/API.h>
+#include <Swiften/Elements/CarbonsEnable.h>
+#include <Swiften/Queries/GenericRequest.h>
+
+namespace Swift {
+ class SWIFTEN_API EnableCarbonsRequest : public GenericRequest<CarbonsEnable> {
+ public:
+ typedef std::shared_ptr<EnableCarbonsRequest> ref;
+
+ static ref create(IQRouter* router) {
+ return ref(new EnableCarbonsRequest(router));
+ }
+
+ private:
+ EnableCarbonsRequest(IQRouter* router) : GenericRequest<CarbonsEnable>(IQ::Set, JID(), std::make_shared<CarbonsEnable>(), router) {
+ }
+ };
+}