diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/events/accountdataevents.h | 1 | ||||
-rw-r--r-- | lib/jobs/basejob.cpp | 6 | ||||
-rw-r--r-- | lib/room.cpp | 5 | ||||
-rw-r--r-- | lib/room.h | 2 |
4 files changed, 13 insertions, 1 deletions
diff --git a/lib/events/accountdataevents.h b/lib/events/accountdataevents.h index a99d85ac..a43e358c 100644 --- a/lib/events/accountdataevents.h +++ b/lib/events/accountdataevents.h @@ -28,6 +28,7 @@ namespace QMatrixClient { constexpr const char* FavouriteTag = "m.favourite"; constexpr const char* LowPriorityTag = "m.lowpriority"; + constexpr const char* ServerNoticeTag = "m.server_notice"; struct TagRecord { diff --git a/lib/jobs/basejob.cpp b/lib/jobs/basejob.cpp index 0d9b9f10..5af37902 100644 --- a/lib/jobs/basejob.cpp +++ b/lib/jobs/basejob.cpp @@ -333,7 +333,11 @@ void BaseJob::gotReply() d->status.message = tr("Requested room version: %1") .arg(json.value("room_version").toString()); - } else if (!json.isEmpty()) // Not localisable on the client side + } + else if (errCode == "M_CANNOT_LEAVE_SERVER_NOTICE_ROOM") + setStatus(IncorrectRequestError, + tr("It's not allowed to leave a server notices room")); + else if (!json.isEmpty()) // Not localisable on the client side setStatus(d->status.code, json.value("error"_ls).toString()); } } diff --git a/lib/room.cpp b/lib/room.cpp index 0942d730..77fbc2a5 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -971,6 +971,11 @@ bool Room::isLowPriority() const return d->tags.contains(LowPriorityTag); } +bool Room::isServerNoticeRoom() const +{ + return d->tags.contains(ServerNoticeTag); +} + bool Room::isDirectChat() const { return connection()->isDirectChat(id()); @@ -348,6 +348,8 @@ namespace QMatrixClient bool isFavourite() const; /// Check whether the list of tags has m.lowpriority bool isLowPriority() const; + /// Check whether this room is for server notices (MSC1452) + bool isServerNoticeRoom() const; /// Check whether this room is a direct chat Q_INVOKABLE bool isDirectChat() const; |