matrix-sdk: Reexport matrix_sdk_base::Room as BaseRoom

master
Julian Sparber 2021-03-17 12:08:01 +01:00
parent 31dd031269
commit 5d66ff475f
9 changed files with 21 additions and 21 deletions

View File

@ -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<MemberEventContent>,
_: Option<MemberEventContent>,
) {

View File

@ -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<MessageEventContent>) {
async fn on_room_message(&self, room: BaseRoom, event: &SyncMessageEvent<MessageEventContent>) {
if let Some(room) = Joined::new(self.client.clone(), room) {
let msg_body = if let SyncMessageEvent {
content:

View File

@ -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<MessageEventContent>) {
async fn on_room_message(&self, room: BaseRoom, event: &SyncMessageEvent<MessageEventContent>) {
if let Some(room) = Joined::new(self.client.clone(), room) {
let msg_body = if let SyncMessageEvent {
content:

View File

@ -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<MessageEventContent>) {
async fn on_room_message(&self, room: BaseRoom, event: &SyncMessageEvent<MessageEventContent>) {
if room.room_type() == RoomType::Joined {
if let SyncMessageEvent {
content:

View File

@ -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::*;

View File

@ -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,

View File

@ -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<Self> {
pub fn new(client: Client, room: BaseRoom) -> Option<Self> {
// TODO: Make this private
if room.room_type() == RoomType::Invited {
Some(Self {

View File

@ -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<Self> {
pub fn new(client: Client, room: BaseRoom) -> Option<Self> {
// TODO: Make this private
if room.room_type() == RoomType::Joined {
Some(Self {

View File

@ -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<Self> {
pub fn new(client: Client, room: BaseRoom) -> Option<Self> {
// TODO: Make this private
if room.room_type() == RoomType::Left {
Some(Self {