| 1 | #pragma once |
| 2 | |
| 3 | /// @file |
| 4 | /// @brief Change the canonical or listed avatars of a room. |
| 5 | |
| 6 | #include <string> |
| 7 | |
| 8 | #if __has_include(<nlohmann/json_fwd.hpp>) |
| 9 | #include <nlohmann/json_fwd.hpp> |
| 10 | #else |
| 11 | #include <nlohmann/json.hpp> |
| 12 | #endif |
| 13 | |
| 14 | namespace mtx { |
| 15 | namespace events { |
| 16 | namespace state { |
| 17 | |
| 18 | //! Content for the `m.room.canonical_alias` event. |
| 19 | // |
| 20 | //! This event is used to inform the room about which alias |
| 21 | //! should be considered the canonical one. This could be for |
| 22 | //! display purposes or as suggestion to users which alias to |
| 23 | //! use to advertise the room. |
| 24 | struct CanonicalAlias |
| 25 | { |
| 26 | //! The canonical alias. Could be *null*. |
| 27 | std::string alias; |
| 28 | //! Alternative aliases the room advertises. This list can have aliases despite the alias |
| 29 | //! field being null, empty, or otherwise not present. |
| 30 | std::vector<std::string> alt_aliases; |
| 31 | |
| 32 | //! Deserialization method needed by @p nlohmann::json. |
| 33 | friend void from_json(const nlohmann::json &obj, CanonicalAlias &canonical_alias); |
| 34 | |
| 35 | //! Serialization method needed by @p nlohmann::json. |
| 36 | friend void to_json(nlohmann::json &obj, const CanonicalAlias &canonical_alias); |
| 37 | }; |
| 38 | |
| 39 | } // namespace state |
| 40 | } // namespace events |
| 41 | } // namespace mtx |
| 42 | |