aboutsummaryrefslogtreecommitdiff
path: root/connection.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-19 19:36:10 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2017-10-19 19:36:10 +0900
commitba620ee07989aff134fec6b5d6f058cab3377ecc (patch)
treec9e6f0e434acf36efb61d5a28824f583f2c048e2 /connection.h
parente4fabf6e618b5045efec2629cb5d7b5bf73677e8 (diff)
downloadlibquotient-ba620ee07989aff134fec6b5d6f058cab3377ecc.tar.gz
libquotient-ba620ee07989aff134fec6b5d6f058cab3377ecc.zip
Introduce device_id and initial_device_name support; switch to generated LoginJob
This is _almost_ a backwards-compatible change, except that connect*() and other relevant methods in Connection are no more virtual (that wasn't much useful anyway). Otherwise it's a matter of passing initial_device_name to connectToServer(), saving device_id (along with access_token) from the result of LoginJob and then passing device_id (along with access_token, again) to connectWithToken() upon the next run.
Diffstat (limited to 'connection.h')
-rw-r--r--connection.h29
1 files changed, 16 insertions, 13 deletions
diff --git a/connection.h b/connection.h
index b7d049f1..2a107b43 100644
--- a/connection.h
+++ b/connection.h
@@ -61,19 +61,6 @@ namespace QMatrixClient
QHash<QPair<QString, bool>, Room*> roomMap() const;
- Q_INVOKABLE virtual void resolveServer(const QString& domain);
- Q_INVOKABLE virtual void connectToServer(const QString& user,
- const QString& password);
- Q_INVOKABLE virtual void connectWithToken(const QString& userId,
- const QString& token);
- Q_INVOKABLE virtual void reconnect();
- /** @deprecated Use stopSync() instead */
- Q_INVOKABLE virtual void disconnectFromServer() { stopSync(); }
- Q_INVOKABLE virtual void logout();
-
- Q_INVOKABLE void sync(int timeout = -1);
- Q_INVOKABLE void stopSync();
-
// Old API that will be abolished any time soon. DO NOT USE.
/** @deprecated Use callApi<PostMessageJob>() or Room::postMessage() instead */
@@ -113,6 +100,7 @@ namespace QMatrixClient
Q_INVOKABLE User* user(const QString& userId);
Q_INVOKABLE User* user();
Q_INVOKABLE QString userId() const;
+ Q_INVOKABLE const QString& deviceId() const;
/** @deprecated Use accessToken() instead. */
Q_INVOKABLE QString token() const;
Q_INVOKABLE QString accessToken() const;
@@ -185,6 +173,21 @@ namespace QMatrixClient
[](Connection* c, const QString& id) { return new T(id, c); };
}
+ public slots:
+ void resolveServer(const QString& domain);
+ void connectToServer(const QString& user, const QString& password,
+ const QString& initialDeviceName,
+ const QString& deviceId = {});
+ void connectWithToken(const QString& userId, const QString& accessToken,
+ const QString& deviceId);
+
+ /** @deprecated Use stopSync() instead */
+ void disconnectFromServer() { stopSync(); }
+ void logout();
+
+ void sync(int timeout = -1);
+ void stopSync();
+
signals:
void resolved();
void connected();