1 | #pragma once |
2 | |
3 | /// @file |
4 | /// @brief A text message. |
5 | |
6 | #if __has_include(<nlohmann/json_fwd.hpp>) |
7 | #include <nlohmann/json_fwd.hpp> |
8 | #else |
9 | #include <nlohmann/json.hpp> |
10 | #endif |
11 | |
12 | #include <string> |
13 | |
14 | #include "mtx/events/common.hpp" |
15 | |
16 | namespace mtx { |
17 | namespace events { |
18 | //! Non-state events sent in the timeline like messages. |
19 | namespace msg { |
20 | |
21 | //! Content of `m.room.message` with msgtype `m.text`. |
22 | struct Text |
23 | { |
24 | //! The body of the message. |
25 | std::string body; |
26 | //! Must be 'm.text'. |
27 | std::string msgtype; |
28 | //! We only handle org.matrix.custom.html. |
29 | std::string format; |
30 | //! HTML formatted message. |
31 | std::string formatted_body; |
32 | //! Relates to for rich replies |
33 | mtx::common::Relations relations; |
34 | |
35 | friend void from_json(const nlohmann::json &obj, Text &content); |
36 | friend void to_json(nlohmann::json &obj, const Text &content); |
37 | }; |
38 | |
39 | } // namespace msg |
40 | } // namespace events |
41 | } // namespace mtx |
42 | |