summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/Controllers/UIInterfaces/ChatListWindow.h')
-rw-r--r--Swift/Controllers/UIInterfaces/ChatListWindow.h36
1 files changed, 28 insertions, 8 deletions
diff --git a/Swift/Controllers/UIInterfaces/ChatListWindow.h b/Swift/Controllers/UIInterfaces/ChatListWindow.h
index dde596e..29097e9 100644
--- a/Swift/Controllers/UIInterfaces/ChatListWindow.h
+++ b/Swift/Controllers/UIInterfaces/ChatListWindow.h
@@ -13,2 +13,4 @@
+
+#include <boost/algorithm/string/join.hpp>
#include <boost/filesystem/path.hpp>
@@ -16,2 +18,3 @@
+#include <Swiften/Base/Algorithm.h>
#include <Swiften/Elements/StatusShow.h>
@@ -33,2 +36,5 @@ namespace Swift {
}
+ if (chatName == other.chatName) {
+ return true;
+ }
else { /* compare the chat occupant lists */
@@ -46,3 +52,3 @@ namespace Swift {
}
- return true;
+ return key_compare(inviteesNames, other.inviteesNames);
}
@@ -59,11 +65,24 @@ namespace Swift {
std::string getImpromptuTitle() const {
- std::string title;
- for (auto& pair : impromptuJIDs) {
- if (title.empty()) {
- title += pair.first;
- } else {
- title += ", " + pair.first;
+ std::set<std::string> participants;
+ std::map<JID, std::string> participantsMap;
+
+ for (auto& pair : inviteesNames) {
+ if (!pair.second.empty()) {
+ participantsMap[pair.first] = pair.second;
}
+ else {
+ participantsMap[pair.first] = pair.first.toString();
+ }
+ }
+ for (auto& pair : impromptuJIDs) {
+ participantsMap[pair.second] = pair.first;
}
- return title;
+ for (auto& participant : participantsMap) {
+ participants.insert(participant.second);
+ }
+ return boost::algorithm::join(participants, ", ");
+ }
+ std::string getTitle() const {
+ std::string title = getImpromptuTitle();
+ return title.empty() ? chatName : title;
}
@@ -79,2 +98,3 @@ namespace Swift {
std::map<std::string, JID> impromptuJIDs;
+ std::map<JID, std::string> inviteesNames;
bool isPrivateMessage;