summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2016-08-17 09:02:24 (GMT)
committerTobias Markmann <tm@ayena.de>2017-04-18 15:38:43 (GMT)
commit57a611f942f2387e497334888a4bc4f68b9275c9 (patch)
tree4785288a4aca2ac31f1de50c71a1d782b7d5ae6a /Swiften
parent476e2b32106449dc52a0b237caeb0492fe6c9c32 (diff)
downloadswift-57a611f942f2387e497334888a4bc4f68b9275c9.zip
swift-57a611f942f2387e497334888a4bc4f68b9275c9.tar.bz2
Support Last Message Correction in multi client scenarios
Previously Last Message Correction edits are only applied if they came from the same resource. This makes sense in MUC scenarios but does not in 1-to-1 chats. This changes the Last Message Correction behaviour for MUC and 1-to-1 chats so that different clients from the same bare JID can edit each others messages. Test-Information: Added unit test to verify Last Message Corrections work as expected when coming from the same client and from different clients. Manually verified that the receiving client correctly shows a corrected message if the sending client reconnected between first message and edit. All unit tests pass on OS X 10.11.6 with Qt 5.5.1. Change-Id: If533ecc7032e59e324979c577726f2da739012e6
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Base/LogSerializers.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/Swiften/Base/LogSerializers.h b/Swiften/Base/LogSerializers.h
index b804808..7f73686 100644
--- a/Swiften/Base/LogSerializers.h
+++ b/Swiften/Base/LogSerializers.h
@@ -6,9 +6,11 @@
#pragma once
+#include <map>
#include <memory>
#include <ostream>
#include <string>
+#include <utility>
#include <vector>
#include <boost/optional.hpp>
@@ -40,11 +42,33 @@ std::ostream& operator<<(std::ostream& stream, const std::vector<T>& vec) {
for (auto end = std::end(vec); it != end; ++it) {
stream << ", " << *it;
}
- }
+ }
stream << "]";
return stream;
}
+template <typename KEY, typename VALUE>
+std::ostream& operator<<(std::ostream& stream, const std::pair<KEY, VALUE>& pair) {
+ stream << pair.first << ":" << pair.second;
+ return stream;
+}
+
+template <typename KEY, typename VALUE>
+std::ostream& operator<<(std::ostream& stream, const std::map<KEY, VALUE>& map) {
+ stream << "{";
+ if (!map.empty()) {
+ auto it = std::begin(map);
+ stream << *it;
+
+ ++it;
+ for (auto end = std::end(map); it != end; ++it) {
+ stream << ", " << *it;
+ }
+ }
+ stream << "}";
+ return stream;
+}
+
std::ostream& operator<<(std::ostream& stream, const Presence& presence);
std::ostream& operator<<(std::ostream& stream, const BOSHError& boshError);