aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.h
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-17 17:41:47 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-02-17 17:41:47 +0900
commitac5daf2ed495a932aba23606f5b3d0dca5aaf676 (patch)
tree5aba1f69aa19a269f73579a86d69a32e776d4fa9 /lib/connection.h
parent73e6bd47f4bafa7e65f8d826d8c6527c59aeb865 (diff)
downloadlibquotient-ac5daf2ed495a932aba23606f5b3d0dca5aaf676.tar.gz
libquotient-ac5daf2ed495a932aba23606f5b3d0dca5aaf676.zip
Connection: loadingCapabilities(); sort availableRoomVersions
Diffstat (limited to 'lib/connection.h')
-rw-r--r--lib/connection.h41
1 files changed, 39 insertions, 2 deletions
diff --git a/lib/connection.h b/lib/connection.h
index e5bce52e..1faee255 100644
--- a/lib/connection.h
+++ b/lib/connection.h
@@ -258,9 +258,43 @@ namespace QMatrixClient
Q_INVOKABLE QString token() const;
Q_INVOKABLE void getTurnServers();
+ struct SupportedRoomVersion
+ {
+ QString id;
+ QString status;
+
+ static const QString StableTag; // "stable", as of CS API 0.5
+ bool isStable() const { return status == StableTag; }
+
+ // Pretty-printing
+
+ friend QDebug operator<<(QDebug dbg,
+ const SupportedRoomVersion& v)
+ {
+ QDebugStateSaver _(dbg);
+ return dbg.nospace() << v.id << '/' << v.status;
+ }
+
+ friend QDebug operator<<(QDebug dbg,
+ const QVector<SupportedRoomVersion>& vs)
+ {
+ return QtPrivate::printSequentialContainer(
+ dbg, "", vs);
+ }
+ };
+
+ /// Get the room version recommended by the server
+ /** Only works after server capabilities have been loaded.
+ * \sa loadingCapabilities */
QString defaultRoomVersion() const;
+ /// Get the room version considered stable by the server
+ /** Only works after server capabilities have been loaded.
+ * \sa loadingCapabilities */
QStringList stableRoomVersions() const;
- const QHash<QString, QString>& availableRoomVersions() const;
+ /// Get all room versions supported by the server
+ /** Only works after server capabilities have been loaded.
+ * \sa loadingCapabilities */
+ QVector<SupportedRoomVersion> availableRoomVersions() const;
/**
* Call this before first sync to load from previously saved file.
@@ -370,9 +404,12 @@ namespace QMatrixClient
const QString& deviceId = {});
void connectWithToken(const QString& userId, const QString& accessToken,
const QString& deviceId);
- /** Explicitly request capabilities from the server */
+ /// Explicitly request capabilities from the server
void reloadCapabilities();
+ /// Find out if capabilites are still loading from the server
+ bool loadingCapabilities() const;
+
/** @deprecated Use stopSync() instead */
void disconnectFromServer() { stopSync(); }
void logout();