aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-06-12 20:36:29 +0200
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-06-12 20:36:29 +0200
commitd257f0b6155d6d1450cf0c82d1538e553380c44e (patch)
tree6b28b3c9b9eeb3ca2830eed143b3d659b7f4b153 /lib
parentb1071cf34b86685c3cdb5004d6112881966a7ce6 (diff)
downloadlibquotient-d257f0b6155d6d1450cf0c82d1538e553380c44e.tar.gz
libquotient-d257f0b6155d6d1450cf0c82d1538e553380c44e.zip
Connection::isLoggedIn() and more robust logout()
isLoggedIn() is just a wrapper around Connection::accessToken() that returns whether it's not empty. Now, Connection::accessToken() and Connection::logout() are changed in such a way that if there's a logout job ongoing Connection::accessToken() will return an empty value even though the access token is still stored in ConnectionData. This gives a hint to the rest of Connection and to the client code that the user is not quite authenticated anymore. Finally, syncLoop() and sync() have been altered to check isLoggedIn() before proceeding with their network request.
Diffstat (limited to 'lib')
-rw-r--r--lib/connection.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/connection.h b/lib/connection.h
index fb76cf3d..e8373a10 100644
--- a/lib/connection.h
+++ b/lib/connection.h
@@ -139,6 +139,7 @@ class Connection : public QObject {
Q_PROPERTY(QString domain READ domain NOTIFY stateChanged STORED false)
Q_PROPERTY(QString deviceId READ deviceId NOTIFY stateChanged)
Q_PROPERTY(QByteArray accessToken READ accessToken NOTIFY stateChanged)
+ Q_PROPERTY(bool isLoggedIn READ isLoggedIn NOTIFY stateChanged STORED false)
Q_PROPERTY(QString defaultRoomVersion READ defaultRoomVersion NOTIFY capabilitiesLoaded)
Q_PROPERTY(QUrl homeserver READ homeserver WRITE setHomeserver NOTIFY homeserverChanged)
Q_PROPERTY(QVector<GetLoginFlowsJob::LoginFlow> loginFlows READ loginFlows NOTIFY loginFlowsChanged)
@@ -338,6 +339,7 @@ public:
QString userId() const;
QString deviceId() const;
QByteArray accessToken() const;
+ bool isLoggedIn() const;
#ifdef Quotient_E2EE_ENABLED
QtOlm::Account* olmAccount() const;
#endif // Quotient_E2EE_ENABLED