Commit e02e5a4787

e02e5a478781a704a5cad58aa3a3693f8dd4729a

parent: a304b0834a

Unsigned

Darafei Praliaskouski <me@komzpa.net> · 2026-06-30 15:18 UTC
committer: <strk@kbt.io>

fix: pass alias servers to room joins

Layout: unified · split

src/server.rs +22 −3
@@ -80,8 +80,8 @@ use matrix_sdk::{
8080 SyncStateEvent,
8181 },
8282 DeviceId, DeviceKeyAlgorithm, MilliSecondsSinceUnixEpoch,
83 OwnedDeviceId, OwnedMxcUri, OwnedRoomId, OwnedRoomOrAliasId,
84 OwnedUserId, RoomId, UserId,
83 OwnedDeviceId, OwnedMxcUri, OwnedRoomAliasId, OwnedRoomId,
84 OwnedRoomOrAliasId, OwnedServerName, OwnedUserId, RoomId, UserId,
8585 },
8686 Client, Error,
8787};
@@ -235,8 +235,11 @@ impl MatrixServer {
235235 let target = room_id_or_alias.to_string();
236236 let result = connection
237237 .spawn(async move {
238 let servers =
239 resolve_alias_servers(&client, &room_id_or_alias).await;
240
238241 client
239 .join_room_by_id_or_alias(&room_id_or_alias, &[])
242 .join_room_by_id_or_alias(&room_id_or_alias, &servers)
240243 .await
241244 })
242245 .await;
@@ -479,6 +482,22 @@ fn format_join_error(error: &Error, target: &str) -> String {
479482 }
480483}
481484
485async fn resolve_alias_servers(
486 client: &Client,
487 room_id_or_alias: &OwnedRoomOrAliasId,
488) -> Vec<OwnedServerName> {
489 let Ok(alias) = room_id_or_alias.as_str().parse::<OwnedRoomAliasId>()
490 else {
491 return Vec::new();
492 };
493
494 client
495 .resolve_room_alias(&alias)
496 .await
497 .map(|response| response.servers)
498 .unwrap_or_default()
499}
500
482501impl Drop for MatrixServer {
483502 fn drop(&mut self) {
484503 // TODO close all the server buffers.