@@ -168,28 +168,10 @@ func (mc *MatrixClient) CreateDirectRoom(ctx context.Context, userID id.UserID,
168168func (mc * MatrixClient ) JoinRoom (ctx context.Context , userID id.UserID , roomID id.RoomID ) (* mautrix.RespJoinRoom , error ) {
169169 mc .mu .Lock ()
170170 defer mc .mu .Unlock ()
171-
172171 mc .cli .UserID = userID
173-
174- // Extract homeserver from room ID for federated joins
175- // Room ID format: !opaque:homeserver.name
176- roomIDStr := string (roomID )
177172 req := & mautrix.ReqJoinRoom {}
178-
179- if idx := strings .Index (roomIDStr , ":" ); idx > 0 && idx < len (roomIDStr )- 1 {
180- roomServerName := roomIDStr [idx + 1 :]
181-
182- // Only add Via if the room is on a different homeserver (federated)
183- if roomServerName != "" && roomServerName != mc .homeserverName {
184- req .Via = []string {roomServerName }
185- logger .Debug ().Str ("user_id" , string (userID )).Str ("room_id" , roomIDStr ).Str ("room_server" , roomServerName ).Str ("local_server" , mc .homeserverName ).Msg ("matrix: joining federated room with homeserver hint" )
186- } else {
187- logger .Debug ().Str ("user_id" , string (userID )).Str ("room_id" , roomIDStr ).Msg ("matrix: joining local room without via" )
188- }
189- }
190-
191- logger .Debug ().Str ("user_id" , string (userID )).Str ("room_id" , roomIDStr ).Bool ("has_via" , len (req .Via ) > 0 ).Msg ("matrix: calling JoinRoom" )
192- return mc .cli .JoinRoom (ctx , roomIDStr , req )
173+ logger .Debug ().Str ("user_id" , string (userID )).Str ("room_id" , string (roomID )).Msg ("matrix: joining local room" )
174+ return mc .cli .JoinRoom (ctx , string (roomID ), req )
193175}
194176
195177// ResolveRoomAlias resolves a room alias to a room ID.
0 commit comments