matrix-sdk: Fix the to-device imports for the non-crypto case.

master
Damir Jelić 2020-08-12 16:52:50 +02:00
parent 3e3894b573
commit 6c07620a26
1 changed files with 31 additions and 34 deletions

View File

@ -40,20 +40,45 @@ use matrix_sdk_base::{BaseClient, BaseClientConfig, Room, Session, StateStore};
#[cfg(feature = "encryption")] #[cfg(feature = "encryption")]
use matrix_sdk_base::Device; use matrix_sdk_base::Device;
#[cfg(feature = "encryption")]
use matrix_sdk_common::api::r0::to_device::send_event_to_device::{
IncomingRequest as OwnedToDeviceRequest, Request as ToDeviceRequest,
};
use matrix_sdk_common::{ use matrix_sdk_common::{
api::r0::{
account::register,
directory::{get_public_rooms, get_public_rooms_filtered},
membership::{
ban_user, forget_room,
invite_user::{self, InvitationRecipient},
join_room_by_id, join_room_by_id_or_alias, kick_user, leave_room, Invite3pid,
},
message::{get_message_events, send_message_event},
read_marker::set_read_marker,
receipt::create_receipt,
room::create_room,
session::login,
sync::sync_events,
typing::create_typing_event,
},
identifiers::ServerName, identifiers::ServerName,
instant::{Duration, Instant}, instant::{Duration, Instant},
js_int::UInt, js_int::UInt,
locks::{Mutex, RwLock}, locks::RwLock,
presence::PresenceState, presence::PresenceState,
uuid::Uuid, uuid::Uuid,
FromHttpResponseError, FromHttpResponseError,
}; };
#[cfg(feature = "encryption")]
use matrix_sdk_common::{
api::r0::{
keys::{claim_keys, get_keys, upload_keys},
to_device::send_event_to_device::{
IncomingRequest as OwnedToDeviceRequest, Request as ToDeviceRequest,
Response as ToDeviceResponse,
},
},
identifiers::DeviceKeyAlgorithm,
locks::Mutex,
};
use crate::{ use crate::{
api, api,
events::{room::message::MessageEventContent, EventType}, events::{room::message::MessageEventContent, EventType},
@ -294,31 +319,6 @@ impl SyncSettings {
} }
} }
use api::r0::{
account::register,
directory::{get_public_rooms, get_public_rooms_filtered},
membership::{
ban_user, forget_room,
invite_user::{self, InvitationRecipient},
join_room_by_id, join_room_by_id_or_alias, kick_user, leave_room, Invite3pid,
},
message::{get_message_events, send_message_event},
read_marker::set_read_marker,
receipt::create_receipt,
room::create_room,
session::login,
sync::sync_events,
typing::create_typing_event,
};
#[cfg(feature = "encryption")]
use matrix_sdk_common::{
api::r0::{
keys::{claim_keys, get_keys, upload_keys},
to_device::send_event_to_device,
},
identifiers::DeviceKeyAlgorithm,
};
impl Client { impl Client {
/// Creates a new client for making HTTP requests to the given homeserver. /// Creates a new client for making HTTP requests to the given homeserver.
/// ///
@ -1132,10 +1132,7 @@ impl Client {
.await .await
} }
async fn send_to_device( async fn send_to_device(&self, request: OwnedToDeviceRequest) -> Result<ToDeviceResponse> {
&self,
request: OwnedToDeviceRequest,
) -> Result<send_event_to_device::Response> {
let request = ToDeviceRequest { let request = ToDeviceRequest {
event_type: request.event_type, event_type: request.event_type,
txn_id: &request.txn_id, txn_id: &request.txn_id,