diff options
author | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-12-27 21:13:13 +0100 |
---|---|---|
committer | Kitsune Ral <Kitsune-Ral@users.sf.net> | 2020-12-28 11:19:57 +0100 |
commit | 6c9ff40dbd91cc4966f0ecf9ed817efc2495a2fb (patch) | |
tree | 6f50817b8f27a2bdc9681656a46fc31d1c96d9c8 /lib/connection.h | |
parent | 7c29f33121f58a52f43fa83183eaca47fa374980 (diff) | |
download | libquotient-6c9ff40dbd91cc4966f0ecf9ed817efc2495a2fb.tar.gz libquotient-6c9ff40dbd91cc4966f0ecf9ed817efc2495a2fb.zip |
Connection: refactor the resolve/login code
1. resolveServer() now emits homeserverChanged() even when there's no
.well-known file found.
2. checkAndConnect() entirely removed from the header file.
3. Sunny-day scenario for assumeIdentity() is now asynchronous,
triggering a call to /whoami to double-check the user.
4. LoginFlow aliases is moved out from LoginFlows to Quotient namespace.
Diffstat (limited to 'lib/connection.h')
-rw-r--r-- | lib/connection.h | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/lib/connection.h b/lib/connection.h index 2f638448..dbe179e8 100644 --- a/lib/connection.h +++ b/lib/connection.h @@ -62,28 +62,27 @@ class SendToDeviceJob; class SendMessageJob; class LeaveRoomJob; +using LoginFlow = GetLoginFlowsJob::LoginFlow; + +/// Predefined login flows +struct LoginFlows { + static inline const LoginFlow Password { "m.login.password" }; + static inline const LoginFlow SSO { "m.login.sso" }; + static inline const LoginFlow Token { "m.login.token" }; +}; + // To simplify comparisons of LoginFlows -inline bool operator==(const GetLoginFlowsJob::LoginFlow& lhs, - const GetLoginFlowsJob::LoginFlow& rhs) +inline bool operator==(const LoginFlow& lhs, const LoginFlow& rhs) { return lhs.type == rhs.type; } -inline bool operator!=(const GetLoginFlowsJob::LoginFlow& lhs, - const GetLoginFlowsJob::LoginFlow& rhs) +inline bool operator!=(const LoginFlow& lhs, const LoginFlow& rhs) { return !(lhs == rhs); } -/// Predefined login flows -struct LoginFlows { - using LoginFlow = GetLoginFlowsJob::LoginFlow; - static inline const LoginFlow Password { "m.login.password" }; - static inline const LoginFlow SSO { "m.login.sso" }; - static inline const LoginFlow Token { "m.login.token" }; -}; - class Connection; using room_factory_t = @@ -882,19 +881,6 @@ private: class Private; QScopedPointer<Private> d; - /** - * A single entry for functions that need to check whether the - * homeserver is valid before running. May either execute connectFn - * synchronously or asynchronously (if tryResolve is true and - * a DNS lookup is initiated); in case of errors, emits resolveError - * if the homeserver URL is not valid and cannot be resolved from - * userId. - * - * @param userId - fully-qualified MXID to resolve HS from - * @param connectFn - a function to execute once the HS URL is good - */ - void checkAndConnect(const QString& userId, std::function<void()> connectFn); - static room_factory_t _roomFactory; static user_factory_t _userFactory; }; |