event_emitter: romove events for another PR
parent
7c7aaee22e
commit
e0400bd4e6
|
@ -19,7 +19,6 @@ use crate::events::{
|
||||||
ignored_user_list::IgnoredUserListEvent,
|
ignored_user_list::IgnoredUserListEvent,
|
||||||
presence::PresenceEvent,
|
presence::PresenceEvent,
|
||||||
push_rules::PushRulesEvent,
|
push_rules::PushRulesEvent,
|
||||||
receipt::ReceiptEvent,
|
|
||||||
room::{
|
room::{
|
||||||
aliases::AliasesEvent,
|
aliases::AliasesEvent,
|
||||||
avatar::AvatarEvent,
|
avatar::AvatarEvent,
|
||||||
|
@ -36,7 +35,6 @@ use crate::events::{
|
||||||
StrippedRoomAliases, StrippedRoomAvatar, StrippedRoomCanonicalAlias, StrippedRoomJoinRules,
|
StrippedRoomAliases, StrippedRoomAvatar, StrippedRoomCanonicalAlias, StrippedRoomJoinRules,
|
||||||
StrippedRoomMember, StrippedRoomName, StrippedRoomPowerLevels,
|
StrippedRoomMember, StrippedRoomName, StrippedRoomPowerLevels,
|
||||||
},
|
},
|
||||||
typing::TypingEvent,
|
|
||||||
};
|
};
|
||||||
use crate::models::Room;
|
use crate::models::Room;
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
|
@ -107,10 +105,6 @@ pub trait EventEmitter: Send + Sync {
|
||||||
async fn on_room_power_levels(&self, _: Arc<RwLock<Room>>, _: &PowerLevelsEvent) {}
|
async fn on_room_power_levels(&self, _: Arc<RwLock<Room>>, _: &PowerLevelsEvent) {}
|
||||||
/// Fires when `AsyncClient` receives a `RoomEvent::Tombstone` event.
|
/// Fires when `AsyncClient` receives a `RoomEvent::Tombstone` event.
|
||||||
async fn on_room_tombstone(&self, _: Arc<RwLock<Room>>, _: &TombstoneEvent) {}
|
async fn on_room_tombstone(&self, _: Arc<RwLock<Room>>, _: &TombstoneEvent) {}
|
||||||
/// Fires when `AsyncClient` receives a `NonRoomEvent::Typing` event.
|
|
||||||
async fn on_account_data_typing(&self, _: Arc<RwLock<Room>>, _: &TypingEvent) {}
|
|
||||||
/// Fires when `AsyncClient` receives a `NonRoomEvent::Typing` event.
|
|
||||||
async fn on_account_data_receipt(&self, _: Arc<RwLock<Room>>, _: &ReceiptEvent) {}
|
|
||||||
|
|
||||||
// `RoomEvent`s from `IncomingState`
|
// `RoomEvent`s from `IncomingState`
|
||||||
/// Fires when `AsyncClient` receives a `StateEvent::RoomMember` event.
|
/// Fires when `AsyncClient` receives a `StateEvent::RoomMember` event.
|
||||||
|
@ -306,7 +300,7 @@ mod test {
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn event_emitter_sync() {
|
async fn event_emitter_joined() {
|
||||||
let homeserver = Url::from_str(&mockito::server_url()).unwrap();
|
let homeserver = Url::from_str(&mockito::server_url()).unwrap();
|
||||||
|
|
||||||
let session = Session {
|
let session = Session {
|
||||||
|
|
|
@ -397,15 +397,15 @@ impl Room {
|
||||||
pub fn receive_timeline_event(&mut self, event: &RoomEvent) -> bool {
|
pub fn receive_timeline_event(&mut self, event: &RoomEvent) -> bool {
|
||||||
match event {
|
match event {
|
||||||
// update to the current members of the room
|
// update to the current members of the room
|
||||||
RoomEvent::RoomMember(member) => self.handle_membership(member),
|
RoomEvent::RoomMember(m) => self.handle_membership(m),
|
||||||
// finds all events related to the name of the room for later use
|
// finds all events related to the name of the room for later use
|
||||||
RoomEvent::RoomName(name) => self.handle_room_name(name),
|
RoomEvent::RoomName(n) => self.handle_room_name(n),
|
||||||
RoomEvent::RoomCanonicalAlias(c_alias) => self.handle_canonical(c_alias),
|
RoomEvent::RoomCanonicalAlias(ca) => self.handle_canonical(ca),
|
||||||
RoomEvent::RoomAliases(alias) => self.handle_room_aliases(alias),
|
RoomEvent::RoomAliases(a) => self.handle_room_aliases(a),
|
||||||
// power levels of the room members
|
// power levels of the room members
|
||||||
RoomEvent::RoomPowerLevels(power) => self.handle_power_level(power),
|
RoomEvent::RoomPowerLevels(p) => self.handle_power_level(p),
|
||||||
RoomEvent::RoomTombstone(tomb) => self.handle_tombstone(tomb),
|
RoomEvent::RoomTombstone(t) => self.handle_tombstone(t),
|
||||||
RoomEvent::RoomEncryption(encrypt) => self.handle_encryption_event(encrypt),
|
RoomEvent::RoomEncryption(e) => self.handle_encryption_event(e),
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -419,16 +419,13 @@ impl Room {
|
||||||
/// * `event` - The event of the room.
|
/// * `event` - The event of the room.
|
||||||
pub fn receive_state_event(&mut self, event: &StateEvent) -> bool {
|
pub fn receive_state_event(&mut self, event: &StateEvent) -> bool {
|
||||||
match event {
|
match event {
|
||||||
// update to the current members of the room
|
StateEvent::RoomMember(m) => self.handle_membership(m),
|
||||||
StateEvent::RoomMember(member) => self.handle_membership(member),
|
StateEvent::RoomName(n) => self.handle_room_name(n),
|
||||||
// finds all events related to the name of the room for later use
|
StateEvent::RoomCanonicalAlias(ca) => self.handle_canonical(ca),
|
||||||
StateEvent::RoomName(name) => self.handle_room_name(name),
|
StateEvent::RoomAliases(a) => self.handle_room_aliases(a),
|
||||||
StateEvent::RoomCanonicalAlias(c_alias) => self.handle_canonical(c_alias),
|
StateEvent::RoomPowerLevels(p) => self.handle_power_level(p),
|
||||||
StateEvent::RoomAliases(alias) => self.handle_room_aliases(alias),
|
StateEvent::RoomTombstone(t) => self.handle_tombstone(t),
|
||||||
// power levels of the room members
|
StateEvent::RoomEncryption(e) => self.handle_encryption_event(e),
|
||||||
StateEvent::RoomPowerLevels(power) => self.handle_power_level(power),
|
|
||||||
StateEvent::RoomTombstone(tomb) => self.handle_tombstone(tomb),
|
|
||||||
StateEvent::RoomEncryption(encrypt) => self.handle_encryption_event(encrypt),
|
|
||||||
_ => false,
|
_ => false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue