summary refs log tree commit diff
path: root/src/ChatPage.cc
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-21 17:14:16 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-04-21 17:14:16 +0300
commit4a2f1af0907905829917ceddd828d5706aeff294 (patch)
tree9c2d65a64d1901556640814952abfee1710fd256 /src/ChatPage.cc
parentCache refactoring (diff)
downloadnheko-4a2f1af0907905829917ceddd828d5706aeff294.tar.xz
Save read receipts
Diffstat (limited to 'src/ChatPage.cc')
-rw-r--r--src/ChatPage.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/ChatPage.cc b/src/ChatPage.cc
index aa21a98e..673f7b08 100644
--- a/src/ChatPage.cc
+++ b/src/ChatPage.cc
@@ -17,6 +17,7 @@
 
 #include <QApplication>
 #include <QDebug>
+#include <QFuture>
 #include <QSettings>
 #include <QtConcurrent>
 
@@ -424,6 +425,14 @@ ChatPage::ChatPage(QSharedPointer<MatrixClient> client,
         connect(this, &ChatPage::syncUI, this, [this](const mtx::responses::Rooms &rooms) {
                 view_manager_->initialize(rooms);
                 removeLeftRooms(rooms.leave);
+
+                for (const auto &room : rooms.join) {
+                        auto room_id = QString::fromStdString(room.first);
+
+                        updateTypingUsers(room_id, room.second.ephemeral.typing);
+                        updateRoomNotificationCount(
+                          room_id, room.second.unread_notifications.notification_count);
+                }
         });
         connect(this, &ChatPage::syncRoomlist, room_list_, &RoomList::sync);
 
@@ -518,16 +527,7 @@ ChatPage::syncCompleted(const mtx::responses::Sync &response)
 {
         syncTimeoutTimer_->stop();
 
-        // Process ephemeral data per room.
-        for (const auto &room : response.rooms.join) {
-                auto room_id = QString::fromStdString(room.first);
-
-                updateTypingUsers(room_id, room.second.ephemeral.typing);
-                updateRoomNotificationCount(room_id,
-                                            room.second.unread_notifications.notification_count);
-        }
-
-        QtConcurrent::run([this, res = std::move(response)]() {
+        auto promise = QtConcurrent::run([this, res = std::move(response)]() {
                 try {
                         cache_->saveState(res);
                         emit syncRoomlist(cache_->roomUpdates(res));