use inner event type for EventEmitter methods
parent
83bf8bc67c
commit
2ed152708c
|
@ -17,12 +17,12 @@ struct EventCallback;
|
||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl EventEmitter for EventCallback {
|
impl EventEmitter for EventCallback {
|
||||||
async fn on_room_message(&mut self, room: Arc<Mutex<Room>>, event: Arc<Mutex<RoomEvent>>) {
|
async fn on_room_message(&mut self, room: Arc<Mutex<Room>>, event: Arc<Mutex<MessageEvent>>) {
|
||||||
if let RoomEvent::RoomMessage(MessageEvent {
|
if let MessageEvent {
|
||||||
content: MessageEventContent::Text(TextMessageEventContent { body: msg_body, .. }),
|
content: MessageEventContent::Text(TextMessageEventContent { body: msg_body, .. }),
|
||||||
sender,
|
sender,
|
||||||
..
|
..
|
||||||
}) = event.lock().await.deref()
|
} = event.lock().await.deref()
|
||||||
{
|
{
|
||||||
let rooms = room.lock().await;
|
let rooms = room.lock().await;
|
||||||
let member = rooms.members.get(&sender.to_string()).unwrap();
|
let member = rooms.members.get(&sender.to_string()).unwrap();
|
||||||
|
|
|
@ -367,7 +367,6 @@ impl AsyncClient {
|
||||||
client.get_or_create_room(&room_id_string).clone()
|
client.get_or_create_room(&room_id_string).clone()
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO should we determine if anything room state has changed before calling
|
|
||||||
// re looping is not ideal here
|
// re looping is not ideal here
|
||||||
for event in &mut room.state.events {
|
for event in &mut room.state.events {
|
||||||
if let EventResult::Ok(e) = event {
|
if let EventResult::Ok(e) = event {
|
||||||
|
@ -386,7 +385,6 @@ impl AsyncClient {
|
||||||
*event = e;
|
*event = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO should we determine if any room state has changed before calling
|
|
||||||
if let EventResult::Ok(e) = event {
|
if let EventResult::Ok(e) = event {
|
||||||
client.emit_timeline_event(room_id, e).await;
|
client.emit_timeline_event(room_id, e).await;
|
||||||
}
|
}
|
||||||
|
@ -398,7 +396,6 @@ impl AsyncClient {
|
||||||
if let EventResult::Ok(e) = account_data {
|
if let EventResult::Ok(e) = account_data {
|
||||||
client.receive_account_data(&room_id_string, e).await;
|
client.receive_account_data(&room_id_string, e).await;
|
||||||
|
|
||||||
// TODO should we determine if anything room state has changed before calling
|
|
||||||
client.emit_account_data_event(room_id, e).await;
|
client.emit_account_data_event(room_id, e).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,7 +411,6 @@ impl AsyncClient {
|
||||||
if let EventResult::Ok(e) = presence {
|
if let EventResult::Ok(e) = presence {
|
||||||
client.receive_presence_event(&room_id_string, e).await;
|
client.receive_presence_event(&room_id_string, e).await;
|
||||||
|
|
||||||
// TODO should we determine if any room state has changed before calling
|
|
||||||
client.emit_presence_event(room_id, e).await;
|
client.emit_presence_event(room_id, e).await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -499,103 +499,106 @@ impl Client {
|
||||||
|
|
||||||
pub(crate) async fn emit_timeline_event(&mut self, room_id: &RoomId, event: &mut RoomEvent) {
|
pub(crate) async fn emit_timeline_event(&mut self, room_id: &RoomId, event: &mut RoomEvent) {
|
||||||
match event {
|
match event {
|
||||||
RoomEvent::RoomMember(_) => {
|
RoomEvent::RoomMember(mem) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_room_member(Arc::clone(&room), Arc::new(Mutex::new(event.clone())))
|
.on_room_member(Arc::clone(&room), Arc::new(Mutex::new(mem.clone())))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoomEvent::RoomName(_) => {
|
RoomEvent::RoomName(name) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_room_name(Arc::clone(&room), Arc::new(Mutex::new(event.clone())))
|
.on_room_name(Arc::clone(&room), Arc::new(Mutex::new(name.clone())))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoomEvent::RoomCanonicalAlias(_) => {
|
RoomEvent::RoomCanonicalAlias(canonical) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_room_canonical_alias(
|
.on_room_canonical_alias(
|
||||||
Arc::clone(&room),
|
Arc::clone(&room),
|
||||||
Arc::new(Mutex::new(event.clone())),
|
Arc::new(Mutex::new(canonical.clone())),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoomEvent::RoomAliases(_) => {
|
RoomEvent::RoomAliases(aliases) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_room_aliases(Arc::clone(&room), Arc::new(Mutex::new(event.clone())))
|
.on_room_aliases(
|
||||||
|
Arc::clone(&room),
|
||||||
|
Arc::new(Mutex::new(aliases.clone())),
|
||||||
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoomEvent::RoomAvatar(_) => {
|
RoomEvent::RoomAvatar(avatar) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_room_avatar(Arc::clone(&room), Arc::new(Mutex::new(event.clone())))
|
.on_room_avatar(Arc::clone(&room), Arc::new(Mutex::new(avatar.clone())))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoomEvent::RoomMessage(_) => {
|
RoomEvent::RoomMessage(msg) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_room_message(Arc::clone(&room), Arc::new(Mutex::new(event.clone())))
|
.on_room_message(Arc::clone(&room), Arc::new(Mutex::new(msg.clone())))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoomEvent::RoomMessageFeedback(_) => {
|
RoomEvent::RoomMessageFeedback(msg_feedback) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_room_message_feedback(
|
.on_room_message_feedback(
|
||||||
Arc::clone(&room),
|
Arc::clone(&room),
|
||||||
Arc::new(Mutex::new(event.clone())),
|
Arc::new(Mutex::new(msg_feedback.clone())),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoomEvent::RoomRedaction(_) => {
|
RoomEvent::RoomRedaction(redaction) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_room_redaction(
|
.on_room_redaction(
|
||||||
Arc::clone(&room),
|
Arc::clone(&room),
|
||||||
Arc::new(Mutex::new(event.clone())),
|
Arc::new(Mutex::new(redaction.clone())),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RoomEvent::RoomPowerLevels(_) => {
|
RoomEvent::RoomPowerLevels(power) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_room_power_levels(
|
.on_room_power_levels(
|
||||||
Arc::clone(&room),
|
Arc::clone(&room),
|
||||||
Arc::new(Mutex::new(event.clone())),
|
Arc::new(Mutex::new(power.clone())),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
@ -607,83 +610,89 @@ impl Client {
|
||||||
|
|
||||||
pub(crate) async fn emit_state_event(&mut self, room_id: &RoomId, event: &mut StateEvent) {
|
pub(crate) async fn emit_state_event(&mut self, room_id: &RoomId, event: &mut StateEvent) {
|
||||||
match event {
|
match event {
|
||||||
StateEvent::RoomMember(_) => {
|
StateEvent::RoomMember(member) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_state_member(Arc::clone(&room), Arc::new(Mutex::new(event.clone())))
|
.on_state_member(
|
||||||
|
Arc::clone(&room),
|
||||||
|
Arc::new(Mutex::new(member.clone())),
|
||||||
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StateEvent::RoomName(_) => {
|
StateEvent::RoomName(name) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_state_name(Arc::clone(&room), Arc::new(Mutex::new(event.clone())))
|
.on_state_name(Arc::clone(&room), Arc::new(Mutex::new(name.clone())))
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StateEvent::RoomCanonicalAlias(_) => {
|
StateEvent::RoomCanonicalAlias(canonical) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_state_canonical_alias(
|
.on_state_canonical_alias(
|
||||||
Arc::clone(&room),
|
Arc::clone(&room),
|
||||||
Arc::new(Mutex::new(event.clone())),
|
Arc::new(Mutex::new(canonical.clone())),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StateEvent::RoomAliases(_) => {
|
StateEvent::RoomAliases(aliases) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_state_aliases(
|
.on_state_aliases(
|
||||||
Arc::clone(&room),
|
Arc::clone(&room),
|
||||||
Arc::new(Mutex::new(event.clone())),
|
Arc::new(Mutex::new(aliases.clone())),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StateEvent::RoomAvatar(_) => {
|
StateEvent::RoomAvatar(avatar) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_state_avatar(Arc::clone(&room), Arc::new(Mutex::new(event.clone())))
|
.on_state_avatar(
|
||||||
|
Arc::clone(&room),
|
||||||
|
Arc::new(Mutex::new(avatar.clone())),
|
||||||
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StateEvent::RoomPowerLevels(_) => {
|
StateEvent::RoomPowerLevels(power) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_state_power_levels(
|
.on_state_power_levels(
|
||||||
Arc::clone(&room),
|
Arc::clone(&room),
|
||||||
Arc::new(Mutex::new(event.clone())),
|
Arc::new(Mutex::new(power.clone())),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
StateEvent::RoomJoinRules(_) => {
|
StateEvent::RoomJoinRules(rules) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_state_join_rules(
|
.on_state_join_rules(
|
||||||
Arc::clone(&room),
|
Arc::clone(&room),
|
||||||
Arc::new(Mutex::new(event.clone())),
|
Arc::new(Mutex::new(rules.clone())),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
@ -699,53 +708,53 @@ impl Client {
|
||||||
event: &mut NonRoomEvent,
|
event: &mut NonRoomEvent,
|
||||||
) {
|
) {
|
||||||
match event {
|
match event {
|
||||||
NonRoomEvent::Presence(_) => {
|
NonRoomEvent::Presence(presence) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_account_presence(
|
.on_account_presence(
|
||||||
Arc::clone(&room),
|
Arc::clone(&room),
|
||||||
Arc::new(Mutex::new(event.clone())),
|
Arc::new(Mutex::new(presence.clone())),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NonRoomEvent::IgnoredUserList(_) => {
|
NonRoomEvent::IgnoredUserList(ignored) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_account_ignored_users(
|
.on_account_ignored_users(
|
||||||
Arc::clone(&room),
|
Arc::clone(&room),
|
||||||
Arc::new(Mutex::new(event.clone())),
|
Arc::new(Mutex::new(ignored.clone())),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NonRoomEvent::PushRules(_) => {
|
NonRoomEvent::PushRules(rules) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_account_push_rules(
|
.on_account_push_rules(
|
||||||
Arc::clone(&room),
|
Arc::clone(&room),
|
||||||
Arc::new(Mutex::new(event.clone())),
|
Arc::new(Mutex::new(rules.clone())),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
NonRoomEvent::FullyRead(_) => {
|
NonRoomEvent::FullyRead(full_read) => {
|
||||||
if let Some(ee) = &self.event_emitter {
|
if let Some(ee) = &self.event_emitter {
|
||||||
if let Some(room) = self.get_room(&room_id.to_string()) {
|
if let Some(room) = self.get_room(&room_id.to_string()) {
|
||||||
ee.lock()
|
ee.lock()
|
||||||
.await
|
.await
|
||||||
.on_account_data_fully_read(
|
.on_account_data_fully_read(
|
||||||
Arc::clone(&room),
|
Arc::clone(&room),
|
||||||
Arc::new(Mutex::new(event.clone())),
|
Arc::new(Mutex::new(full_read.clone())),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,50 @@
|
||||||
|
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use crate::events::collections::all::{RoomEvent, StateEvent};
|
use crate::events::{
|
||||||
use crate::events::collections::only::Event as NonRoomEvent;
|
call::{
|
||||||
use crate::events::presence::PresenceEvent;
|
answer::AnswerEvent, candidates::CandidatesEvent, hangup::HangupEvent, invite::InviteEvent,
|
||||||
|
},
|
||||||
|
direct::DirectEvent,
|
||||||
|
dummy::DummyEvent,
|
||||||
|
forwarded_room_key::ForwardedRoomKeyEvent,
|
||||||
|
fully_read::FullyReadEvent,
|
||||||
|
ignored_user_list::IgnoredUserListEvent,
|
||||||
|
key::verification::{
|
||||||
|
accept::AcceptEvent, cancel::CancelEvent, key::KeyEvent, mac::MacEvent,
|
||||||
|
request::RequestEvent, start::StartEvent,
|
||||||
|
},
|
||||||
|
presence::PresenceEvent,
|
||||||
|
push_rules::PushRulesEvent,
|
||||||
|
receipt::ReceiptEvent,
|
||||||
|
room::{
|
||||||
|
aliases::AliasesEvent,
|
||||||
|
avatar::AvatarEvent,
|
||||||
|
canonical_alias::CanonicalAliasEvent,
|
||||||
|
create::CreateEvent,
|
||||||
|
encrypted::EncryptedEvent,
|
||||||
|
encryption::EncryptionEvent,
|
||||||
|
guest_access::GuestAccessEvent,
|
||||||
|
history_visibility::HistoryVisibilityEvent,
|
||||||
|
join_rules::JoinRulesEvent,
|
||||||
|
member::MemberEvent,
|
||||||
|
message::{feedback::FeedbackEvent, MessageEvent},
|
||||||
|
name::NameEvent,
|
||||||
|
pinned_events::PinnedEventsEvent,
|
||||||
|
power_levels::PowerLevelsEvent,
|
||||||
|
redaction::RedactionEvent,
|
||||||
|
server_acl::ServerAclEvent,
|
||||||
|
third_party_invite::ThirdPartyInviteEvent,
|
||||||
|
tombstone::TombstoneEvent,
|
||||||
|
topic::TopicEvent,
|
||||||
|
},
|
||||||
|
room_key::RoomKeyEvent,
|
||||||
|
room_key_request::RoomKeyRequestEvent,
|
||||||
|
sticker::StickerEvent,
|
||||||
|
tag::TagEvent,
|
||||||
|
typing::TypingEvent,
|
||||||
|
CustomEvent, CustomRoomEvent, CustomStateEvent,
|
||||||
|
};
|
||||||
use crate::models::Room;
|
use crate::models::Room;
|
||||||
|
|
||||||
use tokio::sync::Mutex;
|
use tokio::sync::Mutex;
|
||||||
|
@ -26,53 +67,78 @@ use tokio::sync::Mutex;
|
||||||
pub trait EventEmitter: Send + Sync {
|
pub trait EventEmitter: Send + Sync {
|
||||||
// ROOM EVENTS from `IncomingTimeline`
|
// ROOM EVENTS from `IncomingTimeline`
|
||||||
/// Fires when `AsyncClient` receives a `RoomEvent::RoomMember` event.
|
/// Fires when `AsyncClient` receives a `RoomEvent::RoomMember` event.
|
||||||
async fn on_room_member(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<RoomEvent>>) {}
|
async fn on_room_member(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<MemberEvent>>) {}
|
||||||
/// Fires when `AsyncClient` receives a `RoomEvent::RoomName` event.
|
/// Fires when `AsyncClient` receives a `RoomEvent::RoomName` event.
|
||||||
async fn on_room_name(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<RoomEvent>>) {}
|
async fn on_room_name(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<NameEvent>>) {}
|
||||||
/// Fires when `AsyncClient` receives a `RoomEvent::RoomCanonicalAlias` event.
|
/// Fires when `AsyncClient` receives a `RoomEvent::RoomCanonicalAlias` event.
|
||||||
async fn on_room_canonical_alias(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<RoomEvent>>) {}
|
async fn on_room_canonical_alias(
|
||||||
|
&mut self,
|
||||||
|
_: Arc<Mutex<Room>>,
|
||||||
|
_: Arc<Mutex<CanonicalAliasEvent>>,
|
||||||
|
) {
|
||||||
|
}
|
||||||
/// Fires when `AsyncClient` receives a `RoomEvent::RoomAliases` event.
|
/// Fires when `AsyncClient` receives a `RoomEvent::RoomAliases` event.
|
||||||
async fn on_room_aliases(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<RoomEvent>>) {}
|
async fn on_room_aliases(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<AliasesEvent>>) {}
|
||||||
/// Fires when `AsyncClient` receives a `RoomEvent::RoomAvatar` event.
|
/// Fires when `AsyncClient` receives a `RoomEvent::RoomAvatar` event.
|
||||||
async fn on_room_avatar(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<RoomEvent>>) {}
|
async fn on_room_avatar(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<AvatarEvent>>) {}
|
||||||
/// Fires when `AsyncClient` receives a `RoomEvent::RoomMessage` event.
|
/// Fires when `AsyncClient` receives a `RoomEvent::RoomMessage` event.
|
||||||
async fn on_room_message(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<RoomEvent>>) {}
|
async fn on_room_message(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<MessageEvent>>) {}
|
||||||
/// Fires when `AsyncClient` receives a `RoomEvent::RoomMessageFeedback` event.
|
/// Fires when `AsyncClient` receives a `RoomEvent::RoomMessageFeedback` event.
|
||||||
async fn on_room_message_feedback(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<RoomEvent>>) {}
|
async fn on_room_message_feedback(
|
||||||
|
&mut self,
|
||||||
|
_: Arc<Mutex<Room>>,
|
||||||
|
_: Arc<Mutex<FeedbackEvent>>,
|
||||||
|
) {
|
||||||
|
}
|
||||||
/// Fires when `AsyncClient` receives a `RoomEvent::RoomRedaction` event.
|
/// Fires when `AsyncClient` receives a `RoomEvent::RoomRedaction` event.
|
||||||
async fn on_room_redaction(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<RoomEvent>>) {}
|
async fn on_room_redaction(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<RedactionEvent>>) {}
|
||||||
/// Fires when `AsyncClient` receives a `RoomEvent::RoomPowerLevels` event.
|
/// Fires when `AsyncClient` receives a `RoomEvent::RoomPowerLevels` event.
|
||||||
async fn on_room_power_levels(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<RoomEvent>>) {}
|
async fn on_room_power_levels(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<PowerLevelsEvent>>) {
|
||||||
|
}
|
||||||
|
|
||||||
// `RoomEvent`s from `IncomingState`
|
// `RoomEvent`s from `IncomingState`
|
||||||
/// Fires when `AsyncClient` receives a `StateEvent::RoomMember` event.
|
/// Fires when `AsyncClient` receives a `StateEvent::RoomMember` event.
|
||||||
async fn on_state_member(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<StateEvent>>) {}
|
async fn on_state_member(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<MemberEvent>>) {}
|
||||||
/// Fires when `AsyncClient` receives a `StateEvent::RoomName` event.
|
/// Fires when `AsyncClient` receives a `StateEvent::RoomName` event.
|
||||||
async fn on_state_name(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<StateEvent>>) {}
|
async fn on_state_name(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<NameEvent>>) {}
|
||||||
/// Fires when `AsyncClient` receives a `StateEvent::RoomCanonicalAlias` event.
|
/// Fires when `AsyncClient` receives a `StateEvent::RoomCanonicalAlias` event.
|
||||||
async fn on_state_canonical_alias(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<StateEvent>>) {}
|
async fn on_state_canonical_alias(
|
||||||
|
&mut self,
|
||||||
|
_: Arc<Mutex<Room>>,
|
||||||
|
_: Arc<Mutex<CanonicalAliasEvent>>,
|
||||||
|
) {
|
||||||
|
}
|
||||||
/// Fires when `AsyncClient` receives a `StateEvent::RoomAliases` event.
|
/// Fires when `AsyncClient` receives a `StateEvent::RoomAliases` event.
|
||||||
async fn on_state_aliases(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<StateEvent>>) {}
|
async fn on_state_aliases(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<AliasesEvent>>) {}
|
||||||
/// Fires when `AsyncClient` receives a `StateEvent::RoomAvatar` event.
|
/// Fires when `AsyncClient` receives a `StateEvent::RoomAvatar` event.
|
||||||
async fn on_state_avatar(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<StateEvent>>) {}
|
async fn on_state_avatar(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<AvatarEvent>>) {}
|
||||||
/// Fires when `AsyncClient` receives a `StateEvent::RoomPowerLevels` event.
|
/// Fires when `AsyncClient` receives a `StateEvent::RoomPowerLevels` event.
|
||||||
async fn on_state_power_levels(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<StateEvent>>) {}
|
async fn on_state_power_levels(
|
||||||
|
&mut self,
|
||||||
|
_: Arc<Mutex<Room>>,
|
||||||
|
_: Arc<Mutex<PowerLevelsEvent>>,
|
||||||
|
) {
|
||||||
|
}
|
||||||
/// Fires when `AsyncClient` receives a `StateEvent::RoomJoinRules` event.
|
/// Fires when `AsyncClient` receives a `StateEvent::RoomJoinRules` event.
|
||||||
async fn on_state_join_rules(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<StateEvent>>) {}
|
async fn on_state_join_rules(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<JoinRulesEvent>>) {}
|
||||||
|
|
||||||
// `NonRoomEvent` (this is a type alias from ruma_events) from `IncomingAccountData`
|
// `NonRoomEvent` (this is a type alias from ruma_events) from `IncomingAccountData`
|
||||||
/// Fires when `AsyncClient` receives a `NonRoomEvent::RoomMember` event.
|
/// Fires when `AsyncClient` receives a `NonRoomEvent::RoomMember` event.
|
||||||
async fn on_account_presence(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<NonRoomEvent>>) {}
|
async fn on_account_presence(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<PresenceEvent>>) {}
|
||||||
/// Fires when `AsyncClient` receives a `NonRoomEvent::RoomName` event.
|
/// Fires when `AsyncClient` receives a `NonRoomEvent::RoomName` event.
|
||||||
async fn on_account_ignored_users(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<NonRoomEvent>>) {
|
async fn on_account_ignored_users(
|
||||||
|
&mut self,
|
||||||
|
_: Arc<Mutex<Room>>,
|
||||||
|
_: Arc<Mutex<IgnoredUserListEvent>>,
|
||||||
|
) {
|
||||||
}
|
}
|
||||||
/// Fires when `AsyncClient` receives a `NonRoomEvent::RoomCanonicalAlias` event.
|
/// Fires when `AsyncClient` receives a `NonRoomEvent::RoomCanonicalAlias` event.
|
||||||
async fn on_account_push_rules(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<NonRoomEvent>>) {}
|
async fn on_account_push_rules(&mut self, _: Arc<Mutex<Room>>, _: Arc<Mutex<PushRulesEvent>>) {}
|
||||||
/// Fires when `AsyncClient` receives a `NonRoomEvent::RoomAliases` event.
|
/// Fires when `AsyncClient` receives a `NonRoomEvent::RoomAliases` event.
|
||||||
async fn on_account_data_fully_read(
|
async fn on_account_data_fully_read(
|
||||||
&mut self,
|
&mut self,
|
||||||
_: Arc<Mutex<Room>>,
|
_: Arc<Mutex<Room>>,
|
||||||
_: Arc<Mutex<NonRoomEvent>>,
|
_: Arc<Mutex<FullyReadEvent>>,
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue