summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften')
-rw-r--r--Swiften/Base/Algorithm.h8
-rw-r--r--Swiften/Client/DummyStanzaChannel.h14
2 files changed, 18 insertions, 4 deletions
diff --git a/Swiften/Base/Algorithm.h b/Swiften/Base/Algorithm.h
index c481aa8..108dbe3 100644
--- a/Swiften/Base/Algorithm.h
+++ b/Swiften/Base/Algorithm.h
@@ -154,2 +154,10 @@ namespace Swift {
};
+
+ template <typename Map>
+ bool key_compare(Map const& lhs, Map const& rhs) {
+
+ auto pred = [](decltype(*lhs.begin()) a, decltype(a) b) { return a.first == b.first; };
+
+ return lhs.size() == rhs.size() && std::equal(lhs.begin(), lhs.end(), rhs.begin(), pred);
+ }
}
diff --git a/Swiften/Client/DummyStanzaChannel.h b/Swiften/Client/DummyStanzaChannel.h
index fc2f05b..4cc0f7e 100644
--- a/Swiften/Client/DummyStanzaChannel.h
+++ b/Swiften/Client/DummyStanzaChannel.h
@@ -1,3 +1,3 @@
/*
- * Copyright (c) 2010-2016 Isode Limited.
+ * Copyright (c) 2010-2017 Isode Limited.
* All rights reserved.
@@ -15,3 +15,3 @@ namespace Swift {
public:
- DummyStanzaChannel() : available_(true) {}
+ DummyStanzaChannel() {}
@@ -39,3 +39,7 @@ namespace Swift {
virtual std::string getNewIQID() {
- return "test-id";
+ std::string id = "test-id";
+ if (uniqueIDs_) {
+ id += "-" + std::to_string(idCounter_++);
+ }
+ return id;
}
@@ -96,3 +100,5 @@ namespace Swift {
std::vector<std::shared_ptr<Stanza> > sentStanzas;
- bool available_;
+ bool available_ = true;
+ bool uniqueIDs_ = false;
+ unsigned int idCounter_ = 0;
};