1 | #pragma once |
2 | |
3 | /// @file |
4 | /// @brief Typing notifications. |
5 | |
6 | #include <string> |
7 | #include <vector> |
8 | |
9 | #if __has_include(<nlohmann/json_fwd.hpp>) |
10 | #include <nlohmann/json_fwd.hpp> |
11 | #else |
12 | #include <nlohmann/json.hpp> |
13 | #endif |
14 | |
15 | namespace mtx { |
16 | namespace events { |
17 | //! Ephemeral events not part of the timeline like typing and read notifications. |
18 | namespace ephemeral { |
19 | |
20 | /// @brief Typing notifications / `m.typing`. |
21 | /// |
22 | /// Users may wish to be informed when another user is typing in a room. This can be achieved using |
23 | /// typing notifications. These are ephemeral events scoped to a room_id. This means they do not |
24 | /// form part of the Event Graph but still have a room_id key. |
25 | struct Typing |
26 | { |
27 | //! Required. The list of user IDs typing in this room, if any. |
28 | std::vector<std::string> user_ids; |
29 | |
30 | //! Deserialization method needed by @p nlohmann::json. |
31 | friend void from_json(const nlohmann::json &obj, Typing &content); |
32 | |
33 | //! Serialization method needed by @p nlohmann::json. |
34 | friend void to_json(nlohmann::json &obj, const Typing &content); |
35 | }; |
36 | |
37 | } // namespace state |
38 | } // namespace events |
39 | } // namespace mtx |
40 | |