matrix-rust-sdk icon indicating copy to clipboard operation
matrix-rust-sdk copied to clipboard

Invitation to a room the client was previously in gets Room::Left not Room::Invited

Open kinnison opened this issue 2 years ago • 10 comments

Describe the bug

I am trying to experiment with the matrix SDK and I am trying to write a fairly basic bot to get the hang of things.

I figured a fairly easy thing to write would be a bot which would join any room it was invited to, and could be asked to leave the room by a message in the room.

With the help of the examples, I got the auto-join working for fresh rooms, however if I invite the bot to a room it has previously left, then in the StrippedRoomMemberEvent handler, the Room is a Room::Left rather than a Room::Invited

To Reproduce Steps to reproduce the behavior:

  1. Using the autojoin example
  2. Invite the bot to a new private room, note that it joins just fine
  3. Remove the bot from the room (either actively leave, or have admin remove from room)
  4. Invite the bot to the room again
  5. Note that the bot does not join
  6. Add some debugging diagnostics, and note that the Room is Room::Left and thus fails the if let Room::Invited(room) = room { test.

Expected behavior Regardless of whether or not the bot has been in the room before, an invitation should be accompanied by a Room::Invited

Desktop (please complete the following information):

  • OS: Linux
  • Browser N/A this is git+https://github.com/matrix-org/matrix-rust-sdk#5b1746e451ee6f4d499925bdad63b19a00044e24

Additional context

This is my first foray into matrix programming, so I could be thoroughly confused. I tried the following:

  1. Attempt to retrieve the invited room via client.get_invited_room() in the callback -- this fails because the room is known and "left"
  2. Attempt to forget the room in the callback - this resulted in a 400 API error.

kinnison avatar Feb 23 '22 19:02 kinnison

As an addendum, it'd be fine if it were possible to accept the invitation from the Room::Left but I think the API is trying to be an opinionated typestate API (which I approve of as a concept) and as such it won't let me.

kinnison avatar Feb 23 '22 19:02 kinnison

(Note it won't let me because the bot is invited to the room. If I disinvite the bot then the forget call doesn't error but the bot still ends up with a Room::Left when I then reinvite it. This suggests there's something very wrong going on with the room state persistence

kinnison avatar Feb 23 '22 19:02 kinnison

Final update (I hope) - If I enumerate the rooms after the initial sync_once and then forget all the rooms, and then kill the process and restart it, then I can reinvite it. This suggests that the forget() is hitting the filesystem, but is somehow persisting in the store unexpectedly.

kinnison avatar Feb 23 '22 19:02 kinnison

Note: famedly is planning to work on fixing the membership tracking soon as we need to have it work without timelines for appservices anyway as those don't have timelines. (also sliding sync/sync 3 also removes timelines. So the sdk should switch to actually properly handle membership)

MTRNord avatar Feb 24 '22 06:02 MTRNord

Huh? What do timelines have to do with this?

The problem is that room info needs to be kept separate if the room is an invited room vs any other type. Invited rooms are called stripped state rooms the other type is a normal room. So we have two buckets and we only take things out of the stripped state bucket if the room is considered to be invited.

So this sound like we have a room in both buckets, and once we get reinvited the room info in the normal bucket doesn't get marked as an invited room.

I think this diff should fix the issue:

diff --git a/crates/matrix-sdk-base/src/client.rs b/crates/matrix-sdk-base/src/client.rs
index 02d1a2c5d..a766251a3 100644
--- a/crates/matrix-sdk-base/src/client.rs
+++ b/crates/matrix-sdk-base/src/client.rs
@@ -901,6 +901,12 @@ impl BaseClient {
             let room = self.store.get_or_create_stripped_room(&room_id).await;
             let mut room_info = room.clone_info();
 
+            if let Some(r) = self.store.get_room(&room_id) {
+                let mut room_info = r.clone_info();
+                room_info.mark_as_invited();
+                changes.add_room(room_info);
+            }
+
             let (members, state_events) =
                 self.handle_invited_state(&new_info.invite_state.events, &mut room_info);
 
diff --git a/crates/matrix-sdk-base/src/rooms/normal.rs b/crates/matrix-sdk-base/src/rooms/normal.rs
index afb07cd89..db7f0cd5f 100644
--- a/crates/matrix-sdk-base/src/rooms/normal.rs
+++ b/crates/matrix-sdk-base/src/rooms/normal.rs
@@ -500,6 +500,10 @@ impl RoomInfo {
         self.room_type = RoomType::Left;
     }
 
+    pub(crate) fn mark_as_invited(&mut self) {
+        self.room_type = RoomType::Invited;
+    }
+
     pub(crate) fn mark_members_synced(&mut self) {
         self.members_synced = true;
     }

poljar avatar Feb 24 '22 08:02 poljar

Huh? What do timelines have to do with this?

Ah I thought it was related to the fact that rust-sdk relies on the timeline a room comes in to determine its state. (Which happens if you look at how /sync is processed by the sdk) :) It sounded related to that.

MTRNord avatar Feb 24 '22 08:02 MTRNord

Hmm perhaps you mean something else by timeline, by timeline I mean the thing that is called timeline in the sync response.

The SDK requires the room to be in one of the left, joined, invited buckets of the sync response to put it in the correct bucket locally. It does not look at the actual timeline of the individual rooms for this.

poljar avatar Feb 24 '22 08:02 poljar

Hmm perhaps you mean something else by timeline, by timeline I mean the thing that is called timeline in the sync response.

The SDK requires the room to be in one of the left, joined, invited buckets of the sync response to put it in the correct bucket locally. It does not look at the actual timeline of the individual rooms for this.

That was what I meant. Those timelines can in the current impl lead to wrong memberships on initial sync :) especially with appservices as those dont have these at all.

MTRNord avatar Feb 24 '22 08:02 MTRNord

We received a report that this is still a problem with the latest release. Reopening in the hope that the reporter will tell us more.

poljar avatar Jun 01 '22 12:06 poljar

Hello, I have a scenario that shows the issue as unresolved.

Here is my setup:

  • conduit as homeserver, cloned locally and running on http://localhost:6167: next branch at commit: 8bb58061fdc709f38b264c30d83c050477a89f9a
  • used element to create 2 account (the admin account and the bot account) and a "bot admin room".
  • the bot see code here: 8b6518628f923f34b2ab4bbe7a24537d39805b12 uses the bot account created above.
  • starting the bot (not invited in any room yet)
  • as the admin, i invite the bot in the room configured as "admin room" (the one created above)
  • the bot auto-accepts
  • I kick the bot
  • then I re-invite the bot. upon his message, the room state isn't invited but left and the bot can't the room in a invited state and ends up "blocked" at line bot.rs#L261

Some logs:

 2022-06-01T19:49:45.509Z DEBUG matrix_bot::bot             > We just started but we couldn't retrieve the admin room, are we invited ?.
 2022-06-01T19:49:45.509Z INFO  matrix_bot::bot             > Start syncing...
 2022-06-01T19:50:04.580Z TRACE want                        > signal: Want
 2022-06-01T19:50:04.580Z TRACE want                        > signal: Want
 2022-06-01T19:50:04.580Z DEBUG reqwest::async_impl::client > response '200 OK' for http://localhost:6167/_matrix/client/r0/sync?since=3477&timeout=30000
 2022-06-01T19:50:04.590Z TRACE want                        > signal: Want
 2022-06-01T19:50:04.590Z TRACE want                        > signal: Want
 2022-06-01T19:50:04.590Z DEBUG reqwest::async_impl::client > response '200 OK' for http://localhost:6167/_matrix/client/r0/sync?since=3477&timeout=30000
 2022-06-01T19:50:04.593Z DEBUG matrix_bot::bot             > Event: StrippedStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("admin ⚡\u{fe0f}"), is_direct: Some(false), membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, sender: "@admin:localhost", state_key: "@admin:localhost" }
 2022-06-01T19:50:04.593Z DEBUG matrix_bot::bot             > room: Invited(Invited { inner: Common { inner: Room { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", own_user_id: "@bot:localhost", inner: RwLock { data: RoomInfo { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", room_type: Invited, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: Some(Original(OriginalMinimalStateEvent { content: RoomCanonicalAliasEventContent { alias: Some("#botadminroom:localhost"), alt_aliases: [] }, event_id: None })), create: Some(Original(OriginalMinimalStateEvent { content: RoomCreateEventContent { creator: "@admin:localhost", federate: true, room_version: V6, predecessor: None, room_type: None }, event_id: None })), dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: Some(Original(OriginalMinimalStateEvent { content: RoomJoinRulesEventContent { join_rule: Invite }, event_id: None })), max_power_level: 100, name: Some(Original(OriginalMinimalStateEvent { content: RoomNameEventContent { name: Some("Bot Admin Room") }, event_id: None })), tombstone: None, topic: None } }, poisoned: false, .. }, store: MemoryStore { sync_token: RwLock { data: Some("3483"), poisoned: false, .. }, filters: {}, account_data: {PushRules: Raw::<ruma_common::events::enums::AnyGlobalAccountDataEvent> { json: RawValue({"content":{"global":{"content":[{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight"}],"default":true,"enabled":true,"pattern":"bot","rule_id":".m.rules.contains_user_name"}],"override":[{"actions":["dont_notify"],"conditions":[],"default":true,"enabled":false,"rule_id":".m.rule.master"},{"actions":["dont_notify"],"conditions":[{"key":"content.msgtype","kind":"event_match","pattern":"m.notice"}],"default":true,"enabled":true,"rule_id":".m.rule.suppress_notices"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.member"},{"key":"content.membership","kind":"event_match","pattern":"invite"},{"key":"state_key","kind":"event_match","pattern":"@bot:localhost"}],"default":true,"enabled":true,"rule_id":".m.rule.invite_for_me"},{"actions":["dont_notify"],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.member"}],"default":true,"enabled":true,"rule_id":".m.rule.member_event"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight"}],"conditions":[{"kind":"contains_display_name"}],"default":true,"enabled":true,"rule_id":".m.rule.contains_display_name"},{"actions":["notify",{"set_tweak":"highlight"}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.tombstone"},{"key":"state_key","kind":"event_match","pattern":""}],"default":true,"enabled":false,"rule_id":".m.rule.tombstone"},{"actions":["notify",{"set_tweak":"highlight"}],"conditions":[{"key":"content.body","kind":"event_match","pattern":"@room"},{"key":"room","kind":"sender_notification_permission"}],"default":true,"enabled":true,"rule_id":".m.rule.roomnotif"},{"actions":["dont_notify"],"conditions":[{"key":"type","kind":"event_match","pattern":"m.reaction"}],"default":true,"enabled":true,"rule_id":".m.rule.reaction"}],"room":[],"sender":[],"underride":[{"actions":["notify",{"set_tweak":"sound","value":"ring"},{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.call.invite"}],"default":true,"enabled":true,"rule_id":".m.rules.call"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight","value":false}],"conditions":[{"is":"2","kind":"room_member_count"},{"key":"type","kind":"event_match","pattern":"m.room.encrypted"}],"default":true,"enabled":true,"rule_id":".m.rules.encrypted_room_one_to_one"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight","value":false}],"conditions":[{"is":"2","kind":"room_member_count"},{"key":"type","kind":"event_match","pattern":"m.room.message"}],"default":true,"enabled":true,"rule_id":".m.rules.room_one_to_one"},{"actions":["notify",{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.message"}],"default":true,"enabled":true,"rule_id":".m.rules.message"},{"actions":["notify",{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.encrypted"}],"default":true,"enabled":true,"rule_id":".m.rules.encrypted"}]}},"type":"m.push_rules"}) }, _Custom("im.vector.analytics"): Raw::<ruma_common::events::enums::AnyGlobalAccountDataEvent> { json: RawValue({"content":{"pseudonymousAnalyticsOptIn":false},"type":"im.vector.analytics"}) }}, members: {}, profiles: {}, display_names: {}, joined_user_ids: {}, invited_user_ids: {}, room_info: {"!zz4ElRGGgcfhJA7mNy:localhost": RoomInfo { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", room_type: Invited, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: None, create: None, dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: None, max_power_level: 100, name: None, tombstone: None, topic: None } }, "!3dYgSKZlCUlXCU9LW4:localhost": RoomInfo { room_id: "!3dYgSKZlCUlXCU9LW4:localhost", room_type: Left, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: None, create: None, dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: None, max_power_level: 100, name: None, tombstone: None, topic: None } }}, room_state: {}, room_account_data: {}, stripped_room_infos: {"!zz4ElRGGgcfhJA7mNy:localhost": RoomInfo { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", room_type: Invited, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: Some(Original(OriginalMinimalStateEvent { content: RoomCanonicalAliasEventContent { alias: Some("#botadminroom:localhost"), alt_aliases: [] }, event_id: None })), create: Some(Original(OriginalMinimalStateEvent { content: RoomCreateEventContent { creator: "@admin:localhost", federate: true, room_version: V6, predecessor: None, room_type: None }, event_id: None })), dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: Some(Original(OriginalMinimalStateEvent { content: RoomJoinRulesEventContent { join_rule: Invite }, event_id: None })), max_power_level: 100, name: Some(Original(OriginalMinimalStateEvent { content: RoomNameEventContent { name: Some("Bot Admin Room") }, event_id: None })), tombstone: None, topic: None } }}, stripped_room_state: {"!zz4ElRGGgcfhJA7mNy:localhost": {RoomCanonicalAlias: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"alias":"#botadminroom:localhost","alt_aliases":[]},"sender":"@admin:localhost","state_key":"","type":"m.room.canonical_alias"}) }}, RoomCreate: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"creator":"@admin:localhost","room_version":"6"},"sender":"@admin:localhost","state_key":"","type":"m.room.create"}) }}, RoomJoinRules: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"join_rule":"invite"},"sender":"@admin:localhost","state_key":"","type":"m.room.join_rules"}) }}, RoomName: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"name":"Bot Admin Room"},"sender":"@admin:localhost","state_key":"","type":"m.room.name"}) }}}}, stripped_members: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@bot:localhost": StrippedStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("bot ⚡\u{fe0f}"), is_direct: Some(false), membership: Invite, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, sender: "@admin:localhost", state_key: "@bot:localhost" }, "@admin:localhost": StrippedStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("admin ⚡\u{fe0f}"), is_direct: Some(false), membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, sender: "@admin:localhost", state_key: "@admin:localhost" }}}, stripped_joined_user_ids: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@admin:localhost": ()}}, stripped_invited_user_ids: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@bot:localhost": ()}}, presence: {}, room_user_receipts: {}, room_event_receipts: {}, media: Mutex { data: LruCache { len: 0, cap: 100 } }, custom: {} } }, client: Client } })
 2022-06-01T19:50:04.594Z DEBUG matrix_bot::bot             > Event: StrippedStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("bot ⚡\u{fe0f}"), is_direct: Some(false), membership: Invite, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, sender: "@admin:localhost", state_key: "@bot:localhost" }
 2022-06-01T19:50:04.594Z DEBUG matrix_bot::bot             > room: Invited(Invited { inner: Common { inner: Room { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", own_user_id: "@bot:localhost", inner: RwLock { data: RoomInfo { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", room_type: Invited, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: Some(Original(OriginalMinimalStateEvent { content: RoomCanonicalAliasEventContent { alias: Some("#botadminroom:localhost"), alt_aliases: [] }, event_id: None })), create: Some(Original(OriginalMinimalStateEvent { content: RoomCreateEventContent { creator: "@admin:localhost", federate: true, room_version: V6, predecessor: None, room_type: None }, event_id: None })), dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: Some(Original(OriginalMinimalStateEvent { content: RoomJoinRulesEventContent { join_rule: Invite }, event_id: None })), max_power_level: 100, name: Some(Original(OriginalMinimalStateEvent { content: RoomNameEventContent { name: Some("Bot Admin Room") }, event_id: None })), tombstone: None, topic: None } }, poisoned: false, .. }, store: MemoryStore { sync_token: RwLock { data: Some("3483"), poisoned: false, .. }, filters: {}, account_data: {PushRules: Raw::<ruma_common::events::enums::AnyGlobalAccountDataEvent> { json: RawValue({"content":{"global":{"content":[{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight"}],"default":true,"enabled":true,"pattern":"bot","rule_id":".m.rules.contains_user_name"}],"override":[{"actions":["dont_notify"],"conditions":[],"default":true,"enabled":false,"rule_id":".m.rule.master"},{"actions":["dont_notify"],"conditions":[{"key":"content.msgtype","kind":"event_match","pattern":"m.notice"}],"default":true,"enabled":true,"rule_id":".m.rule.suppress_notices"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.member"},{"key":"content.membership","kind":"event_match","pattern":"invite"},{"key":"state_key","kind":"event_match","pattern":"@bot:localhost"}],"default":true,"enabled":true,"rule_id":".m.rule.invite_for_me"},{"actions":["dont_notify"],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.member"}],"default":true,"enabled":true,"rule_id":".m.rule.member_event"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight"}],"conditions":[{"kind":"contains_display_name"}],"default":true,"enabled":true,"rule_id":".m.rule.contains_display_name"},{"actions":["notify",{"set_tweak":"highlight"}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.tombstone"},{"key":"state_key","kind":"event_match","pattern":""}],"default":true,"enabled":false,"rule_id":".m.rule.tombstone"},{"actions":["notify",{"set_tweak":"highlight"}],"conditions":[{"key":"content.body","kind":"event_match","pattern":"@room"},{"key":"room","kind":"sender_notification_permission"}],"default":true,"enabled":true,"rule_id":".m.rule.roomnotif"},{"actions":["dont_notify"],"conditions":[{"key":"type","kind":"event_match","pattern":"m.reaction"}],"default":true,"enabled":true,"rule_id":".m.rule.reaction"}],"room":[],"sender":[],"underride":[{"actions":["notify",{"set_tweak":"sound","value":"ring"},{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.call.invite"}],"default":true,"enabled":true,"rule_id":".m.rules.call"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight","value":false}],"conditions":[{"is":"2","kind":"room_member_count"},{"key":"type","kind":"event_match","pattern":"m.room.encrypted"}],"default":true,"enabled":true,"rule_id":".m.rules.encrypted_room_one_to_one"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight","value":false}],"conditions":[{"is":"2","kind":"room_member_count"},{"key":"type","kind":"event_match","pattern":"m.room.message"}],"default":true,"enabled":true,"rule_id":".m.rules.room_one_to_one"},{"actions":["notify",{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.message"}],"default":true,"enabled":true,"rule_id":".m.rules.message"},{"actions":["notify",{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.encrypted"}],"default":true,"enabled":true,"rule_id":".m.rules.encrypted"}]}},"type":"m.push_rules"}) }, _Custom("im.vector.analytics"): Raw::<ruma_common::events::enums::AnyGlobalAccountDataEvent> { json: RawValue({"content":{"pseudonymousAnalyticsOptIn":false},"type":"im.vector.analytics"}) }}, members: {}, profiles: {}, display_names: {}, joined_user_ids: {}, invited_user_ids: {}, room_info: {"!zz4ElRGGgcfhJA7mNy:localhost": RoomInfo { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", room_type: Invited, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: None, create: None, dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: None, max_power_level: 100, name: None, tombstone: None, topic: None } }, "!3dYgSKZlCUlXCU9LW4:localhost": RoomInfo { room_id: "!3dYgSKZlCUlXCU9LW4:localhost", room_type: Left, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: None, create: None, dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: None, max_power_level: 100, name: None, tombstone: None, topic: None } }}, room_state: {}, room_account_data: {}, stripped_room_infos: {"!zz4ElRGGgcfhJA7mNy:localhost": RoomInfo { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", room_type: Invited, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: Some(Original(OriginalMinimalStateEvent { content: RoomCanonicalAliasEventContent { alias: Some("#botadminroom:localhost"), alt_aliases: [] }, event_id: None })), create: Some(Original(OriginalMinimalStateEvent { content: RoomCreateEventContent { creator: "@admin:localhost", federate: true, room_version: V6, predecessor: None, room_type: None }, event_id: None })), dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: Some(Original(OriginalMinimalStateEvent { content: RoomJoinRulesEventContent { join_rule: Invite }, event_id: None })), max_power_level: 100, name: Some(Original(OriginalMinimalStateEvent { content: RoomNameEventContent { name: Some("Bot Admin Room") }, event_id: None })), tombstone: None, topic: None } }}, stripped_room_state: {"!zz4ElRGGgcfhJA7mNy:localhost": {RoomCanonicalAlias: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"alias":"#botadminroom:localhost","alt_aliases":[]},"sender":"@admin:localhost","state_key":"","type":"m.room.canonical_alias"}) }}, RoomCreate: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"creator":"@admin:localhost","room_version":"6"},"sender":"@admin:localhost","state_key":"","type":"m.room.create"}) }}, RoomJoinRules: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"join_rule":"invite"},"sender":"@admin:localhost","state_key":"","type":"m.room.join_rules"}) }}, RoomName: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"name":"Bot Admin Room"},"sender":"@admin:localhost","state_key":"","type":"m.room.name"}) }}}}, stripped_members: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@bot:localhost": StrippedStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("bot ⚡\u{fe0f}"), is_direct: Some(false), membership: Invite, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, sender: "@admin:localhost", state_key: "@bot:localhost" }, "@admin:localhost": StrippedStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("admin ⚡\u{fe0f}"), is_direct: Some(false), membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, sender: "@admin:localhost", state_key: "@admin:localhost" }}}, stripped_joined_user_ids: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@admin:localhost": ()}}, stripped_invited_user_ids: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@bot:localhost": ()}}, presence: {}, room_user_receipts: {}, room_event_receipts: {}, media: Mutex { data: LruCache { len: 0, cap: 100 } }, custom: {} } }, client: Client } })
 2022-06-01T19:50:04.599Z DEBUG matrix_bot::bot             > This invite is for me, the bot.
 2022-06-01T19:50:04.622Z TRACE want                        > signal: Want
 2022-06-01T19:50:04.622Z TRACE want                        > signal: Want
 2022-06-01T19:50:04.622Z DEBUG reqwest::async_impl::client > response '200 OK' for http://localhost:6167/_matrix/client/r0/rooms/%21zz4ElRGGgcfhJA7mNy%3Alocalhost/join
 2022-06-01T19:50:04.623Z TRACE want                        > signal: Want
 2022-06-01T19:50:05.662Z TRACE want                        > signal: Want
 2022-06-01T19:50:05.662Z TRACE want                        > signal: Want
 2022-06-01T19:50:05.662Z DEBUG reqwest::async_impl::client > response '200 OK' for http://localhost:6167/_matrix/client/r0/sync?since=3483&timeout=30000
 2022-06-01T19:50:12.528Z TRACE want                        > signal: Want
 2022-06-01T19:50:12.528Z TRACE want                        > signal: Want
 2022-06-01T19:50:12.528Z DEBUG reqwest::async_impl::client > response '200 OK' for http://localhost:6167/_matrix/client/r0/sync?since=3491&timeout=30000
 2022-06-01T19:50:12.535Z TRACE want                        > signal: Want
 2022-06-01T19:50:12.535Z TRACE want                        > signal: Want
 2022-06-01T19:50:12.536Z DEBUG reqwest::async_impl::client > response '200 OK' for http://localhost:6167/_matrix/client/r0/sync?since=3491&timeout=30000
 2022-06-01T19:50:12.539Z TRACE want                        > signal: Want
 2022-06-01T19:50:21.085Z TRACE want                        > signal: Want
 2022-06-01T19:50:21.086Z TRACE want                        > signal: Want
 2022-06-01T19:50:21.086Z DEBUG reqwest::async_impl::client > response '200 OK' for http://localhost:6167/_matrix/client/r0/sync?since=3497&timeout=30000
 2022-06-01T19:50:21.100Z TRACE want                        > signal: Want
 2022-06-01T19:50:21.100Z TRACE want                        > signal: Want
 2022-06-01T19:50:21.100Z DEBUG reqwest::async_impl::client > response '200 OK' for http://localhost:6167/_matrix/client/r0/sync?since=3498&timeout=30000
 2022-06-01T19:50:21.103Z DEBUG matrix_bot::bot             > Event: StrippedStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("admin ⚡\u{fe0f}"), is_direct: Some(false), membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, sender: "@admin:localhost", state_key: "@admin:localhost" }
 2022-06-01T19:50:21.103Z DEBUG matrix_bot::bot             > room: Left(Left { inner: Common { inner: Room { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", own_user_id: "@bot:localhost", inner: RwLock { data: RoomInfo { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", room_type: Left, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: Some(Original(OriginalMinimalStateEvent { content: RoomCanonicalAliasEventContent { alias: Some("#botadminroom:localhost"), alt_aliases: [] }, event_id: None })), create: Some(Original(OriginalMinimalStateEvent { content: RoomCreateEventContent { creator: "@admin:localhost", federate: true, room_version: V6, predecessor: None, room_type: None }, event_id: None })), dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: Some(Original(OriginalMinimalStateEvent { content: RoomJoinRulesEventContent { join_rule: Invite }, event_id: None })), max_power_level: 100, name: Some(Original(OriginalMinimalStateEvent { content: RoomNameEventContent { name: Some("Bot Admin Room") }, event_id: None })), tombstone: None, topic: None } }, poisoned: false, .. }, store: MemoryStore { sync_token: RwLock { data: Some("3506"), poisoned: false, .. }, filters: {}, account_data: {PushRules: Raw::<ruma_common::events::enums::AnyGlobalAccountDataEvent> { json: RawValue({"content":{"global":{"content":[{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight"}],"default":true,"enabled":true,"pattern":"bot","rule_id":".m.rules.contains_user_name"}],"override":[{"actions":["dont_notify"],"conditions":[],"default":true,"enabled":false,"rule_id":".m.rule.master"},{"actions":["dont_notify"],"conditions":[{"key":"content.msgtype","kind":"event_match","pattern":"m.notice"}],"default":true,"enabled":true,"rule_id":".m.rule.suppress_notices"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.member"},{"key":"content.membership","kind":"event_match","pattern":"invite"},{"key":"state_key","kind":"event_match","pattern":"@bot:localhost"}],"default":true,"enabled":true,"rule_id":".m.rule.invite_for_me"},{"actions":["dont_notify"],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.member"}],"default":true,"enabled":true,"rule_id":".m.rule.member_event"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight"}],"conditions":[{"kind":"contains_display_name"}],"default":true,"enabled":true,"rule_id":".m.rule.contains_display_name"},{"actions":["notify",{"set_tweak":"highlight"}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.tombstone"},{"key":"state_key","kind":"event_match","pattern":""}],"default":true,"enabled":false,"rule_id":".m.rule.tombstone"},{"actions":["notify",{"set_tweak":"highlight"}],"conditions":[{"key":"content.body","kind":"event_match","pattern":"@room"},{"key":"room","kind":"sender_notification_permission"}],"default":true,"enabled":true,"rule_id":".m.rule.roomnotif"},{"actions":["dont_notify"],"conditions":[{"key":"type","kind":"event_match","pattern":"m.reaction"}],"default":true,"enabled":true,"rule_id":".m.rule.reaction"}],"room":[],"sender":[],"underride":[{"actions":["notify",{"set_tweak":"sound","value":"ring"},{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.call.invite"}],"default":true,"enabled":true,"rule_id":".m.rules.call"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight","value":false}],"conditions":[{"is":"2","kind":"room_member_count"},{"key":"type","kind":"event_match","pattern":"m.room.encrypted"}],"default":true,"enabled":true,"rule_id":".m.rules.encrypted_room_one_to_one"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight","value":false}],"conditions":[{"is":"2","kind":"room_member_count"},{"key":"type","kind":"event_match","pattern":"m.room.message"}],"default":true,"enabled":true,"rule_id":".m.rules.room_one_to_one"},{"actions":["notify",{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.message"}],"default":true,"enabled":true,"rule_id":".m.rules.message"},{"actions":["notify",{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.encrypted"}],"default":true,"enabled":true,"rule_id":".m.rules.encrypted"}]}},"type":"m.push_rules"}) }, _Custom("im.vector.analytics"): Raw::<ruma_common::events::enums::AnyGlobalAccountDataEvent> { json: RawValue({"content":{"pseudonymousAnalyticsOptIn":false},"type":"im.vector.analytics"}) }}, members: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@admin:localhost": Original(OriginalSyncStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("admin ⚡\u{fe0f}"), is_direct: Some(false), membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, event_id: "$YmQkR-snlpZX7DycGEGalgxP4YvCuYydliE7GCxgQeM", sender: "@admin:localhost", origin_server_ts: MilliSecondsSinceUnixEpoch(1647158154823), state_key: "@admin:localhost", unsigned: StateUnsigned { age: None, transaction_id: None, prev_content: None } }), "@bot:localhost": Original(OriginalSyncStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("bot ⚡\u{fe0f}"), is_direct: None, membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, event_id: "$4_ZgdYXqbxzIbVdqXIpjmnNTbbF_guLDTnYmLRPC3WA", sender: "@bot:localhost", origin_server_ts: MilliSecondsSinceUnixEpoch(1654113004607), state_key: "@bot:localhost", unsigned: StateUnsigned { age: None, transaction_id: None, prev_content: Some(RoomMemberEventContent { avatar_url: None, displayname: Some("bot ⚡\u{fe0f}"), is_direct: Some(false), membership: Invite, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }) } })}}, profiles: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@bot:localhost": Original(OriginalMinimalStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("bot ⚡\u{fe0f}"), is_direct: None, membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, event_id: Some("$4_ZgdYXqbxzIbVdqXIpjmnNTbbF_guLDTnYmLRPC3WA") }), "@admin:localhost": Original(OriginalMinimalStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("admin ⚡\u{fe0f}"), is_direct: Some(false), membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, event_id: Some("$YmQkR-snlpZX7DycGEGalgxP4YvCuYydliE7GCxgQeM") })}}, display_names: {}, joined_user_ids: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@bot:localhost": (), "@admin:localhost": ()}}, invited_user_ids: {"!zz4ElRGGgcfhJA7mNy:localhost": {}}, room_info: {"!zz4ElRGGgcfhJA7mNy:localhost": RoomInfo { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", room_type: Invited, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: None, create: None, dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: None, max_power_level: 100, name: None, tombstone: None, topic: None } }, "!3dYgSKZlCUlXCU9LW4:localhost": RoomInfo { room_id: "!3dYgSKZlCUlXCU9LW4:localhost", room_type: Left, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: None, create: None, dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: None, max_power_level: 100, name: None, tombstone: None, topic: None } }}, room_state: {"!zz4ElRGGgcfhJA7mNy:localhost": {RoomHistoryVisibility: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"history_visibility":"shared"},"event_id":"$LJ20rHXiQOxV7g7KU9HJbksp2Pnmtc7a5cYquY9X_jQ","origin_server_ts":1647158154860,"sender":"@admin:localhost","state_key":"","type":"m.room.history_visibility","unsigned":{}}) }}, RoomName: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"name":"Bot Admin Room"},"event_id":"$k1Nub4nG17e6YsO5ccZjT3r7_LeynOXgWQYWRfz00ps","origin_server_ts":1647158154895,"sender":"@admin:localhost","state_key":"","type":"m.room.name","unsigned":{}}) }}, RoomCanonicalAlias: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"alias":"#botadminroom:localhost","alt_aliases":[]},"event_id":"$b2wlZE0PTLX3c3xoLe3aPO0pivXEX5xUNobSmHeTHIw","origin_server_ts":1647158191392,"sender":"@admin:localhost","state_key":"","type":"m.room.canonical_alias","unsigned":{}}) }}, RoomJoinRules: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"join_rule":"invite"},"event_id":"$lvvS54fu3X7dgAbyMhT6rvs52X62ISMQ3MWNRhP3Chg","origin_server_ts":1647158154846,"sender":"@admin:localhost","state_key":"","type":"m.room.join_rules","unsigned":{}}) }}, RoomCreate: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"creator":"@admin:localhost","room_version":"6"},"event_id":"$3E8dsw5kT8JhuwEUiNGxil3d3GibqrIZP9MkBaQR6KY","origin_server_ts":1647158154811,"sender":"@admin:localhost","state_key":"","type":"m.room.create","unsigned":{}}) }}, RoomPowerLevels: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"users":{"@admin:localhost":100}},"event_id":"$YV1d4T-b8Yd-3fK0RpZVJSoJ3lGcoKWGxSoro0etNSo","origin_server_ts":1647158154835,"sender":"@admin:localhost","state_key":"","type":"m.room.power_levels","unsigned":{}}) }}, RoomGuestAccess: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"guest_access":"can_join"},"event_id":"$3K9dQ2_cniZ91SnPsfahwSf2lz8x5VEgFUYcwrNgBAI","origin_server_ts":1647158154883,"sender":"@admin:localhost","state_key":"","type":"m.room.guest_access","unsigned":{"prev_content":{"guest_access":"can_join"},"prev_sender":"@admin:localhost"}}) }}}}, room_account_data: {}, stripped_room_infos: {"!zz4ElRGGgcfhJA7mNy:localhost": RoomInfo { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", room_type: Left, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: Some(Original(OriginalMinimalStateEvent { content: RoomCanonicalAliasEventContent { alias: Some("#botadminroom:localhost"), alt_aliases: [] }, event_id: None })), create: Some(Original(OriginalMinimalStateEvent { content: RoomCreateEventContent { creator: "@admin:localhost", federate: true, room_version: V6, predecessor: None, room_type: None }, event_id: None })), dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: Some(Original(OriginalMinimalStateEvent { content: RoomJoinRulesEventContent { join_rule: Invite }, event_id: None })), max_power_level: 100, name: Some(Original(OriginalMinimalStateEvent { content: RoomNameEventContent { name: Some("Bot Admin Room") }, event_id: None })), tombstone: None, topic: None } }}, stripped_room_state: {"!zz4ElRGGgcfhJA7mNy:localhost": {RoomCanonicalAlias: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"alias":"#botadminroom:localhost","alt_aliases":[]},"sender":"@admin:localhost","state_key":"","type":"m.room.canonical_alias"}) }}, RoomCreate: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"creator":"@admin:localhost","room_version":"6"},"sender":"@admin:localhost","state_key":"","type":"m.room.create"}) }}, RoomJoinRules: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"join_rule":"invite"},"sender":"@admin:localhost","state_key":"","type":"m.room.join_rules"}) }}, RoomName: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"name":"Bot Admin Room"},"sender":"@admin:localhost","state_key":"","type":"m.room.name"}) }}}}, stripped_members: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@bot:localhost": StrippedStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("bot ⚡\u{fe0f}"), is_direct: Some(false), membership: Invite, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, sender: "@admin:localhost", state_key: "@bot:localhost" }, "@admin:localhost": StrippedStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("admin ⚡\u{fe0f}"), is_direct: Some(false), membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, sender: "@admin:localhost", state_key: "@admin:localhost" }}}, stripped_joined_user_ids: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@admin:localhost": ()}}, stripped_invited_user_ids: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@bot:localhost": ()}}, presence: {}, room_user_receipts: {"!zz4ElRGGgcfhJA7mNy:localhost": {"m.read": {"@admin:localhost": ("$4_ZgdYXqbxzIbVdqXIpjmnNTbbF_guLDTnYmLRPC3WA", Receipt { ts: Some(MilliSecondsSinceUnixEpoch(1654113005067)) })}}}, room_event_receipts: {"!zz4ElRGGgcfhJA7mNy:localhost": {"m.read": {"$4_ZgdYXqbxzIbVdqXIpjmnNTbbF_guLDTnYmLRPC3WA": {"@admin:localhost": Receipt { ts: Some(MilliSecondsSinceUnixEpoch(1654113005067)) }}}}}, media: Mutex { data: LruCache { len: 0, cap: 100 } }, custom: {} } }, client: Client } })
 2022-06-01T19:50:21.113Z DEBUG matrix_bot::bot             > Event: StrippedStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("bot ⚡\u{fe0f}"), is_direct: Some(false), membership: Invite, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, sender: "@admin:localhost", state_key: "@bot:localhost" }
 2022-06-01T19:50:21.113Z DEBUG matrix_bot::bot             > room: Left(Left { inner: Common { inner: Room { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", own_user_id: "@bot:localhost", inner: RwLock { data: RoomInfo { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", room_type: Left, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: Some(Original(OriginalMinimalStateEvent { content: RoomCanonicalAliasEventContent { alias: Some("#botadminroom:localhost"), alt_aliases: [] }, event_id: None })), create: Some(Original(OriginalMinimalStateEvent { content: RoomCreateEventContent { creator: "@admin:localhost", federate: true, room_version: V6, predecessor: None, room_type: None }, event_id: None })), dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: Some(Original(OriginalMinimalStateEvent { content: RoomJoinRulesEventContent { join_rule: Invite }, event_id: None })), max_power_level: 100, name: Some(Original(OriginalMinimalStateEvent { content: RoomNameEventContent { name: Some("Bot Admin Room") }, event_id: None })), tombstone: None, topic: None } }, poisoned: false, .. }, store: MemoryStore { sync_token: RwLock { data: Some("3506"), poisoned: false, .. }, filters: {}, account_data: {PushRules: Raw::<ruma_common::events::enums::AnyGlobalAccountDataEvent> { json: RawValue({"content":{"global":{"content":[{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight"}],"default":true,"enabled":true,"pattern":"bot","rule_id":".m.rules.contains_user_name"}],"override":[{"actions":["dont_notify"],"conditions":[],"default":true,"enabled":false,"rule_id":".m.rule.master"},{"actions":["dont_notify"],"conditions":[{"key":"content.msgtype","kind":"event_match","pattern":"m.notice"}],"default":true,"enabled":true,"rule_id":".m.rule.suppress_notices"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.member"},{"key":"content.membership","kind":"event_match","pattern":"invite"},{"key":"state_key","kind":"event_match","pattern":"@bot:localhost"}],"default":true,"enabled":true,"rule_id":".m.rule.invite_for_me"},{"actions":["dont_notify"],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.member"}],"default":true,"enabled":true,"rule_id":".m.rule.member_event"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight"}],"conditions":[{"kind":"contains_display_name"}],"default":true,"enabled":true,"rule_id":".m.rule.contains_display_name"},{"actions":["notify",{"set_tweak":"highlight"}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.tombstone"},{"key":"state_key","kind":"event_match","pattern":""}],"default":true,"enabled":false,"rule_id":".m.rule.tombstone"},{"actions":["notify",{"set_tweak":"highlight"}],"conditions":[{"key":"content.body","kind":"event_match","pattern":"@room"},{"key":"room","kind":"sender_notification_permission"}],"default":true,"enabled":true,"rule_id":".m.rule.roomnotif"},{"actions":["dont_notify"],"conditions":[{"key":"type","kind":"event_match","pattern":"m.reaction"}],"default":true,"enabled":true,"rule_id":".m.rule.reaction"}],"room":[],"sender":[],"underride":[{"actions":["notify",{"set_tweak":"sound","value":"ring"},{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.call.invite"}],"default":true,"enabled":true,"rule_id":".m.rules.call"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight","value":false}],"conditions":[{"is":"2","kind":"room_member_count"},{"key":"type","kind":"event_match","pattern":"m.room.encrypted"}],"default":true,"enabled":true,"rule_id":".m.rules.encrypted_room_one_to_one"},{"actions":["notify",{"set_tweak":"sound","value":"default"},{"set_tweak":"highlight","value":false}],"conditions":[{"is":"2","kind":"room_member_count"},{"key":"type","kind":"event_match","pattern":"m.room.message"}],"default":true,"enabled":true,"rule_id":".m.rules.room_one_to_one"},{"actions":["notify",{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.message"}],"default":true,"enabled":true,"rule_id":".m.rules.message"},{"actions":["notify",{"set_tweak":"highlight","value":false}],"conditions":[{"key":"type","kind":"event_match","pattern":"m.room.encrypted"}],"default":true,"enabled":true,"rule_id":".m.rules.encrypted"}]}},"type":"m.push_rules"}) }, _Custom("im.vector.analytics"): Raw::<ruma_common::events::enums::AnyGlobalAccountDataEvent> { json: RawValue({"content":{"pseudonymousAnalyticsOptIn":false},"type":"im.vector.analytics"}) }}, members: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@admin:localhost": Original(OriginalSyncStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("admin ⚡\u{fe0f}"), is_direct: Some(false), membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, event_id: "$YmQkR-snlpZX7DycGEGalgxP4YvCuYydliE7GCxgQeM", sender: "@admin:localhost", origin_server_ts: MilliSecondsSinceUnixEpoch(1647158154823), state_key: "@admin:localhost", unsigned: StateUnsigned { age: None, transaction_id: None, prev_content: None } }), "@bot:localhost": Original(OriginalSyncStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("bot ⚡\u{fe0f}"), is_direct: None, membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, event_id: "$4_ZgdYXqbxzIbVdqXIpjmnNTbbF_guLDTnYmLRPC3WA", sender: "@bot:localhost", origin_server_ts: MilliSecondsSinceUnixEpoch(1654113004607), state_key: "@bot:localhost", unsigned: StateUnsigned { age: None, transaction_id: None, prev_content: Some(RoomMemberEventContent { avatar_url: None, displayname: Some("bot ⚡\u{fe0f}"), is_direct: Some(false), membership: Invite, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }) } })}}, profiles: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@bot:localhost": Original(OriginalMinimalStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("bot ⚡\u{fe0f}"), is_direct: None, membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, event_id: Some("$4_ZgdYXqbxzIbVdqXIpjmnNTbbF_guLDTnYmLRPC3WA") }), "@admin:localhost": Original(OriginalMinimalStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("admin ⚡\u{fe0f}"), is_direct: Some(false), membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, event_id: Some("$YmQkR-snlpZX7DycGEGalgxP4YvCuYydliE7GCxgQeM") })}}, display_names: {}, joined_user_ids: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@bot:localhost": (), "@admin:localhost": ()}}, invited_user_ids: {"!zz4ElRGGgcfhJA7mNy:localhost": {}}, room_info: {"!zz4ElRGGgcfhJA7mNy:localhost": RoomInfo { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", room_type: Invited, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: None, create: None, dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: None, max_power_level: 100, name: None, tombstone: None, topic: None } }, "!3dYgSKZlCUlXCU9LW4:localhost": RoomInfo { room_id: "!3dYgSKZlCUlXCU9LW4:localhost", room_type: Left, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: None, create: None, dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: None, max_power_level: 100, name: None, tombstone: None, topic: None } }}, room_state: {"!zz4ElRGGgcfhJA7mNy:localhost": {RoomHistoryVisibility: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"history_visibility":"shared"},"event_id":"$LJ20rHXiQOxV7g7KU9HJbksp2Pnmtc7a5cYquY9X_jQ","origin_server_ts":1647158154860,"sender":"@admin:localhost","state_key":"","type":"m.room.history_visibility","unsigned":{}}) }}, RoomName: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"name":"Bot Admin Room"},"event_id":"$k1Nub4nG17e6YsO5ccZjT3r7_LeynOXgWQYWRfz00ps","origin_server_ts":1647158154895,"sender":"@admin:localhost","state_key":"","type":"m.room.name","unsigned":{}}) }}, RoomCanonicalAlias: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"alias":"#botadminroom:localhost","alt_aliases":[]},"event_id":"$b2wlZE0PTLX3c3xoLe3aPO0pivXEX5xUNobSmHeTHIw","origin_server_ts":1647158191392,"sender":"@admin:localhost","state_key":"","type":"m.room.canonical_alias","unsigned":{}}) }}, RoomJoinRules: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"join_rule":"invite"},"event_id":"$lvvS54fu3X7dgAbyMhT6rvs52X62ISMQ3MWNRhP3Chg","origin_server_ts":1647158154846,"sender":"@admin:localhost","state_key":"","type":"m.room.join_rules","unsigned":{}}) }}, RoomCreate: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"creator":"@admin:localhost","room_version":"6"},"event_id":"$3E8dsw5kT8JhuwEUiNGxil3d3GibqrIZP9MkBaQR6KY","origin_server_ts":1647158154811,"sender":"@admin:localhost","state_key":"","type":"m.room.create","unsigned":{}}) }}, RoomPowerLevels: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"users":{"@admin:localhost":100}},"event_id":"$YV1d4T-b8Yd-3fK0RpZVJSoJ3lGcoKWGxSoro0etNSo","origin_server_ts":1647158154835,"sender":"@admin:localhost","state_key":"","type":"m.room.power_levels","unsigned":{}}) }}, RoomGuestAccess: {"": Raw::<ruma_common::events::enums::AnySyncStateEvent> { json: RawValue({"content":{"guest_access":"can_join"},"event_id":"$3K9dQ2_cniZ91SnPsfahwSf2lz8x5VEgFUYcwrNgBAI","origin_server_ts":1647158154883,"sender":"@admin:localhost","state_key":"","type":"m.room.guest_access","unsigned":{"prev_content":{"guest_access":"can_join"},"prev_sender":"@admin:localhost"}}) }}}}, room_account_data: {}, stripped_room_infos: {"!zz4ElRGGgcfhJA7mNy:localhost": RoomInfo { room_id: "!zz4ElRGGgcfhJA7mNy:localhost", room_type: Left, notification_counts: UnreadNotificationsCount { highlight_count: 0, notification_count: 0 }, summary: RoomSummary { heroes: [], joined_member_count: 0, invited_member_count: 0 }, members_synced: false, last_prev_batch: None, base_info: BaseRoomInfo { avatar: None, canonical_alias: Some(Original(OriginalMinimalStateEvent { content: RoomCanonicalAliasEventContent { alias: Some("#botadminroom:localhost"), alt_aliases: [] }, event_id: None })), create: Some(Original(OriginalMinimalStateEvent { content: RoomCreateEventContent { creator: "@admin:localhost", federate: true, room_version: V6, predecessor: None, room_type: None }, event_id: None })), dm_targets: {}, encryption: None, guest_access: None, history_visibility: None, join_rules: Some(Original(OriginalMinimalStateEvent { content: RoomJoinRulesEventContent { join_rule: Invite }, event_id: None })), max_power_level: 100, name: Some(Original(OriginalMinimalStateEvent { content: RoomNameEventContent { name: Some("Bot Admin Room") }, event_id: None })), tombstone: None, topic: None } }}, stripped_room_state: {"!zz4ElRGGgcfhJA7mNy:localhost": {RoomCanonicalAlias: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"alias":"#botadminroom:localhost","alt_aliases":[]},"sender":"@admin:localhost","state_key":"","type":"m.room.canonical_alias"}) }}, RoomCreate: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"creator":"@admin:localhost","room_version":"6"},"sender":"@admin:localhost","state_key":"","type":"m.room.create"}) }}, RoomJoinRules: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"join_rule":"invite"},"sender":"@admin:localhost","state_key":"","type":"m.room.join_rules"}) }}, RoomName: {"": Raw::<ruma_common::events::enums::AnyStrippedStateEvent> { json: RawValue({"content":{"name":"Bot Admin Room"},"sender":"@admin:localhost","state_key":"","type":"m.room.name"}) }}}}, stripped_members: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@bot:localhost": StrippedStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("bot ⚡\u{fe0f}"), is_direct: Some(false), membership: Invite, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, sender: "@admin:localhost", state_key: "@bot:localhost" }, "@admin:localhost": StrippedStateEvent { content: RoomMemberEventContent { avatar_url: None, displayname: Some("admin ⚡\u{fe0f}"), is_direct: Some(false), membership: Join, third_party_invite: None, blurhash: None, reason: None, join_authorized_via_users_server: None }, sender: "@admin:localhost", state_key: "@admin:localhost" }}}, stripped_joined_user_ids: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@admin:localhost": ()}}, stripped_invited_user_ids: {"!zz4ElRGGgcfhJA7mNy:localhost": {"@bot:localhost": ()}}, presence: {}, room_user_receipts: {"!zz4ElRGGgcfhJA7mNy:localhost": {"m.read": {"@admin:localhost": ("$4_ZgdYXqbxzIbVdqXIpjmnNTbbF_guLDTnYmLRPC3WA", Receipt { ts: Some(MilliSecondsSinceUnixEpoch(1654113005067)) })}}}, room_event_receipts: {"!zz4ElRGGgcfhJA7mNy:localhost": {"m.read": {"$4_ZgdYXqbxzIbVdqXIpjmnNTbbF_guLDTnYmLRPC3WA": {"@admin:localhost": Receipt { ts: Some(MilliSecondsSinceUnixEpoch(1654113005067)) }}}}}, media: Mutex { data: LruCache { len: 0, cap: 100 } }, custom: {} } }, client: Client } })
 2022-06-01T19:50:21.116Z DEBUG matrix_bot::bot             > This invite is for me, the bot.
 2022-06-01T19:50:21.116Z WARN  matrix_bot::bot             > Failed to retrive the room in Room::Invited form from the room id: !zz4ElRGGgcfhJA7mNy:localhost.
 2022-06-01T19:50:21.117Z TRACE want                        > signal: Want

To get the debug info of the room & event i uncommented line 190 and 191 in bot.rs and set the env var RUST_LOG to trace.

Extra information: If when you start the bot it is already in the room (joined) the resolution for the membership state seems to happen properly after kick and a new invite the first time. Then on the second attempt at kicking and inviting we are back into the issue.

PS: be tolerant for my code quality/style, it's my first attempt at writing some rust :blush:

luilegeant avatar Jun 01 '22 20:06 luilegeant

I think this is solved by now, isn't it?

FlixCoder avatar Aug 18 '23 13:08 FlixCoder

I believe this issue is fixed. Please re-open if I misclose it :-).

Hywan avatar Sep 18 '23 11:09 Hywan