aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt2
-rw-r--r--lib/connection.cpp10
2 files changed, 9 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 50f04a91..8d8de0ae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,7 +40,7 @@ foreach (FLAG all "" pedantic extra error=return-type no-unused-parameter no-gnu
endif ()
endforeach ()
-find_package(Qt5 5.6 REQUIRED Network Gui)
+find_package(Qt5 5.5.1 REQUIRED Network Gui)
get_filename_component(Qt5_Prefix "${Qt5_DIR}/../../../.." ABSOLUTE)
message( STATUS )
diff --git a/lib/connection.cpp b/lib/connection.cpp
index 71ada8f7..600ab396 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -705,8 +705,14 @@ Connection::DirectChatsMap Connection::directChats() const
QJsonObject toJson(const Connection::DirectChatsMap& directChats)
{
QJsonObject json;
- for (auto it = directChats.keyBegin(); it != directChats.keyEnd(); ++it)
- json.insert((*it)->id(), toJson(directChats.values(*it)));
+ for (auto it = directChats.begin(); it != directChats.end();)
+ {
+ QJsonArray roomIds;
+ const auto* user = it.key();
+ for (; it != directChats.end() && it.key() == user; ++it)
+ roomIds.append(*it);
+ json.insert(user->id(), roomIds);
+ }
return json;
}