Skip to content

Commit 59b7da2

Browse files
MatMaulpoljar
andauthored
Add some doc to add_event_handler for invites and stripped state (matrix-org#5705)
Signed-off-by: Mathieu Velten <[email protected]> Co-authored-by: Damir Jelić <[email protected]>
1 parent be5bd44 commit 59b7da2

File tree

1 file changed

+17
-1
lines changed
  • crates/matrix-sdk/src/client

1 file changed

+17
-1
lines changed

crates/matrix-sdk/src/client/mod.rs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -818,7 +818,11 @@ impl Client {
818818
/// events::{
819819
/// macros::EventContent,
820820
/// push_rules::PushRulesEvent,
821-
/// room::{message::SyncRoomMessageEvent, topic::SyncRoomTopicEvent},
821+
/// room::{
822+
/// message::SyncRoomMessageEvent,
823+
/// topic::SyncRoomTopicEvent,
824+
/// member::{StrippedRoomMemberEvent, SyncRoomMemberEvent},
825+
/// },
822826
/// },
823827
/// push::Action,
824828
/// Int, MilliSecondsSinceUnixEpoch,
@@ -871,6 +875,18 @@ impl Client {
871875
/// // Use the context
872876
/// });
873877
///
878+
/// // This will handle membership events in joined rooms. Invites are special, see below.
879+
/// client.add_event_handler(
880+
/// |ev: SyncRoomMemberEvent| async move {},
881+
/// );
882+
///
883+
/// // To handle state events in invited rooms (including invite membership events),
884+
/// // `StrippedRoomMemberEvent` should be used.
885+
/// // https://spec.matrix.org/v1.16/client-server-api/#stripped-state
886+
/// client.add_event_handler(
887+
/// |ev: StrippedRoomMemberEvent| async move {},
888+
/// );
889+
///
874890
/// // Custom events work exactly the same way, you just need to declare
875891
/// // the content struct and use the EventContent derive macro on it.
876892
/// #[derive(Clone, Debug, Deserialize, Serialize, EventContent)]

0 commit comments

Comments
 (0)