From 8f017e7b272d42900b19af79fc0545862ea18a2c Mon Sep 17 00:00:00 2001 From: Devin R Date: Mon, 1 Jun 2020 07:13:57 -0400 Subject: [PATCH] event-emitter: rename on_account_data_* -> on_non_room_* --- matrix_sdk_base/src/client.rs | 24 ++++++++++++------------ matrix_sdk_base/src/event_emitter/mod.rs | 22 +++++++++++----------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/matrix_sdk_base/src/client.rs b/matrix_sdk_base/src/client.rs index 6f79c4e4..be3cd531 100644 --- a/matrix_sdk_base/src/client.rs +++ b/matrix_sdk_base/src/client.rs @@ -1601,18 +1601,18 @@ impl BaseClient { match event { NonRoomEvent::Presence(presence) => { - event_emitter.on_account_presence(room, &presence).await + event_emitter.on_non_room_presence(room, &presence).await } 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) => { - event_emitter.on_account_push_rules(room, &rules).await + event_emitter.on_non_room_push_rules(room, &rules).await } NonRoomEvent::FullyRead(full_read) => { - event_emitter - .on_account_data_fully_read(room, &full_read) - .await + event_emitter.on_non_room_fully_read(room, &full_read).await } _ => {} } @@ -1657,18 +1657,18 @@ impl BaseClient { match event { NonRoomEvent::Presence(presence) => { - event_emitter.on_account_presence(room, &presence).await + event_emitter.on_non_room_presence(room, &presence).await } 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) => { - event_emitter.on_account_push_rules(room, &rules).await + event_emitter.on_non_room_push_rules(room, &rules).await } NonRoomEvent::FullyRead(full_read) => { - event_emitter - .on_account_data_fully_read(room, &full_read) - .await + event_emitter.on_non_room_fully_read(room, &full_read).await } _ => {} } diff --git a/matrix_sdk_base/src/event_emitter/mod.rs b/matrix_sdk_base/src/event_emitter/mod.rs index cb76dd73..1443c03b 100644 --- a/matrix_sdk_base/src/event_emitter/mod.rs +++ b/matrix_sdk_base/src/event_emitter/mod.rs @@ -153,20 +153,20 @@ pub trait EventEmitter: Send + Sync { async fn on_stripped_state_join_rules(&self, _: SyncRoom, _: &StrippedRoomJoinRules) {} // `NonRoomEvent` (this is a type alias from ruma_events) - /// Fires when `Client` receives a `NonRoomEvent::RoomMember` event. - async fn on_account_presence(&self, _: SyncRoom, _: &PresenceEvent) {} + /// Fires when `Client` receives a `NonRoomEvent::RoomPresence` event. + async fn on_non_room_presence(&self, _: SyncRoom, _: &PresenceEvent) {} /// 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. - 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. - 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. - 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. /// /// 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 /// Fires when `Client` receives a `NonRoomEvent::RoomAliases` event. @@ -284,16 +284,16 @@ mod test { 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()) } - 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()) } - 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()) } - 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()) } async fn on_presence_event(&self, _: SyncRoom, _: &PresenceEvent) {