famedly / matrix-dart-sdk

Matrix SDK written in pure Dart.
GNU Affero General Public License v3.0
62 stars 31 forks source link

Howto respond to an DM invite? aka : M_UNKNOWN: Can't join remote room because no servers that are in the room have been provided #1771

Closed nohkumado closed 6 months ago

nohkumado commented 6 months ago

Checklist

In which Project did the bug appear?

Other

If you selected \"Other\" as Project, please enter in which project the bug occurred.

No response

On which platform did the bug appear?

Android

SDK Version

0.22

Describe the problem caused by this bug

i am writing a bridge between a home appliance and a matrix channel, the bot gets invite from a user, and should join the room... But it doesn't and that part crashes with the unknown server message?

BTW didn't know how to post here, there was no cathegory 'dumbuser', i didn't find the 'chat', and my platform (linux) wasn't proposed, so i took Android because that seemed the most similar to linux? if i am wrong here, please point me into the right direction?

Steps To Reproduce

i tried the following code:

 Future<void> processInvite(EventUpdate r_event)
  async {
    if(r_event.type == EventUpdateType.inviteState)
    {
      if(r_event.content["type"] == 'm.room.join_rules')
      {
        if(r_event.content["content"].containsKey('join_rule'))
        {
          if(r_event.content["content"]['join_rule'] == 'invite')
          {
            String invitId = r_event.roomID.trim();
            Room? aRoom = client.getRoomById(invitId);
            if (aRoom != null) {
              await aRoom.join();
              rooms[invitId] = aRoom;
              roomaliases[r_event.content['sender']] = invitId;
            }
            else print("no such room: '${invitId}'");
            post2Room("Ouaf?", roomid: invitId);
          }
        }
      }
    }

i checked, the room key that is retrieved is the valid one, the client connecting is indeed on another server, but this should work?

Screenshots or Logs

No response

Security related

No response

nohkumado commented 6 months ago

started working without interaction....