summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2022-09-23 15:47:11 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2022-09-23 15:47:25 +0200
commitce2d4defdecf376eca9f8579672779dfdf093d21 (patch)
treeec3152fd8c63a890df5d5d79579f00a6e423c11d
parentMore granular automoc (diff)
downloadnheko-ce2d4defdecf376eca9f8579672779dfdf093d21.tar.xz
Try to handle rate limiting
-rw-r--r--CMakeLists.txt2
-rw-r--r--io.github.NhekoReborn.Nheko.yaml2
-rw-r--r--src/timeline/TimelineModel.cpp8
3 files changed, 9 insertions, 3 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt

index 135b967e..8240046e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -581,7 +581,7 @@ if(USE_BUNDLED_MTXCLIENT) FetchContent_Declare( MatrixClient GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git - GIT_TAG 8dd9214f622fe5f307249b37029c17f1fdff25ab + GIT_TAG b3740e26ad07a534b6092959c0da4d91b77a8528 ) set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "") set(BUILD_LIB_TESTS OFF CACHE INTERNAL "") diff --git a/io.github.NhekoReborn.Nheko.yaml b/io.github.NhekoReborn.Nheko.yaml
index 04f1bf05..1c358f88 100644 --- a/io.github.NhekoReborn.Nheko.yaml +++ b/io.github.NhekoReborn.Nheko.yaml
@@ -173,7 +173,7 @@ modules: buildsystem: cmake-ninja name: mtxclient sources: - - commit: 8dd9214f622fe5f307249b37029c17f1fdff25ab + - commit: b3740e26ad07a534b6092959c0da4d91b77a8528 #tag: v0.8.2 type: git url: https://github.com/Nheko-Reborn/mtxclient.git diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp
index 1ddef7b7..36e21e53 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp
@@ -1313,8 +1313,14 @@ TimelineModel::redactEvent(const QString &id, const QString &reason) http::client()->redact_event( room_id_.toStdString(), id.toStdString(), - [this, id](const mtx::responses::EventId &, mtx::http::RequestErr err) { + [this, id, reason](const mtx::responses::EventId &, mtx::http::RequestErr err) { if (err) { + if (err->status_code == 429 && err->matrix_error.retry_after.count() != 0) { + QTimer::singleShot(err->matrix_error.retry_after, this, [this, id, reason]() { + this->redactEvent(id, reason); + }); + return; + } emit redactionFailed(tr("Message redaction failed: %1") .arg(QString::fromStdString(err->matrix_error.error))); return;