event-emitter: rename on_account_data_* -> on_non_room_*

master
Devin R 2020-06-01 07:13:57 -04:00
parent 8ee6c3bdc8
commit 8f017e7b27
2 changed files with 23 additions and 23 deletions

View File

@ -1601,18 +1601,18 @@ impl BaseClient {
match event { match event {
NonRoomEvent::Presence(presence) => { NonRoomEvent::Presence(presence) => {
event_emitter.on_account_presence(room, &presence).await event_emitter.on_non_room_presence(room, &presence).await
} }
NonRoomEvent::IgnoredUserList(ignored) => { NonRoomEvent::IgnoredUserList(ignored) => {
event_emitter.on_account_ignored_users(room, &ignored).await event_emitter
.on_non_room_ignored_users(room, &ignored)
.await
} }
NonRoomEvent::PushRules(rules) => { NonRoomEvent::PushRules(rules) => {
event_emitter.on_account_push_rules(room, &rules).await event_emitter.on_non_room_push_rules(room, &rules).await
} }
NonRoomEvent::FullyRead(full_read) => { NonRoomEvent::FullyRead(full_read) => {
event_emitter event_emitter.on_non_room_fully_read(room, &full_read).await
.on_account_data_fully_read(room, &full_read)
.await
} }
_ => {} _ => {}
} }
@ -1657,18 +1657,18 @@ impl BaseClient {
match event { match event {
NonRoomEvent::Presence(presence) => { NonRoomEvent::Presence(presence) => {
event_emitter.on_account_presence(room, &presence).await event_emitter.on_non_room_presence(room, &presence).await
} }
NonRoomEvent::IgnoredUserList(ignored) => { NonRoomEvent::IgnoredUserList(ignored) => {
event_emitter.on_account_ignored_users(room, &ignored).await event_emitter
.on_non_room_ignored_users(room, &ignored)
.await
} }
NonRoomEvent::PushRules(rules) => { NonRoomEvent::PushRules(rules) => {
event_emitter.on_account_push_rules(room, &rules).await event_emitter.on_non_room_push_rules(room, &rules).await
} }
NonRoomEvent::FullyRead(full_read) => { NonRoomEvent::FullyRead(full_read) => {
event_emitter event_emitter.on_non_room_fully_read(room, &full_read).await
.on_account_data_fully_read(room, &full_read)
.await
} }
_ => {} _ => {}
} }

View File

@ -153,20 +153,20 @@ pub trait EventEmitter: Send + Sync {
async fn on_stripped_state_join_rules(&self, _: SyncRoom, _: &StrippedRoomJoinRules) {} async fn on_stripped_state_join_rules(&self, _: SyncRoom, _: &StrippedRoomJoinRules) {}
// `NonRoomEvent` (this is a type alias from ruma_events) // `NonRoomEvent` (this is a type alias from ruma_events)
/// Fires when `Client` receives a `NonRoomEvent::RoomMember` event. /// Fires when `Client` receives a `NonRoomEvent::RoomPresence` event.
async fn on_account_presence(&self, _: SyncRoom, _: &PresenceEvent) {} async fn on_non_room_presence(&self, _: SyncRoom, _: &PresenceEvent) {}
/// Fires when `Client` receives a `NonRoomEvent::RoomName` event. /// Fires when `Client` receives a `NonRoomEvent::RoomName` event.
async fn on_account_ignored_users(&self, _: SyncRoom, _: &IgnoredUserListEvent) {} async fn on_non_room_ignored_users(&self, _: SyncRoom, _: &IgnoredUserListEvent) {}
/// Fires when `Client` receives a `NonRoomEvent::RoomCanonicalAlias` event. /// Fires when `Client` receives a `NonRoomEvent::RoomCanonicalAlias` event.
async fn on_account_push_rules(&self, _: SyncRoom, _: &PushRulesEvent) {} async fn on_non_room_push_rules(&self, _: SyncRoom, _: &PushRulesEvent) {}
/// Fires when `Client` receives a `NonRoomEvent::RoomAliases` event. /// Fires when `Client` receives a `NonRoomEvent::RoomAliases` event.
async fn on_account_data_fully_read(&self, _: SyncRoom, _: &FullyReadEvent) {} async fn on_non_room_fully_read(&self, _: SyncRoom, _: &FullyReadEvent) {}
/// Fires when `Client` receives a `NonRoomEvent::Typing` event. /// Fires when `Client` receives a `NonRoomEvent::Typing` event.
async fn on_account_data_typing(&self, _: SyncRoom, _: &TypingEvent) {} async fn on_non_room_typing(&self, _: SyncRoom, _: &TypingEvent) {}
/// Fires when `Client` receives a `NonRoomEvent::Receipt` event. /// Fires when `Client` receives a `NonRoomEvent::Receipt` event.
/// ///
/// This is always a read receipt. /// This is always a read receipt.
async fn on_account_data_receipt(&self, _: SyncRoom, _: &ReceiptEvent) {} async fn on_non_room_receipt(&self, _: SyncRoom, _: &ReceiptEvent) {}
// `PresenceEvent` is a struct so there is only the one method // `PresenceEvent` is a struct so there is only the one method
/// Fires when `Client` receives a `NonRoomEvent::RoomAliases` event. /// Fires when `Client` receives a `NonRoomEvent::RoomAliases` event.
@ -284,16 +284,16 @@ mod test {
self.0.lock().await.push("stripped state rules".to_string()) self.0.lock().await.push("stripped state rules".to_string())
} }
async fn on_account_presence(&self, _: SyncRoom, _: &PresenceEvent) { async fn on_non_room_presence(&self, _: SyncRoom, _: &PresenceEvent) {
self.0.lock().await.push("account presence".to_string()) self.0.lock().await.push("account presence".to_string())
} }
async fn on_account_ignored_users(&self, _: SyncRoom, _: &IgnoredUserListEvent) { async fn on_non_room_ignored_users(&self, _: SyncRoom, _: &IgnoredUserListEvent) {
self.0.lock().await.push("account ignore".to_string()) self.0.lock().await.push("account ignore".to_string())
} }
async fn on_account_push_rules(&self, _: SyncRoom, _: &PushRulesEvent) { async fn on_non_room_push_rules(&self, _: SyncRoom, _: &PushRulesEvent) {
self.0.lock().await.push("account push rules".to_string()) self.0.lock().await.push("account push rules".to_string())
} }
async fn on_account_data_fully_read(&self, _: SyncRoom, _: &FullyReadEvent) { async fn on_non_room_fully_read(&self, _: SyncRoom, _: &FullyReadEvent) {
self.0.lock().await.push("account read".to_string()) self.0.lock().await.push("account read".to_string())
} }
async fn on_presence_event(&self, _: SyncRoom, _: &PresenceEvent) { async fn on_presence_event(&self, _: SyncRoom, _: &PresenceEvent) {