diff options
author | Patryk Cisek <patryk@prezu.one.pl> | 2021-09-17 03:12:56 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-17 10:12:56 +0000 |
commit | d499fffb7ee89d3a6290803be00ec9d664a75261 (patch) | |
tree | 8f72b9e765fdc89857650a240b121ee0ec4458ab | |
parent | Disable reuseItems again D: (diff) | |
download | nheko-d499fffb7ee89d3a6290803be00ec9d664a75261.tar.xz |
Added a text field that allows choosing custom homeserver in "Room directory" dialog. (#727)
* Added a text field that allows choosing custom homeserver in "Room directory" dialog. * Moved "Choose custom homeserver" text field to the right and shrinked it to 30% of "Room directory" dialog's width. * Adding "server_name=" when needed when joining room. When joining room that is hosted on a different homeserver than the account is registered on, the request fails. In such scenario the server has to be explicitly mentioned in a server_name URL parameter. More info here: https://matrix.org/docs/spec/client_server/r0.6.1#post-matrix-client-r0-join-roomidoralias * Minor fix: intentation (4 spaces -> 8 spaces) Co-authored-by: Patryk Cisek <patryk@cisek.email>
-rw-r--r-- | resources/qml/RoomDirectory.qml | 11 | ||||
-rw-r--r-- | src/RoomDirectoryModel.cpp | 9 |
2 files changed, 20 insertions, 0 deletions
diff --git a/resources/qml/RoomDirectory.qml b/resources/qml/RoomDirectory.qml index b51c7bbc..54d405ff 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 de5d430a..cfa2b623 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; } |