Update ruma

master
Alejandro Domínguez 2020-11-20 19:46:23 +01:00
parent 8f99180c99
commit 95243003c4
4 changed files with 14 additions and 10 deletions

View File

@ -1402,10 +1402,10 @@ impl Client {
sync_settings: SyncSettings<'_>, sync_settings: SyncSettings<'_>,
) -> Result<sync_events::Response> { ) -> Result<sync_events::Response> {
let request = assign!(sync_events::Request::new(), { let request = assign!(sync_events::Request::new(), {
filter: sync_settings.filter, filter: sync_settings.filter.as_ref(),
since: sync_settings.token.as_deref(), since: sync_settings.token.as_deref(),
full_state: sync_settings.full_state, full_state: sync_settings.full_state,
set_presence: PresenceState::Online, set_presence: &PresenceState::Online,
timeout: sync_settings.timeout, timeout: sync_settings.timeout,
}); });
@ -1496,13 +1496,11 @@ impl Client {
#[instrument(skip(callback))] #[instrument(skip(callback))]
pub async fn sync_with_callback<C>( pub async fn sync_with_callback<C>(
&self, &self,
sync_settings: SyncSettings<'_>, mut sync_settings: SyncSettings<'_>,
callback: impl Fn(sync_events::Response) -> C, callback: impl Fn(sync_events::Response) -> C,
) where ) where
C: Future<Output = LoopCtrl>, C: Future<Output = LoopCtrl>,
{ {
let mut sync_settings = sync_settings;
let filter = sync_settings.filter;
let mut last_sync_time: Option<Instant> = None; let mut last_sync_time: Option<Instant> = None;
if sync_settings.token.is_none() { if sync_settings.token.is_none() {
@ -1510,6 +1508,7 @@ impl Client {
} }
loop { loop {
let filter = sync_settings.filter.clone();
let response = self.sync_once(sync_settings.clone()).await; let response = self.sync_once(sync_settings.clone()).await;
let response = match response { let response = match response {
@ -1577,8 +1576,8 @@ impl Client {
.await .await
.expect("No sync token found after initial sync"), .expect("No sync token found after initial sync"),
); );
if let Some(f) = filter.as_ref() { if let Some(f) = filter {
sync_settings = sync_settings.filter(*f); sync_settings = sync_settings.filter(f);
} }
} }
} }

View File

@ -934,7 +934,7 @@ impl Room {
member.currently_active = *currently_active; member.currently_active = *currently_active;
member.display_name = displayname.clone(); member.display_name = displayname.clone();
member.last_active_ago = *last_active_ago; member.last_active_ago = *last_active_ago;
member.presence = Some(*presence); member.presence = Some(presence.clone());
member.status_msg = status_msg.clone(); member.status_msg = status_msg.clone();
true true
@ -1091,6 +1091,7 @@ impl Describe for MembershipState {
Self::Join => "is a member of", Self::Join => "is a member of",
Self::Knock => "is requesting access to", Self::Knock => "is requesting access to",
Self::Leave => "has left", Self::Leave => "has left",
_ => "unhandled case of MembershipState",
} }
.to_string() .to_string()
} }

View File

@ -21,7 +21,7 @@ js_int = "0.1.9"
[dependencies.ruma] [dependencies.ruma]
version = "0.0.1" version = "0.0.1"
git = "https://github.com/ruma/ruma" git = "https://github.com/ruma/ruma"
rev = "50eb700571480d1440e15a387d10f98be8abab59" rev = "d16fd4b2c1be1b06fd9be99373a3e77d74fadff3"
features = ["client-api", "unstable-pre-spec", "unstable-exhaustive-types"] features = ["client-api", "unstable-pre-spec", "unstable-exhaustive-types"]
[target.'cfg(not(target_arch = "wasm32"))'.dependencies] [target.'cfg(not(target_arch = "wasm32"))'.dependencies]

View File

@ -299,7 +299,7 @@ impl KeyRequestMachine {
&self, &self,
event: &ToDeviceEvent<RoomKeyRequestEventContent>, event: &ToDeviceEvent<RoomKeyRequestEventContent>,
) -> OlmResult<()> { ) -> OlmResult<()> {
let key_info = match event.content.action { let key_info = match &event.content.action {
Action::Request => { Action::Request => {
if let Some(info) = &event.content.body { if let Some(info) = &event.content.body {
info info
@ -314,6 +314,10 @@ impl KeyRequestMachine {
} }
// We ignore cancellations here since there's nothing to serve. // We ignore cancellations here since there's nothing to serve.
Action::CancelRequest => return Ok(()), Action::CancelRequest => return Ok(()),
action => {
warn!("Unknown room key request action: {:?}", action);
return Ok(());
}
}; };
let session = self let session = self