diff options
| author | Richard Maudsley <richard.maudsley@isode.com> | 2014-04-07 14:18:41 (GMT) | 
|---|---|---|
| committer | Richard Maudsley <richard.maudsley@isode.com> | 2014-04-07 14:20:58 (GMT) | 
| commit | 1356add7e274170c9af313f49d9a448fda503f5d (patch) | |
| tree | 415b02cfd9d85fc6e9f0e16a3aa96b5b6e2a3794 /Swift/Controllers/UIInterfaces | |
| parent | 5e9fefcc3a1ab106c44a80e12d6e34b7fb3d0397 (diff) | |
| download | swift-1356add7e274170c9af313f49d9a448fda503f5d.zip swift-1356add7e274170c9af313f49d9a448fda503f5d.tar.bz2  | |
Don't show multiple Recents with the same occupants
Change-Id: I1ac3f106ea8062d0f831beaf59fe3932a373ce3a
Diffstat (limited to 'Swift/Controllers/UIInterfaces')
| -rw-r--r-- | Swift/Controllers/UIInterfaces/ChatListWindow.h | 21 | 
1 files changed, 19 insertions, 2 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 @@ -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<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) {  						unreadCount = unread;  | 
 Swift