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
This commit is contained in:
Joshua Goins
2025-03-05 20:27:05 -05:00
parent 79a3da3358
commit f1253e4ede

View File

@@ -324,7 +324,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,