Debian Codegraph @

mtxclient/include/mtx/events/messages/image.hpp

raw symbols SCIP
1 #pragma once
2
3 /// @file
4 /// @brief Images sent in a room.
5
6 #include <optional>
7 #include <string>
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 #include "mtx/common.hpp"
16 #include "mtx/events/common.hpp"
17
18 namespace mtx {
19 namespace events {
20 namespace msg {
21
22 //! Content of `m.room.message` with msgtype `m.image`.
23 struct Image
24 {
25 //! A textual representation of the image. This could be
26 //! the alt text of the image, the filename of the image,
27 //! or some kind of content description for accessibility e.g. 'image attachment
28 std::string body;
29 //! Must be 'm.image'.
30 std::string msgtype;
31 //! The Matrix URL to the image.
32 std::string url;
33 //! Metadata about the image referred to in `url`.
34 mtx::common::ImageInfo info;
35 //! Encryption members. If present, they replace url.
36 std::optional<crypto::EncryptedFile> file;
37 //! Relates to for rich replies
38 mtx::common::Relations relations;
39
40 //! Mentioned users by this event
41 std::optional<mtx::common::Mentions> mentions;
42
43 friend void from_json(const nlohmann::json &obj, Image &content);
44 friend void to_json(nlohmann::json &obj, const Image &content);
45 };
46
47 //! Content of `m.sticker`.
48 struct StickerImage
49 {
50 //! A textual representation of the image. This could be
51 //! the alt text of the image, the filename of the image,
52 //! or some kind of content description for accessibility e.g. 'image attachment
53 std::string body;
54 //! The Matrix URL to the image.
55 std::string url;
56 //! Metadata about the image referred to in `url`.
57 mtx::common::ImageInfo info;
58 //! Encryption members. If present, they replace url.
59 std::optional<crypto::EncryptedFile> file;
60 //! Relates to for rich replies
61 mtx::common::Relations relations;
62
63 //! Mentioned users by this event
64 std::optional<mtx::common::Mentions> mentions;
65
66 friend void from_json(const nlohmann::json &obj, StickerImage &content);
67 friend void to_json(nlohmann::json &obj, const StickerImage &content);
68 };
69
70 } // namespace msg
71 } // namespace events
72 } // namespace mtx