From 8858c40091ed73b730fe62bf565b34cdda1b4e39 Mon Sep 17 00:00:00 2001 From: Vladyslav Hnatiuk Date: Sat, 3 Apr 2021 07:39:41 +0200 Subject: Fix broken links in README. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 0ed599b3..c993c31e 100644 --- a/README.md +++ b/README.md @@ -85,13 +85,13 @@ a recommended way of linking your application with libQuotient on this platform. Static linkage is the default on Windows/macOS; feel free to experiment with dynamic linking and submit PRs if you get reusable results. -[Quotest](tests), the test application that comes with libQuotient, includes +[Quotest](quotest), the test application that comes with libQuotient, includes most common use cases such as sending messages, uploading files, setting room state etc.; for more extensive usage check out the source code of [Quaternion](https://github.com/quotient-im/Quaternion) (the reference client of Quotient) or [Spectral](https://gitlab.com/b0/spectral). -To ease the first step, `tests/CMakeLists.txt` is a good starting point +To ease the first step, `quotest/CMakeLists.txt` is a good starting point for your own CMake-based project using libQuotient. ## Building the library @@ -155,7 +155,7 @@ You can install the library with CMake: cmake --build . --target install ``` This will also install cmake package config files; once this is done, you -should be able to use [`tests/CMakeLists.txt`](tests/CMakeLists.txt) to compile quotest +should be able to use [`quotest/CMakeLists.txt`](quotest/CMakeLists.txt) to compile quotest with the _installed_ library. Installation of the `quotest` binary along with the rest of the library can be skipped by setting `Quotient_INSTALL_TESTS` to `OFF`. -- cgit v1.2.3 From ae85fd8602cefd1b71db8cb173ed77a873dbe223 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Mon, 26 Apr 2021 17:52:49 +0200 Subject: Make it possible to load the user metadata In the normal case there is always a room that is associated with an user. So it is in most of the cases, possible to load the metadata (display name and avatar url) with the help of the room. In some cases, it is not possible. For example, when opening an user matrix link pointing to an user and not to a room. In this case, we need to load the metadata independly of the room, since the user is not linked to a room. --- lib/user.cpp | 19 ++++++++++++------- lib/user.h | 4 ++++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/user.cpp b/lib/user.cpp index c4c4fec8..7933c5d9 100644 --- a/lib/user.cpp +++ b/lib/user.cpp @@ -51,13 +51,7 @@ User::User(QString userId, Connection* connection) setObjectName(id()); if (connection->userId() == id()) { // Load profile information for local user. - auto *profileJob = connection->callApi(id()); - connect(profileJob, &BaseJob::result, this, [this, profileJob] { - d->defaultName = profileJob->displayname(); - d->defaultAvatar = Avatar(QUrl(profileJob->avatarUrl())); - emit defaultNameChanged(); - emit defaultAvatarChanged(); - }); + load(); } } @@ -69,6 +63,17 @@ Connection* User::connection() const User::~User() = default; +void User::load() +{ + auto *profileJob = connection()->callApi(id()); + connect(profileJob, &BaseJob::result, this, [this, profileJob] { + d->defaultName = profileJob->displayname(); + d->defaultAvatar = Avatar(QUrl(profileJob->avatarUrl())); + emit defaultNameChanged(); + emit defaultAvatarChanged(); + }); +} + QString User::id() const { return d->id; } bool User::isGuest() const diff --git a/lib/user.h b/lib/user.h index d0926189..e4560843 100644 --- a/lib/user.h +++ b/lib/user.h @@ -130,6 +130,10 @@ public Q_SLOTS: void unmarkIgnore(); /// Check whether the user is in ignore list bool isIgnored() const; + /// Force loading displayName and avartar url. This is required in + /// some cases where the you need to use an user independent of the + /// room. + void load(); Q_SIGNALS: void defaultNameChanged(); -- cgit v1.2.3 From f89ece678c47a54a28c91c2d0ced65ba3e9a6540 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Mon, 26 Apr 2021 19:12:08 +0200 Subject: CI: Use GCC 9 where GCC 8 was GitHub images no more have GCC 8. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd6f489e..24681460 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -58,7 +58,7 @@ jobs: - name: Setup build environment run: | if [ "${{ matrix.compiler }}" == "GCC" ]; then - if [ -n "${{ matrix.update-api }}" ]; then VERSION_POSTFIX='-8'; fi + if [ -n "${{ matrix.update-api }}" ]; then VERSION_POSTFIX='-9'; fi echo "CC=gcc$VERSION_POSTFIX" >>$GITHUB_ENV echo "CXX=g++$VERSION_POSTFIX" >>$GITHUB_ENV else -- cgit v1.2.3 From 0c8a819f8a3c31360e3f6044374aa219e93ec21e Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 8 May 2021 10:07:54 +0200 Subject: Fix joinedRoom signal not being emitted in some cases An alternative implementation of #463 (and thanks to Carl for spotting the original problem). --- lib/connection.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/connection.cpp b/lib/connection.cpp index 579c7920..a384783c 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -807,7 +807,7 @@ JoinRoomJob* Connection::joinRoom(const QString& roomAlias, // that may add their own slots to finished(). connect(job, &BaseJob::finished, this, [this, job] { if (job->status().good()) - provideRoom(job->roomId()); + provideRoom(job->roomId(), JoinState::Join); }); return job; } @@ -1464,11 +1464,13 @@ Room* Connection::provideRoom(const QString& id, Omittable joinState) room = d->roomMap.value({ id, true }, nullptr); if (room) return room; - // No Invite either, setup a new room object below + // No Invite either, setup a new room object in Join state + joinState = JoinState::Join; } if (!room) { - room = roomFactory()(this, id, joinState.value_or(JoinState::Join)); + Q_ASSERT(joinState.has_value()); + room = roomFactory()(this, id, *joinState); if (!room) { qCCritical(MAIN) << "Failed to create a room" << id; return nullptr; -- cgit v1.2.3 From d3edd940098d2a9dbe511311f35187d5c93cbe9b Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Wed, 19 May 2021 23:25:43 +0200 Subject: Add libquotient.kdev4 to .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index e9b63926..769bdf45 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ build build_dir # IDE project files/directories -.kdev4 +*.kdev4 .directory *.user* .idea -- cgit v1.2.3