Commit bea2e3f5ba
Unsigned
Layout: unified · split
Cargo.toml +2 −3
| @@ -10,7 +10,7 @@ name = "matrix" | |||
| 10 | crate-type = ["dylib"] | 10 | crate-type = ["dylib"] |
| 11 | 11 | ||
| 12 | [dependencies] | 12 | [dependencies] |
| 13 | libc = "0.2.67" | 13 | libc = "0.2.68" |
| 14 | url = "2.1.1" | 14 | url = "2.1.1" |
| 15 | tokio = { version = "0.2.13", features = [ "rt-threaded" ] } | 15 | tokio = { version = "0.2.13", features = [ "rt-threaded" ] } |
| 16 | async-std = { version = "1.5.0", features = [ "unstable" ] } | 16 | async-std = { version = "1.5.0", features = [ "unstable" ] } |
| @@ -21,6 +21,5 @@ weechat-sys = { git = "https://github.com/poljar/rust-weechat" } | |||
| 21 | 21 | ||
| 22 | [dependencies.matrix-sdk] | 22 | [dependencies.matrix-sdk] |
| 23 | git = "https://github.com/matrix-org/matrix-rust-sdk/" | 23 | git = "https://github.com/matrix-org/matrix-rust-sdk/" |
| 24 | branch = "encryption" | ||
| 25 | default-features = false | 24 | default-features = false |
| 26 | features = ["encryption"] | 25 | features = ["encryption", "sqlite-cryptostore"] |
src/server.rs +4 −4
| @@ -54,6 +54,7 @@ use async_std::sync::channel as async_channel; | |||
| 54 | use async_std::sync::{Receiver, Sender}; | 54 | use async_std::sync::{Receiver, Sender}; |
| 55 | use std::cell::RefCell; | 55 | use std::cell::RefCell; |
| 56 | use std::collections::HashMap; | 56 | use std::collections::HashMap; |
| 57 | use std::time::Duration; | ||
| 57 | use std::rc::{Rc, Weak}; | 58 | use std::rc::{Rc, Weak}; |
| 58 | use tokio::runtime::Runtime; | 59 | use tokio::runtime::Runtime; |
| 59 | use url::Url; | 60 | use url::Url; |
| @@ -80,7 +81,7 @@ use crate::room_buffer::RoomBuffer; | |||
| 80 | use crate::Config; | 81 | use crate::Config; |
| 81 | use crate::PLUGIN_NAME; | 82 | use crate::PLUGIN_NAME; |
| 82 | 83 | ||
| 83 | const DEFAULT_SYNC_TIMEOUT: i32 = 30000; | 84 | const DEFAULT_SYNC_TIMEOUT: Duration = Duration::from_secs(30); |
| 84 | 85 | ||
| 85 | pub enum ThreadMessage { | 86 | pub enum ThreadMessage { |
| 86 | LoginMessage(LoginResponse), | 87 | LoginMessage(LoginResponse), |
| @@ -526,7 +527,7 @@ impl MatrixServer { | |||
| 526 | password: String, | 527 | password: String, |
| 527 | ) { | 528 | ) { |
| 528 | if !client.logged_in().await { | 529 | if !client.logged_in().await { |
| 529 | let ret = client.login(username, password, None).await; | 530 | let ret = client.login(username, password, None, Some("Weechat-Matrix".to_owned())).await; |
| 530 | 531 | ||
| 531 | match ret { | 532 | match ret { |
| 532 | Ok(response) => { | 533 | Ok(response) => { |
| @@ -543,8 +544,7 @@ impl MatrixServer { | |||
| 543 | 544 | ||
| 544 | let sync_token = client.sync_token().await; | 545 | let sync_token = client.sync_token().await; |
| 545 | let sync_settings = SyncSettings::new() | 546 | let sync_settings = SyncSettings::new() |
| 546 | .timeout(DEFAULT_SYNC_TIMEOUT) | 547 | .timeout(DEFAULT_SYNC_TIMEOUT); |
| 547 | .expect("Invalid sync timeout"); | ||
| 548 | 548 | ||
| 549 | let sync_settings = if let Some(t) = sync_token { | 549 | let sync_settings = if let Some(t) = sync_token { |
| 550 | sync_settings.token(t) | 550 | sync_settings.token(t) |