aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2020-12-27 18:33:51 +0100
committerKitsune Ral <Kitsune-Ral@users.sf.net>2020-12-28 11:19:57 +0100
commit7c29f33121f58a52f43fa83183eaca47fa374980 (patch)
treeafbc0a2dfd16e94b52266a37e798e7554ebe2aa5 /lib/connection.h
parent639f1d482633a7adb72164c56e3b5ea429db96a5 (diff)
downloadlibquotient-7c29f33121f58a52f43fa83183eaca47fa374980.tar.gz
libquotient-7c29f33121f58a52f43fa83183eaca47fa374980.zip
More comments/documentation
Notably, recommend using loginFlowsChanged() rather than homeserverChanged() to detect when a Connection object is ready for a login sequence. Related: #427.
Diffstat (limited to 'lib/connection.h')
-rw-r--r--lib/connection.h30
1 files changed, 26 insertions, 4 deletions
diff --git a/lib/connection.h b/lib/connection.h
index 07ae9f29..2f638448 100644
--- a/lib/connection.h
+++ b/lib/connection.h
@@ -504,13 +504,35 @@ public Q_SLOTS:
/** Determine and set the homeserver from MXID */
void resolveServer(const QString& mxid);
+ /** \brief Log in using a username and password pair
+ *
+ * Before logging in, this method checks if the homeserver is valid and
+ * supports the password login flow. If the homeserver is invalid but
+ * a full user MXID is provided, this method calls resolveServer() using
+ * this MXID.
+ *
+ * \sa resolveServer, resolveError, loginError
+ */
void loginWithPassword(const QString& userId, const QString& password,
const QString& initialDeviceName,
const QString& deviceId = {});
+ /** \brief Log in using a login token
+ *
+ * One usual case for this method is the final stage of logging in via SSO.
+ * Unlike loginWithPassword() and assumeIdentity(), this method cannot
+ * resolve the server from the user name because the full user MXID is
+ * encoded in the login token. Callers should ensure the homeserver
+ * sanity in advance.
+ */
void loginWithToken(const QByteArray& loginToken,
const QString& initialDeviceName,
const QString& deviceId = {});
- void assumeIdentity(const QString& userId, const QString& accessToken,
+ /** \brief Use an existing access token to connect to the homeserver
+ *
+ * Similar to loginWithPassword(), this method checks that the homeserver
+ * URL is valid and tries to resolve it from the MXID in case it is not.
+ */
+ void assumeIdentity(const QString& mxId, const QString& accessToken,
const QString& deviceId);
/*! \deprecated Use loginWithPassword instead */
void connectToServer(const QString& userId, const QString& password,
@@ -662,9 +684,9 @@ Q_SIGNALS:
* This was a signal resulting from a successful resolveServer().
* Since Connection now provides setHomeserver(), the HS URL
* may change even without resolveServer() invocation. Use
- * homeserverChanged() instead of resolved(). You can also use
- * connectToServer and connectWithToken without the HS URL set in
- * advance (i.e. without calling resolveServer), as they now trigger
+ * loginFLowsChanged() instead of resolved(). You can also use
+ * loginWith*() and assumeIdentity() without the HS URL set in
+ * advance (i.e. without calling resolveServer), as they trigger
* server name resolution from MXID if the server URL is not valid.
*/
void resolved();