summary refs log tree commit diff
path: root/src/timeline
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-01-27 20:29:06 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2021-01-27 20:29:06 +0100
commit5fbf17f6ec6a0a31fbb6ee874c56db507b02ffe9 (patch)
treef3300adb50877e426750efdd1eb1d082fcb6140c /src/timeline
parentFix username completion deleting characters before it (diff)
downloadnheko-5fbf17f6ec6a0a31fbb6ee874c56db507b02ffe9.tar.xz
Fix request key loops
Diffstat (limited to 'src/timeline')
-rw-r--r--src/timeline/EventStore.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/timeline/EventStore.cpp b/src/timeline/EventStore.cpp
index b16bf1d2..4748f9c0 100644
--- a/src/timeline/EventStore.cpp
+++ b/src/timeline/EventStore.cpp
@@ -242,7 +242,9 @@ EventStore::receivedSessionKey(const std::string &session_id)
                 return;
 
         auto request = pending_key_requests.at(session_id);
-        pending_key_requests.erase(session_id);
+
+        // Don't request keys again until Nheko is restarted (for now)
+        pending_key_requests[session_id].events.clear();
 
         olm::send_key_request_for(request.events.front(), request.request_id, true);
 
@@ -778,7 +780,8 @@ EventStore::fetchMore()
                   if (cache::client()->previousBatchToken(room_id_) != opts.from) {
                           nhlog::net()->warn("Cache cleared while fetching more messages, dropping "
                                              "/messages response");
-                          emit fetchedMore();
+                          if (!opts.to.empty())
+                                  emit fetchedMore();
                           return;
                   }
                   if (err) {