From ba620ee07989aff134fec6b5d6f058cab3377ecc Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Thu, 19 Oct 2017 19:36:10 +0900 Subject: 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. --- connection.h | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'connection.h') 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, 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() 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(); -- cgit v1.2.3