1#pragma once
2
3/// @file
4/// @brief The direct chats of a user.
5
6#include <map>
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
15namespace mtx {
16namespace events {
17namespace account_data {
18
19/// @brief The direct chats for a user / `m.direct`.
20///
21/// A map of which rooms are considered ‘direct’ rooms for specific users is kept in account_data in
22/// an event of type m.direct. The content of this event is an object where the keys are the user
23/// IDs and values are lists of room ID strings of the ‘direct’ rooms for that user ID.
24struct Direct
25{
26 //! A map of which rooms are considered ‘direct’ rooms for specific users is kept in
27 //! account_data in an event of type m.direct. The content of this event is an object where the
28 //! keys are the user IDs and values are lists of room ID strings of the ‘direct’ rooms for that
29 //! user ID.
30 std::map<std::string, std::vector<std::string>> user_to_rooms;
31
32 //! Deserialization method needed by @p nlohmann::json.
33 friend void from_json(const nlohmann::json &obj, Direct &content);
34
35 //! Serialization method needed by @p nlohmann::json.
36 friend void to_json(nlohmann::json &obj, const Direct &content);
37};
38
39} // namespace state
40} // namespace events
41} // namespace mtx
42