Fix broken olm channels automatically

pull/554/head
Nicolas Werner 4 years ago
parent 8108d98fa7
commit 99314c948e
No known key found for this signature in database
GPG Key ID: C8D75E610773F2D9
  1. 2
      CMakeLists.txt
  2. 2
      io.github.NhekoReborn.Nheko.yaml
  3. 20
      src/Olm.cpp

@ -361,7 +361,7 @@ if(USE_BUNDLED_MTXCLIENT)
FetchContent_Declare(
MatrixClient
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_TESTS OFF CACHE INTERNAL "")

@ -148,7 +148,7 @@ modules:
buildsystem: cmake-ninja
name: mtxclient
sources:
- commit: 7194b4f058406b1c10d3741d83abcf2d8963d849
- commit: 5b7654c5d4512abc38806a0f44efc199029ceef4
type: git
url: https://github.com/Nheko-Reborn/mtxclient.git
- config-opts:

@ -359,6 +359,26 @@ handle_olm_message(const OlmMessage &msg)
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

Loading…
Cancel
Save