libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
accountdataevents.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2018 Kitsune Ral <kitsune-ral@users.sf.net>
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include "event.h"
7
8#include "../csapi/definitions/tag.h"
9
10namespace Quotient {
11constexpr inline auto FavouriteTag = "m.favourite"_L1;
12constexpr inline auto LowPriorityTag = "m.lowpriority"_L1;
13constexpr inline auto ServerNoticeTag = "m.server_notice"_L1;
14
15using TagRecord [[deprecated("Use Tag from csapi/definitions/tag.h instead")]] = Tag;
16
17inline std::partial_ordering operator<=>(
18 const Tag& lhs, const Tag& rhs) // clazy:exclude=function-args-by-value
19{
20 // Per The Spec, rooms with no order should be after those with order,
21 // against std::optional<>::operator<=>() convention.
22 return (lhs.order && !rhs.order) ? std::partial_ordering::less
23 : (!lhs.order && rhs.order) ? std::partial_ordering::greater
24 : *lhs.order <=> *rhs.order;
25}
26
27inline bool operator==(const Tag& lhs, const Tag& rhs) // clazy:exclude=function-args-by-value
28{
29 return std::is_eq(lhs <=> rhs);
30}
31
32using TagsMap = QHash<QString, Tag>;
33
34DEFINE_SIMPLE_EVENT(TagEvent, Event, "m.tag", TagsMap, tags, "tags")
35DEFINE_SIMPLE_EVENT(ReadMarkerEvent, Event, "m.fully_read", QString,
36 eventId, "event_id")
37DEFINE_SIMPLE_EVENT(IgnoredUsersEvent, Event, "m.ignored_user_list",
38 QSet<QString>, ignoredUsers, "ignored_users")
39} // namespace Quotient
#define DEFINE_SIMPLE_EVENT(Name_, Base_, TypeId_, ValueType_, GetterName_, JsonKey_)
Define a new event class with a single key-value pair in the content.
Definition event.h:476