diff options
-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; |