aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2019-03-27 19:06:34 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2019-03-27 19:09:54 +0900
commitfe3141f7bc3d2c92dcfe8ee5b3eb8d3ca6f0ab17 (patch)
tree2be6a412f3af53e57b25b295d7ad524cc0210a29
parentd1efa846ee2e454b56dc77db403e40f1d9dfc7cd (diff)
downloadlibquotient-fe3141f7bc3d2c92dcfe8ee5b3eb8d3ca6f0ab17.tar.gz
libquotient-fe3141f7bc3d2c92dcfe8ee5b3eb8d3ca6f0ab17.zip
Connection::domain()
-rw-r--r--lib/connection.cpp5
-rw-r--r--lib/connection.h4
2 files changed, 9 insertions, 0 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index 59aca025..07c24c92 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -788,6 +788,11 @@ QUrl Connection::homeserver() const
return d->data->baseUrl();
}
+QString Connection::domain() const
+{
+ return d->userId.section(':', 1);
+}
+
Room* Connection::room(const QString& roomId, JoinStates states) const
{
Room* room = d->roomMap.value({roomId, false}, nullptr);
diff --git a/lib/connection.h b/lib/connection.h
index b22d63da..ea5be51a 100644
--- a/lib/connection.h
+++ b/lib/connection.h
@@ -104,6 +104,7 @@ namespace QMatrixClient
Q_PROPERTY(QByteArray accessToken READ accessToken NOTIFY stateChanged)
Q_PROPERTY(QString defaultRoomVersion READ defaultRoomVersion NOTIFY capabilitiesLoaded)
Q_PROPERTY(QUrl homeserver READ homeserver WRITE setHomeserver NOTIFY homeserverChanged)
+ Q_PROPERTY(QString domain READ domain NOTIFY homeserverChanged)
Q_PROPERTY(bool cacheState READ cacheState WRITE setCacheState NOTIFY cacheStateChanged)
Q_PROPERTY(bool lazyLoading READ lazyLoading WRITE setLazyLoading NOTIFY lazyLoadingChanged)
@@ -241,7 +242,10 @@ namespace QMatrixClient
/** Get the full list of users known to this account */
QMap<QString, User*> users() const;
+ /** Get the base URL of the homeserver to connect to */
QUrl homeserver() const;
+ /** Get the domain name used for ids/aliases on the server */
+ QString domain() const;
/** Find a room by its id and a mask of applicable states */
Q_INVOKABLE Room* room(const QString& roomId,
JoinStates states = JoinState::Invite|JoinState::Join) const;