summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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) {