From 5d66ff475f0a5a2e9297693e8e49288f32713f1a Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Wed, 17 Mar 2021 12:08:01 +0100 Subject: [PATCH] matrix-sdk: Reexport matrix_sdk_base::Room as BaseRoom --- matrix_sdk/examples/autojoin.rs | 4 ++-- matrix_sdk/examples/command_bot.rs | 4 ++-- matrix_sdk/examples/image_bot.rs | 4 ++-- matrix_sdk/examples/login.rs | 4 ++-- matrix_sdk/src/lib.rs | 4 ++-- matrix_sdk/src/room/common.rs | 8 ++++---- matrix_sdk/src/room/invited.rs | 4 ++-- matrix_sdk/src/room/joined.rs | 6 +++--- matrix_sdk/src/room/left.rs | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/matrix_sdk/examples/autojoin.rs b/matrix_sdk/examples/autojoin.rs index cf6b0ec1..7d7e3e56 100644 --- a/matrix_sdk/examples/autojoin.rs +++ b/matrix_sdk/examples/autojoin.rs @@ -4,7 +4,7 @@ use tokio::time::{sleep, Duration}; use matrix_sdk::{ self, async_trait, events::{room::member::MemberEventContent, StrippedStateEvent}, - room, Client, ClientConfig, EventHandler, Room, SyncSettings, + room, BaseRoom, Client, ClientConfig, EventHandler, SyncSettings, }; use url::Url; @@ -22,7 +22,7 @@ impl AutoJoinBot { impl EventHandler for AutoJoinBot { async fn on_stripped_state_member( &self, - room: Room, + room: BaseRoom, room_member: &StrippedStateEvent, _: Option, ) { diff --git a/matrix_sdk/examples/command_bot.rs b/matrix_sdk/examples/command_bot.rs index a9e43b5f..e9a29c93 100644 --- a/matrix_sdk/examples/command_bot.rs +++ b/matrix_sdk/examples/command_bot.rs @@ -7,7 +7,7 @@ use matrix_sdk::{ AnyMessageEventContent, SyncMessageEvent, }, room::Joined, - Client, ClientConfig, EventHandler, Room, SyncSettings, + BaseRoom, Client, ClientConfig, EventHandler, SyncSettings, }; use url::Url; @@ -25,7 +25,7 @@ impl CommandBot { #[async_trait] impl EventHandler for CommandBot { - async fn on_room_message(&self, room: Room, event: &SyncMessageEvent) { + async fn on_room_message(&self, room: BaseRoom, event: &SyncMessageEvent) { if let Some(room) = Joined::new(self.client.clone(), room) { let msg_body = if let SyncMessageEvent { content: diff --git a/matrix_sdk/examples/image_bot.rs b/matrix_sdk/examples/image_bot.rs index 7e65fdb1..7e3c29fc 100644 --- a/matrix_sdk/examples/image_bot.rs +++ b/matrix_sdk/examples/image_bot.rs @@ -15,7 +15,7 @@ use matrix_sdk::{ SyncMessageEvent, }, room::Joined, - Client, EventHandler, Room, SyncSettings, + BaseRoom, Client, EventHandler, SyncSettings, }; use url::Url; @@ -33,7 +33,7 @@ impl ImageBot { #[async_trait] impl EventHandler for ImageBot { - async fn on_room_message(&self, room: Room, event: &SyncMessageEvent) { + async fn on_room_message(&self, room: BaseRoom, event: &SyncMessageEvent) { if let Some(room) = Joined::new(self.client.clone(), room) { let msg_body = if let SyncMessageEvent { content: diff --git a/matrix_sdk/examples/login.rs b/matrix_sdk/examples/login.rs index b79b95e6..eadfa5d2 100644 --- a/matrix_sdk/examples/login.rs +++ b/matrix_sdk/examples/login.rs @@ -7,14 +7,14 @@ use matrix_sdk::{ room::message::{MessageEventContent, MessageType, TextMessageEventContent}, SyncMessageEvent, }, - Client, EventHandler, Room, RoomType, SyncSettings, + BaseRoom, Client, EventHandler, RoomType, SyncSettings, }; struct EventCallback; #[async_trait] impl EventHandler for EventCallback { - async fn on_room_message(&self, room: Room, event: &SyncMessageEvent) { + async fn on_room_message(&self, room: BaseRoom, event: &SyncMessageEvent) { if room.room_type() == RoomType::Joined { if let SyncMessageEvent { content: diff --git a/matrix_sdk/src/lib.rs b/matrix_sdk/src/lib.rs index 9d90c72e..b8f07b90 100644 --- a/matrix_sdk/src/lib.rs +++ b/matrix_sdk/src/lib.rs @@ -68,8 +68,8 @@ compile_error!("only one of 'native-tls' or 'rustls-tls' features can be enabled #[cfg_attr(feature = "docs", doc(cfg(encryption)))] pub use matrix_sdk_base::crypto::{EncryptionInfo, LocalTrust}; pub use matrix_sdk_base::{ - CustomEvent, Error as BaseError, EventHandler, Room, RoomInfo, RoomMember, RoomType, Session, - StateChanges, StoreError, + CustomEvent, Error as BaseError, EventHandler, Room as BaseRoom, RoomInfo, RoomMember, + RoomType, Session, StateChanges, StoreError, }; pub use matrix_sdk_common::*; diff --git a/matrix_sdk/src/room/common.rs b/matrix_sdk/src/room/common.rs index aa4fd222..59f32afe 100644 --- a/matrix_sdk/src/room/common.rs +++ b/matrix_sdk/src/room/common.rs @@ -4,17 +4,17 @@ use matrix_sdk_common::api::r0::{ }; use std::ops::Deref; -use crate::{Client, Result, Room, RoomMember}; +use crate::{BaseRoom, Client, Result, RoomMember}; /// A struct containing methodes that are common for Joined, Invited and Left Rooms #[derive(Debug, Clone)] pub struct Common { - inner: Room, + inner: BaseRoom, pub(crate) client: Client, } impl Deref for Common { - type Target = Room; + type Target = BaseRoom; fn deref(&self) -> &Self::Target { &self.inner @@ -28,7 +28,7 @@ impl Common { /// * `client` - The client used to make requests. /// /// * `room` - The underlaying room. - pub fn new(client: Client, room: Room) -> Self { + pub fn new(client: Client, room: BaseRoom) -> Self { // TODO: Make this private Self { inner: room, diff --git a/matrix_sdk/src/room/invited.rs b/matrix_sdk/src/room/invited.rs index 278f6b45..67cd10b7 100644 --- a/matrix_sdk/src/room/invited.rs +++ b/matrix_sdk/src/room/invited.rs @@ -1,4 +1,4 @@ -use crate::{room::Common, Client, Result, Room, RoomType}; +use crate::{room::Common, BaseRoom, Client, Result, RoomType}; use std::ops::Deref; /// A room in the invited state. @@ -17,7 +17,7 @@ impl Invited { /// * `client` - The client used to make requests. /// /// * `room` - The underlaying room. - pub fn new(client: Client, room: Room) -> Option { + pub fn new(client: Client, room: BaseRoom) -> Option { // TODO: Make this private if room.room_type() == RoomType::Invited { Some(Self { diff --git a/matrix_sdk/src/room/joined.rs b/matrix_sdk/src/room/joined.rs index 42cb8fb3..b8ce2b41 100644 --- a/matrix_sdk/src/room/joined.rs +++ b/matrix_sdk/src/room/joined.rs @@ -1,4 +1,4 @@ -use crate::{room::Common, Client, Result, Room, RoomType}; +use crate::{room::Common, BaseRoom, Client, Result, RoomType}; use std::{io::Read, ops::Deref, sync::Arc}; use matrix_sdk_common::{ @@ -58,13 +58,13 @@ impl Deref for Joined { } impl Joined { - /// Create a new `room::Joined` if the underlaying `Room` has type `RoomType::Joined`. + /// Create a new `room::Joined` if the underlaying `BaseRoom` has type `RoomType::Joined`. /// /// # Arguments /// * `client` - The client used to make requests. /// /// * `room` - The underlaying room. - pub fn new(client: Client, room: Room) -> Option { + pub fn new(client: Client, room: BaseRoom) -> Option { // TODO: Make this private if room.room_type() == RoomType::Joined { Some(Self { diff --git a/matrix_sdk/src/room/left.rs b/matrix_sdk/src/room/left.rs index 5640f77a..52638f9c 100644 --- a/matrix_sdk/src/room/left.rs +++ b/matrix_sdk/src/room/left.rs @@ -1,4 +1,4 @@ -use crate::{room::Common, Client, Result, Room, RoomType}; +use crate::{room::Common, BaseRoom, Client, Result, RoomType}; use std::ops::Deref; use matrix_sdk_common::api::r0::membership::forget_room; @@ -19,7 +19,7 @@ impl Left { /// * `client` - The client used to make requests. /// /// * `room` - The underlaying room. - pub fn new(client: Client, room: Room) -> Option { + pub fn new(client: Client, room: BaseRoom) -> Option { // TODO: Make this private if room.room_type() == RoomType::Left { Some(Self {