From 7431b51d2796a93aaebe7b845ee31406a888025b Mon Sep 17 00:00:00 2001
From: Nicolas Werner <nicolas.werner@hotmail.de>
Date: Fri, 30 Apr 2021 14:04:34 +0200
Subject: [PATCH] Update mtxclient to use new login parameters

fixes #558
---
 CMakeLists.txt                   | 2 +-
 io.github.NhekoReborn.Nheko.yaml | 3 +--
 src/LoginPage.cpp                | 7 +++++--
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 70b746026..b9304f01e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -362,7 +362,7 @@ if(USE_BUNDLED_MTXCLIENT)
 	FetchContent_Declare(
 		MatrixClient
 		GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
-		GIT_TAG        v0.5.1
+		GIT_TAG        5d2f055ea9403770039ddf66b1900f890cd5cde7
 		)
 	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 c00385bcf..d8ea05dc8 100644
--- a/io.github.NhekoReborn.Nheko.yaml
+++ b/io.github.NhekoReborn.Nheko.yaml
@@ -148,8 +148,7 @@ modules:
     buildsystem: cmake-ninja
     name: mtxclient
     sources:
-      - commit: b19f1dc7e422f1bb217f02487567fc09e25e7d2b
-        tag: v0.5.1
+      - commit: 5d2f055ea9403770039ddf66b1900f890cd5cde7
         type: git
         url: https://github.com/Nheko-Reborn/mtxclient.git
   - config-opts:
diff --git a/src/LoginPage.cpp b/src/LoginPage.cpp
index 0108a9f46..c914d66fe 100644
--- a/src/LoginPage.cpp
+++ b/src/LoginPage.cpp
@@ -420,8 +420,11 @@ LoginPage::onLoginButtonClicked(LoginMethod loginMethod)
                                                           : deviceName_->text().toStdString(),
                   [this](const mtx::responses::Login &res, mtx::http::RequestErr err) {
                           if (err) {
-                                  showErrorMessage(error_label_,
-                                                   QString::fromStdString(err->matrix_error.error));
+                                  auto error = err->matrix_error.error;
+                                  if (error.empty())
+                                          error = err->parse_error;
+
+                                  showErrorMessage(error_label_, QString::fromStdString(error));
                                   emit errorOccurred();
                                   return;
                           }
-- 
GitLab