Debian Codegraph @

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

raw symbols SCIP
1 #pragma once
2
3 /// @file
4 /// @brief A file 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.file`.
23 struct File
24 {
25 /// @brief A human-readable description of the file.
26 ///
27 /// This is recommended to be the filename of the original upload.
28 std::string body;
29 /// @brief The original filename of the uploaded file.
30 ///
31 /// SPEC_BUG: The filename is not really required.
32 std::string filename;
33 //! Must be 'm.file'.
34 std::string msgtype;
35 //! The matrix URL of the file.
36 std::string url;
37 //! Information about the file referred to in the url.
38 mtx::common::FileInfo info;
39 //! Encryption members. If present, they replace url.
40 std::optional<crypto::EncryptedFile> file;
41 //! Relates to for rich replies
42 mtx::common::Relations relations;
43
44 //! Mentioned users by this event
45 std::optional<mtx::common::Mentions> mentions;
46
47 friend void from_json(const nlohmann::json &obj, File &content);
48 friend void to_json(nlohmann::json &obj, const File &content);
49 };
50
51 } // namespace msg
52 } // namespace events
53 } // namespace mtx