Closed babolivier closed 5 years ago
Another approach to this is simply to not have the bot join rooms. I'm testing such an approach here - https://github.com/matrix-hacks/matrix-puppet-bridge/commits/no_join_bot_testing
Any update on whether the proposed solution is suitable?
@anoadragon453 I pushed my no_join_bot_testing branch to master, so folks can give that a shot by updating to the latest matrix-puppet-bridge. Matrix should hopefully see them as 1:1 chats now, since there are only two people in the rooms.
Ah, I just discovered that simply avoiding joining a bot won't be a good solution, because even for 1:1 rooms, if a room alias is defined, the default name for the room will be the alias. Puppet bridge rooms will all have aliases, since that's how we look them up.
I'm all out of free time currently, but I'm happy to consider any PRs for a better solution this problem.
So I had a go with this just now, and noticed that the bot still joins the room, but then (almost) immediately leaves the room. This results in still not marking the room as a direct chat because it wasn't one when the room started.
Looks to me like there's going to need to be a bit more of a change to matrix-puppet-bridge library and most things that use it such that the getOrCreateMatrixRoomFromThirdPartyRoomId function takes extra argument(s) for whether it's expected to be a direct chat and the 3rd party's room name so that if a Matrix room is being created then it can use those values for is_direct and the room name.
I don't particularly like that solution as it seems to be passing unnecessary information around every single time a message is sent/received regardless of whether it's actually needed, but I don't see any other option with how the API between matrix-puppet-bridge and matrix-puppet-facebook currently works. Does anyone else see any alternatives?
Using the no_join_bot_testing branch resulted in me getting chat rooms that were not marked as direct, did not get the correct room name, and did not actually receive messages from 3rd party users. I was however able to send messages in that room, and receive them from myself on the 3rd party service, so I think the issue was something along the lines of the bot not being able to actually put messages from other users into the room if the bot itself wasn't in the room, I didn't really spend too long looking into that because it didn't solve any of the other problems anyway.
Note that #51 doesn't set the room avatar, only the name and marks them as 1:1 chats. I had hoped Riot/etc would be smart enough to grab the member's avatarwhen the room is marked as a direct chat, but apparently that's not the case.
Even if Riot did, I'm not sure we should put the responsibility on clients, as much more other than Riot become popular.
Since, on the Matrix side, a 1:1 Facebook chat doesn't result in a 1:1 Matrix room (because it includes the Matrix user, the Facebook contact and the bridge bot), Riot doesn't see the room as a 1:1 chat, and also doesn't display the contact's name and avatar as the room's, meaning that the conversation appears as a room with no image named with its alias (
#facebook_[contact's Facebook ID]:[homeserver]
), which makes it impossible to spot who's the contact without having to display the room.I made a hacky fixer as a temporary solution, which identifies the contact, store their name and profile picture's mxc URL, and set them as the room's name and room's avatar, although that's be great if the bridge could handle that by itself.