summary refs log tree commit diff
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-02-28 12:12:07 +0200
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-02-28 12:12:07 +0200
commit12a96aae6d7efa7c567616de8eb3e4f6d879b066 (patch)
treed30062ec058f73c3ef72de27fb1d373376345b21
parentEnable room switcher only in the chat view (#251) (diff)
downloadnheko-12a96aae6d7efa7c567616de8eb3e4f6d879b066.tar.xz
Add some missing references
-rw-r--r--include/ChatPage.h4
-rw-r--r--src/AvatarProvider.cc2
-rw-r--r--src/Cache.cc6
-rw-r--r--src/ChatPage.cc4
-rw-r--r--src/MatrixClient.cc1
-rw-r--r--src/dialogs/ReadReceipts.cc2
6 files changed, 9 insertions, 10 deletions
diff --git a/include/ChatPage.h b/include/ChatPage.h
index 5d7d2806..5a6376c9 100644
--- a/include/ChatPage.h
+++ b/include/ChatPage.h
@@ -206,7 +206,7 @@ ChatPage::updateUserMetadata(const std::vector<Collection> &collection)
 {
         using Member = mtx::events::StateEvent<mtx::events::state::Member>;
 
-        for (auto &event : collection) {
+        for (const auto &event : collection) {
                 if (mpark::holds_alternative<Member>(event)) {
                         auto member = mpark::get<Member>(event);
 
@@ -224,7 +224,7 @@ ChatPage::getMemberships(const std::vector<Collection> &collection) const
 
         using Member = mtx::events::StateEvent<mtx::events::state::Member>;
 
-        for (auto &event : collection) {
+        for (const auto &event : collection) {
                 if (mpark::holds_alternative<Member>(event)) {
                         auto member = mpark::get<Member>(event);
                         memberships.emplace(member.state_key, member);
diff --git a/src/AvatarProvider.cc b/src/AvatarProvider.cc
index 21253ba7..1c509d0a 100644
--- a/src/AvatarProvider.cc
+++ b/src/AvatarProvider.cc
@@ -36,7 +36,7 @@ AvatarProvider::updateAvatar(const QString &uid, const QImage &img)
                 auto callbacks = toBeResolved_[uid];
 
                 // Update all the timeline items with the resolved avatar.
-                for (const auto callback : callbacks)
+                for (const auto &callback : callbacks)
                         callback(img);
 
                 toBeResolved_.erase(uid);
diff --git a/src/Cache.cc b/src/Cache.cc
index d889f731..8a58b634 100644
--- a/src/Cache.cc
+++ b/src/Cache.cc
@@ -482,7 +482,7 @@ Cache::readReceipts(const QString &event_id, const QString &room_id)
                         auto json_response = json::parse(std::string(value.data(), value.size()));
                         auto values        = json_response.get<std::map<std::string, uint64_t>>();
 
-                        for (auto v : values)
+                        for (const auto &v : values)
                                 // timestamp, user_id
                                 receipts.emplace(v.second, v.first);
                 }
@@ -497,7 +497,7 @@ Cache::readReceipts(const QString &event_id, const QString &room_id)
 void
 Cache::updateReadReceipt(const std::string &room_id, const Receipts &receipts)
 {
-        for (auto receipt : receipts) {
+        for (const auto &receipt : receipts) {
                 const auto event_id = receipt.first;
                 auto event_receipts = receipt.second;
 
@@ -528,7 +528,7 @@ Cache::updateReadReceipt(const std::string &room_id, const Receipts &receipts)
                         }
 
                         // Append the new ones.
-                        for (auto event_receipt : event_receipts)
+                        for (const auto &event_receipt : event_receipts)
                                 saved_receipts.emplace(event_receipt.first, event_receipt.second);
 
                         // Save back the merged (or only the new) receipts.
diff --git a/src/ChatPage.cc b/src/ChatPage.cc
index a3ae7428..2ef4cf47 100644
--- a/src/ChatPage.cc
+++ b/src/ChatPage.cc
@@ -531,7 +531,7 @@ ChatPage::initialSyncCompleted(const mtx::responses::Sync &response)
                 roomSettings_.emplace(room_id,
                                       QSharedPointer<RoomSettings>(new RoomSettings(room_id)));
 
-                for (const auto membership : roomState->memberships) {
+                for (const auto &membership : roomState->memberships) {
                         updateUserDisplayName(membership.second);
                         updateUserAvatarUrl(membership.second);
                 }
@@ -791,7 +791,7 @@ ChatPage::updateTypingUsers(const QString &roomid, const std::vector<std::string
         QSettings settings;
         QString user_id = settings.value("auth/user_id").toString();
 
-        for (const auto uid : user_ids) {
+        for (const auto &uid : user_ids) {
                 auto user = QString::fromStdString(uid);
 
                 if (user == user_id)
diff --git a/src/MatrixClient.cc b/src/MatrixClient.cc
index af50e5b9..b5c4900b 100644
--- a/src/MatrixClient.cc
+++ b/src/MatrixClient.cc
@@ -410,7 +410,6 @@ MatrixClient::initialSync() noexcept
                         emit initialSyncFailed();
                         return;
                 }
-
         });
 }
 
diff --git a/src/dialogs/ReadReceipts.cc b/src/dialogs/ReadReceipts.cc
index 3615d62e..839871be 100644
--- a/src/dialogs/ReadReceipts.cc
+++ b/src/dialogs/ReadReceipts.cc
@@ -102,7 +102,7 @@ ReadReceipts::addUsers(const std::multimap<uint64_t, std::string, std::greater<u
         // We want to remove any previous items that have been set.
         userList_->clear();
 
-        for (auto receipt : receipts) {
+        for (const auto &receipt : receipts) {
                 auto user =
                   new ReceiptItem(this, QString::fromStdString(receipt.second), receipt.first);
                 auto item = new QListWidgetItem(userList_);