diff --git a/resources/qml/RoomDirectory.qml b/resources/qml/RoomDirectory.qml index b51c7bbc12845eaadee5edd9e889ed24b9cdc433..54d405ffbaff38300b50c9442d2db36a884245a5 100644 --- a/resources/qml/RoomDirectory.qml +++ b/resources/qml/RoomDirectory.qml @@ -192,6 +192,17 @@ ApplicationWindow { onTextChanged: searchTimer.restart() } + MatrixTextField { + id: chooseServer + Layout.minimumWidth: 0.3 * header.width + Layout.maximumWidth: 0.3 * header.width + + padding: Nheko.paddingMedium + color: Nheko.colors.text + placeholderText: qsTr("Choose custom homeserver") + onTextChanged: publicRooms.setMatrixServer(text) + } + Timer { id: searchTimer diff --git a/src/RoomDirectoryModel.cpp b/src/RoomDirectoryModel.cpp index de5d430af3ff8748ed6822f356acc1cfe3f5f82f..cfa2b623616a0407ac9d652915393f680862075e 100644 --- a/src/RoomDirectoryModel.cpp +++ b/src/RoomDirectoryModel.cpp @@ -98,6 +98,15 @@ RoomDirectoryModel::getViasForRoom(const std::vector<std::string> &aliases) std::back_inserter(vias), [](const auto &alias) { return alias.substr(alias.find(":") + 1); }); + // When joining a room hosted on a homeserver other than the one the + // account has been registered on, the room's server has to be explicitly + // specified in the "server_name=..." URL parameter of the Matrix Join Room + // request. For more details consult the specs: + // https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-join-roomidoralias + if (!server_.empty()) { + vias.push_back(server_); + } + return vias; }