From dd2f1f29aa42dc2cbc1fa0163acd3a60e4d86f60 Mon Sep 17 00:00:00 2001
From: Kitsune Ral <Kitsune-Ral@users.sf.net>
Date: Mon, 25 Jul 2016 16:30:16 +0900
Subject: Make sync failure handler emit loginError instead of connectionError
 in case of access denial

---
 connection.cpp | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/connection.cpp b/connection.cpp
index 9664521c..38d27a63 100644
--- a/connection.cpp
+++ b/connection.cpp
@@ -117,8 +117,12 @@ SyncJob* Connection::sync(int timeout)
         d->processRooms(syncJob->roomData());
         emit syncDone();
     });
-    connect( syncJob, &SyncJob::failure,
-             [=] () { emit connectionError(syncJob->errorString());});
+    connect( syncJob, &SyncJob::failure, [=] () {
+        if (syncJob->error() == BaseJob::ContentAccessError)
+            emit loginError(syncJob->errorString());
+        else
+            emit connectionError(syncJob->errorString());
+    });
     syncJob->start();
     return syncJob;
 }
-- 
cgit v1.2.3