diff options
Diffstat (limited to 'connection.cpp')
-rw-r--r-- | connection.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/connection.cpp b/connection.cpp index 8d916280..d6338191 100644 --- a/connection.cpp +++ b/connection.cpp @@ -23,7 +23,7 @@ #include "events/event.h" #include "room.h" #include "jobs/passwordlogin.h" -#include "jobs/geteventsjob.h" +#include "jobs/logoutjob.h" #include "jobs/postmessagejob.h" #include "jobs/postreceiptjob.h" #include "jobs/joinroomjob.h" @@ -98,6 +98,13 @@ void Connection::reconnect() loginJob->start(); } +void Connection::logout() +{ + auto job = new LogoutJob(d->data); + connect( job, &LogoutJob::success, this, &Connection::loggedOut); + job->start(); +} + SyncJob* Connection::sync(int timeout) { QString filter = "{\"room\": { \"timeline\": { \"limit\": 100 } } }"; @@ -109,8 +116,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; } |