base_client: Restore the olm machine if a session given at client creation.
parent
545ebe8d9c
commit
6438444275
|
@ -200,12 +200,18 @@ impl Client {
|
||||||
/// * `session` - An optional session if the user already has one from a
|
/// * `session` - An optional session if the user already has one from a
|
||||||
/// previous login call.
|
/// previous login call.
|
||||||
pub fn new(session: Option<Session>) -> Self {
|
pub fn new(session: Option<Session>) -> Self {
|
||||||
|
#[cfg(feature = "encryption")]
|
||||||
|
let olm = match &session {
|
||||||
|
Some(s) => Some(OlmMachine::new(&s.user_id, &s.device_id)),
|
||||||
|
None => None,
|
||||||
|
};
|
||||||
|
|
||||||
Client {
|
Client {
|
||||||
session,
|
session,
|
||||||
sync_token: None,
|
sync_token: None,
|
||||||
joined_rooms: HashMap::new(),
|
joined_rooms: HashMap::new(),
|
||||||
#[cfg(feature = "encryption")]
|
#[cfg(feature = "encryption")]
|
||||||
olm: Arc::new(Mutex::new(None)),
|
olm: Arc::new(Mutex::new(olm)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue