From 1356add7e274170c9af313f49d9a448fda503f5d Mon Sep 17 00:00:00 2001 From: Richard Maudsley Date: Mon, 7 Apr 2014 15:18:41 +0100 Subject: Don't show multiple Recents with the same occupants Change-Id: I1ac3f106ea8062d0f831beaf59fe3932a373ce3a 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 @@ -26,8 +26,25 @@ namespace Swift { : jid(jid), chatName(chatName), activity(activity), statusType(statusType), isMUC(isMUC), nick(nick), unreadCount(unreadCount), avatarPath(avatarPath) {} /** Assume that nicks and other transient features aren't important for equality */ bool operator==(const Chat& other) const { - return jid.toBare() == other.jid.toBare() - && isMUC == other.isMUC; + if (impromptuJIDs.empty()) { + return jid.toBare() == other.jid.toBare() + && isMUC == other.isMUC; + } else { /* compare the chat occupant lists */ + typedef std::map 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) { unreadCount = unread; -- cgit v0.10.2-6-g49f6