mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-22 19:08:58 +03:00
Fix broken olm channels automatically
This commit is contained in:
parent
8108d98fa7
commit
99314c948e
3 changed files with 22 additions and 2 deletions
|
@ -361,7 +361,7 @@ if(USE_BUNDLED_MTXCLIENT)
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
MatrixClient
|
MatrixClient
|
||||||
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
|
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
|
||||||
GIT_TAG 808605299937203696a572c585a51509b1de28cf
|
GIT_TAG 5b7654c5d4512abc38806a0f44efc199029ceef4
|
||||||
)
|
)
|
||||||
set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
|
set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
|
||||||
set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")
|
set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")
|
||||||
|
|
|
@ -148,7 +148,7 @@ modules:
|
||||||
buildsystem: cmake-ninja
|
buildsystem: cmake-ninja
|
||||||
name: mtxclient
|
name: mtxclient
|
||||||
sources:
|
sources:
|
||||||
- commit: 7194b4f058406b1c10d3741d83abcf2d8963d849
|
- commit: 5b7654c5d4512abc38806a0f44efc199029ceef4
|
||||||
type: git
|
type: git
|
||||||
url: https://github.com/Nheko-Reborn/mtxclient.git
|
url: https://github.com/Nheko-Reborn/mtxclient.git
|
||||||
- config-opts:
|
- config-opts:
|
||||||
|
|
20
src/Olm.cpp
20
src/Olm.cpp
|
@ -359,6 +359,26 @@ handle_olm_message(const OlmMessage &msg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
auto otherUserDeviceKeys = cache::userKeys(msg.sender);
|
||||||
|
|
||||||
|
if (!otherUserDeviceKeys)
|
||||||
|
return;
|
||||||
|
|
||||||
|
std::map<std::string, std::vector<std::string>> targets;
|
||||||
|
for (auto [device_id, key] : otherUserDeviceKeys->device_keys) {
|
||||||
|
if (key.keys.at("curve25519:" + device_id) == msg.sender_key)
|
||||||
|
targets[msg.sender].push_back(device_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
send_encrypted_to_device_messages(
|
||||||
|
targets, mtx::events::DeviceEvent<mtx::events::msg::Dummy>{}, true);
|
||||||
|
nhlog::crypto()->info(
|
||||||
|
"Recovering from broken olm channel with {}:{}", msg.sender, msg.sender_key);
|
||||||
|
} catch (std::exception &e) {
|
||||||
|
nhlog::crypto()->error("Failed to recover from broken olm sessions: {}", e.what());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nlohmann::json
|
nlohmann::json
|
||||||
|
|
Loading…
Reference in a new issue