summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-01-12 02:59:16 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2023-01-12 03:03:55 +0100
commit8a619d2feab56ee8fd8d3bd4ff3a7948e82cc6b8 (patch)
tree4de91217d39333b0c7cef5a1b988186e6d116995
parent0833b3978142bc791a5a99ff291cda9024b5d6de (diff)
Bump mtxclient version
-rw-r--r--CMakeLists.txt2
-rw-r--r--io.github.NhekoReborn.Nheko.yaml2
-rw-r--r--src/MatrixClient.h1
-rw-r--r--src/RegisterPage.cpp127
4 files changed, 65 insertions, 67 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 52fe8c9f..3a359dbc 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -595,7 +595,7 @@ if(USE_BUNDLED_MTXCLIENT)
FetchContent_Declare(
MatrixClient
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
- GIT_TAG b8f0e821066946fd567ea6a11933ebce69d72b6f
+ GIT_TAG 79dcdbb8daad2efb06147e136702a12cd8877aba
)
set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")
diff --git a/io.github.NhekoReborn.Nheko.yaml b/io.github.NhekoReborn.Nheko.yaml
index d382e5d4..9788055d 100644
--- a/io.github.NhekoReborn.Nheko.yaml
+++ b/io.github.NhekoReborn.Nheko.yaml
@@ -182,7 +182,7 @@ modules:
buildsystem: cmake-ninja
name: mtxclient
sources:
- - commit: b8f0e821066946fd567ea6a11933ebce69d72b6f
+ - commit: 79dcdbb8daad2efb06147e136702a12cd8877aba
#tag: v0.8.2
type: git
url: https://github.com/Nheko-Reborn/mtxclient.git
diff --git a/src/MatrixClient.h b/src/MatrixClient.h
index e47812d3..501fa6fa 100644
--- a/src/MatrixClient.h
+++ b/src/MatrixClient.h
@@ -21,4 +21,3 @@ is_logged_in();
void
init();
}
-
diff --git a/src/RegisterPage.cpp b/src/RegisterPage.cpp
index d1b8f265..a5af6bda 100644
--- a/src/RegisterPage.cpp
+++ b/src/RegisterPage.cpp
@@ -109,70 +109,69 @@ RegisterPage::versionsCheck()
{
// Make a request to /_matrix/client/versions to check the address
// given is a Matrix homeserver.
- http::client()->versions(
- [this](const mtx::responses::Versions &versions, mtx::http::RequestErr err) {
- if (err) {
- if (err->status_code == 404) {
- setHsError(
- tr("The required endpoints were not found. Possibly not a Matrix server."));
- emit hsErrorChanged();
- return;
- }
-
- if (!err->parse_error.empty()) {
- setHsError(
- tr("Received malformed response. Make sure the homeserver domain is valid."));
- emit hsErrorChanged();
- return;
- }
-
- setHsError(tr("An unknown error occured. Make sure the homeserver domain is valid."));
- emit hsErrorChanged();
- return;
- }
-
- if (std::find_if(
- versions.versions.cbegin(), versions.versions.cend(), [](const std::string &v) {
- static const std::set<std::string_view, std::less<>> supported{
- "v1.1",
- "v1.2",
- "v1.3",
- "v1.4",
- "v1.5",
- };
- return supported.count(v) != 0;
- }) == versions.versions.cend()) {
- emit setHsError(
- tr("The selected server does not support a version of the Matrix protocol that "
- "this client understands (v1.1 to v1.5). You can't register."));
- emit hsErrorChanged();
- return;
- }
-
- http::client()->registration(
- [this](const mtx::responses::Register &, mtx::http::RequestErr e) {
- nhlog::net()->debug("Registration check: {}", e);
-
- if (!e) {
- setHsError(tr("Server does not support querying registration flows!"));
- emit hsErrorChanged();
- return;
- }
- if (e->status_code != 401) {
- setHsError(tr("Server does not support registration."));
- emit hsErrorChanged();
- return;
- }
-
- for (const auto &f : e->matrix_error.unauthorized.flows)
- nhlog::ui()->debug("Registration flows for server: {}",
- fmt::join(f.stages, ", "));
-
- supported_ = true;
- lookingUpHs_ = false;
- emit lookingUpHsChanged();
- });
- });
+ http::client()->versions([this](const mtx::responses::Versions &versions,
+ mtx::http::RequestErr err) {
+ if (err) {
+ if (err->status_code == 404) {
+ setHsError(
+ tr("The required endpoints were not found. Possibly not a Matrix server."));
+ emit hsErrorChanged();
+ return;
+ }
+
+ if (!err->parse_error.empty()) {
+ setHsError(
+ tr("Received malformed response. Make sure the homeserver domain is valid."));
+ emit hsErrorChanged();
+ return;
+ }
+
+ setHsError(tr("An unknown error occured. Make sure the homeserver domain is valid."));
+ emit hsErrorChanged();
+ return;
+ }
+
+ if (std::find_if(
+ versions.versions.cbegin(), versions.versions.cend(), [](const std::string &v) {
+ static const std::set<std::string_view, std::less<>> supported{
+ "v1.1",
+ "v1.2",
+ "v1.3",
+ "v1.4",
+ "v1.5",
+ };
+ return supported.count(v) != 0;
+ }) == versions.versions.cend()) {
+ emit setHsError(
+ tr("The selected server does not support a version of the Matrix protocol that "
+ "this client understands (v1.1 to v1.5). You can't register."));
+ emit hsErrorChanged();
+ return;
+ }
+
+ http::client()->registration([this](const mtx::responses::Register &,
+ mtx::http::RequestErr e) {
+ nhlog::net()->debug("Registration check: {}", e);
+
+ if (!e) {
+ setHsError(tr("Server does not support querying registration flows!"));
+ emit hsErrorChanged();
+ return;
+ }
+ if (e->status_code != 401) {
+ setHsError(tr("Server does not support registration."));
+ emit hsErrorChanged();
+ return;
+ }
+
+ for (const auto &f : e->matrix_error.unauthorized.flows)
+ nhlog::ui()->debug("Registration flows for server: {}", fmt::join(f.stages, ", "));
+
+ supported_ = true;
+ lookingUpHs_ = false;
+ emit lookingUpHsChanged();
+ });
+ });
}
void