Skip to content

Commit

Permalink
Download rooms keys from backups if they exist
Browse files Browse the repository at this point in the history
  • Loading branch information
ulyssa committed Mar 2, 2024
1 parent 9732971 commit ba44743
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use url::Url;
use matrix_sdk::{
config::{RequestConfig, SyncSettings},
encryption::verification::{SasVerification, Verification},
encryption::{BackupDownloadStrategy, EncryptionSettings},
event_handler::Ctx,
matrix_auth::MatrixSession,
reqwest,
Expand Down Expand Up @@ -101,6 +102,12 @@ use crate::{
ApplicationSettings,
};

const DEFAULT_ENCRYPTION_SETTINGS: EncryptionSettings = EncryptionSettings {
auto_enable_cross_signing: true,
auto_enable_backups: true,
backup_download_strategy: BackupDownloadStrategy::AfterDecryptionFailure,
};

const IAMB_DEVICE_NAME: &str = "iamb";
const IAMB_USER_AGENT: &str = "iamb";
const MIN_MSG_LOAD: u32 = 50;
Expand Down Expand Up @@ -664,7 +671,8 @@ async fn create_client_inner(
let builder = Client::builder()
.http_client(http)
.sqlite_store(settings.sqlite_dir.as_path(), None)
.request_config(req_config);
.request_config(req_config)
.with_encryption_settings(DEFAULT_ENCRYPTION_SETTINGS.clone());

Check warning on line 675 in src/worker.rs

View workflow job for this annotation

GitHub Actions / clippy

[clippy] src/worker.rs#L675

warning: using `clone` on type `EncryptionSettings` which implements the `Copy` trait --> src/worker.rs:675:35 | 675 | .with_encryption_settings(DEFAULT_ENCRYPTION_SETTINGS.clone()); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `DEFAULT_ENCRYPTION_SETTINGS` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy = note: `#[warn(clippy::clone_on_copy)]` on by default
Raw output
src/worker.rs:675:35:w:warning: using `clone` on type `EncryptionSettings` which implements the `Copy` trait
   --> src/worker.rs:675:35
    |
675 |         .with_encryption_settings(DEFAULT_ENCRYPTION_SETTINGS.clone());
    |                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try removing the `clone` call: `DEFAULT_ENCRYPTION_SETTINGS`
    |
    = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy
    = note: `#[warn(clippy::clone_on_copy)]` on by default


__END__

let builder = if let Some(url) = homeserver {
// Use the explicitly specified homeserver.
Expand Down

0 comments on commit ba44743

Please sign in to comment.