Make joining remote rooms more reliable

When joining remote rooms we have to specify another homeserver (that is in the
room) to help us join. The matrix documentation is a little unclear what to do
in this scenario, so instead of giving up let's at least brute force it with the
server in the alias or room id.

This *does* work and allows my server to join rooms in NeoChat I otherwise
couldn't.

BUG: 487253
CCBUG: 491359
FIXED-IN: 24.12.3


(cherry picked from commit f1253e4ede)

Co-authored-by: Joshua Goins <josh@redstrate.com>
This commit is contained in:
Joshua Goins
2025-03-06 15:54:35 +00:00
parent 6450f0dbe8
commit 2f6d7308c5

View File

@@ -323,7 +323,15 @@ void RoomManager::visitRoom(Room *r, const QString &eventId)
void RoomManager::joinRoom(Quotient::Connection *account, const QString &roomAliasOrId, const QStringList &viaServers)
{
auto job = account->joinRoom(roomAliasOrId, viaServers);
QStringList vias = viaServers;
// If no one gives us a homeserver suggestion, try the server specified in the alias/id.
// Otherwise joining a remote room not on our homeserver will fail.
if (vias.empty()) {
vias.append(roomAliasOrId.mid(roomAliasOrId.lastIndexOf(':'_L1) + 1));
}
auto job = account->joinRoom(roomAliasOrId, vias);
connect(
job.get(),
&Quotient::BaseJob::finished,