diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-10-19 19:36:10 +0900 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2017-10-19 19:40:47 +0900 |
commit | 76438ba95d16c7d007fc16ffc194889f937a19f7 (patch) | |
tree | e0c578596254532310b7f0d8f4a37236bfa0670b /connection.h | |
parent | 756e716886036447915a10992189774991f4dd8d (diff) | |
download | libquotient-76438ba95d16c7d007fc16ffc194889f937a19f7.tar.gz libquotient-76438ba95d16c7d007fc16ffc194889f937a19f7.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.h | 29 |
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(); |