summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Maudsley <richard.maudsley@isode.com>2014-04-07 14:18:41 (GMT)
committerRichard Maudsley <richard.maudsley@isode.com>2014-04-07 14:20:58 (GMT)
commit1356add7e274170c9af313f49d9a448fda503f5d (patch)
tree415b02cfd9d85fc6e9f0e16a3aa96b5b6e2a3794
parent5e9fefcc3a1ab106c44a80e12d6e34b7fb3d0397 (diff)
downloadswift-contrib-1356add7e274170c9af313f49d9a448fda503f5d.zip
swift-contrib-1356add7e274170c9af313f49d9a448fda503f5d.tar.bz2
Don't show multiple Recents with the same occupants
Change-Id: I1ac3f106ea8062d0f831beaf59fe3932a373ce3a
-rw-r--r--Swift/Controllers/UIInterfaces/ChatListWindow.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/Swift/Controllers/UIInterfaces/ChatListWindow.h b/Swift/Controllers/UIInterfaces/ChatListWindow.h
index b189e72..67cd0ff 100644
--- a/Swift/Controllers/UIInterfaces/ChatListWindow.h
+++ b/Swift/Controllers/UIInterfaces/ChatListWindow.h
@@ -27,6 +27,23 @@ namespace Swift {
/** Assume that nicks and other transient features aren't important for equality */
bool operator==(const Chat& other) const {
+ if (impromptuJIDs.empty()) {
return jid.toBare() == other.jid.toBare()
&& isMUC == other.isMUC;
+ } else { /* compare the chat occupant lists */
+ typedef std::map<std::string, JID> JIDMap;
+ foreach (const JIDMap::value_type& jid, impromptuJIDs) {
+ bool found = false;
+ foreach (const JIDMap::value_type& otherJID, other.impromptuJIDs) {
+ if (jid.second.toBare() == otherJID.second.toBare()) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ return false;
+ }
+ }
+ return true;
+ }
}
void setUnreadCount(int unread) {