diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-03-25 22:24:04 +0100 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-03-26 22:52:01 +0100 |
commit | 1b5d6216beddd17c820240dd4bdeaf9c47624cf6 (patch) | |
tree | 7372e314d6ebae4bbed7e687ac7de1c0a552561a /lib/connection.h | |
parent | 7033aa5ad8152f77164a4c644837d1fe44aa0430 (diff) | |
download | libquotient-1b5d6216beddd17c820240dd4bdeaf9c47624cf6.tar.gz libquotient-1b5d6216beddd17c820240dd4bdeaf9c47624cf6.zip |
Connection: loginWithToken(); connectWithToken() -> assumeIdentity()
Part of #388 backport.
Diffstat (limited to 'lib/connection.h')
-rw-r--r-- | lib/connection.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/connection.h b/lib/connection.h index ad228bf0..782ffd2c 100644 --- a/lib/connection.h +++ b/lib/connection.h @@ -403,6 +403,18 @@ namespace QMatrixClient std::forward<JobArgTs>(jobArgs)...); } + /** Get a request URL for a job with specified type and arguments + * + * This calls JobT::makeRequestUrl() prepending the connection's + * homeserver to the list of arguments. + */ + template <typename JobT, typename... JobArgTs> + QUrl getUrlForApi(JobArgTs&&... jobArgs) const + { + return JobT::makeRequestUrl(homeserver(), + std::forward<JobArgTs>(jobArgs)...); + } + /** Generate a new transaction id. Transaction id's are unique within * a single Connection object */ @@ -438,7 +450,16 @@ namespace QMatrixClient void connectToServer(const QString& user, const QString& password, const QString& initialDeviceName, const QString& deviceId = {}); - void connectWithToken(const QString& userId, const QString& accessToken, + void loginWithToken(const QByteArray& loginToken, + const QString& initialDeviceName, + const QString& deviceId = {}); + void assumeIdentity(const QString& userId, const QString& accessToken, + const QString& deviceId); + /*! @deprecated + * Use assumeIdentity() if you have an access token or + * loginWithToken() if you have a login token. + */ + void connectWithToken(const QString& userId, const QString& accessToken, const QString& deviceId); /// Explicitly request capabilities from the server void reloadCapabilities(); |