Don't send empty SecretRequest cancellation if there are only 2 devices

This commit is contained in:
Nicolas Werner 2025-11-03 03:55:23 +01:00
parent 2769642d3c
commit 1bd2970c4d
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -398,17 +398,19 @@ handle_olm_message(const OlmMessage &msg, const UserKeyCache &otherUserDeviceKey
body[local_user][dev] = secretRequest; body[local_user][dev] = secretRequest;
} }
http::client()->send_to_device<mtx::events::msg::SecretRequest>( if (!body.empty()) {
http::client()->generate_txn_id(), http::client()->send_to_device<mtx::events::msg::SecretRequest>(
body, http::client()->generate_txn_id(),
[secret_name](mtx::http::RequestErr err) { body,
if (err) { [secret_name](mtx::http::RequestErr err) {
nhlog::net()->error("Failed to send request cancellation " if (err) {
"for secrect " nhlog::net()->error("Failed to send request cancellation "
"'{}'", "for secrect "
secret_name); "'{}'",
} secret_name);
}); }
});
}
nhlog::crypto()->info("Storing secret {}", secret_name); nhlog::crypto()->info("Storing secret {}", secret_name);
cache::client()->storeSecret(secret_name, e->content.secret); cache::client()->storeSecret(secret_name, e->content.secret);