summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2020-07-18 20:39:31 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2020-07-18 20:39:31 +0200
commit046b3f4da6e5b8eec92bd0895048a4df2e916285 (patch)
tree85d3c3cff5678b5ac0b9e110cbf52b19a318644d /src
parentFix flickering of encrypted messages when sending using new store (diff)
downloadnheko-046b3f4da6e5b8eec92bd0895048a4df2e916285.tar.xz
Mark own events as read again after sending
Diffstat (limited to 'src')
-rw-r--r--src/timeline/EventStore.cpp15
-rw-r--r--src/timeline/EventStore.h2
2 files changed, 13 insertions, 4 deletions
diff --git a/src/timeline/EventStore.cpp b/src/timeline/EventStore.cpp
index b7cf4f96..80e8d474 100644
--- a/src/timeline/EventStore.cpp
+++ b/src/timeline/EventStore.cpp
@@ -91,7 +91,7 @@ EventStore::EventStore(std::string room_id, QObject *)
                                     room_id_,
                                     txn_id,
                                     e.content,
-                                    [this, txn_id](const mtx::responses::EventId &,
+                                    [this, txn_id](const mtx::responses::EventId &event_id,
                                                    mtx::http::RequestErr err) {
                                             if (err) {
                                                     const int status_code =
@@ -104,7 +104,7 @@ EventStore::EventStore(std::string room_id, QObject *)
                                                     emit messageFailed(txn_id);
                                                     return;
                                             }
-                                            emit messageSent(txn_id);
+                                            emit messageSent(txn_id, event_id.event_id.to_string());
                                     });
                   },
                   event->data);
@@ -135,8 +135,17 @@ EventStore::EventStore(std::string room_id, QObject *)
           this,
           &EventStore::messageSent,
           this,
-          [this](std::string txn_id) {
+          [this](std::string txn_id, std::string event_id) {
                   nhlog::ui()->debug("sent {}", txn_id);
+
+                  http::client()->read_event(
+                    room_id_, event_id, [this, event_id](mtx::http::RequestErr err) {
+                            if (err) {
+                                    nhlog::net()->warn(
+                                      "failed to read_event ({}, {})", room_id_, event_id);
+                            }
+                    });
+
                   cache::client()->removePendingStatus(room_id_, txn_id);
                   this->current_txn             = "";
                   this->current_txn_error_count = 0;
diff --git a/src/timeline/EventStore.h b/src/timeline/EventStore.h
index b4d5bb23..3a78cba8 100644
--- a/src/timeline/EventStore.h
+++ b/src/timeline/EventStore.h
@@ -91,7 +91,7 @@ signals:
         void fetchedMore();
 
         void processPending();
-        void messageSent(std::string txn_id);
+        void messageSent(std::string txn_id, std::string event_id);
         void messageFailed(std::string txn_id);
 
 public slots: