forked from mirror/nheko
parent
6b16616e3a
commit
13df852479
@ -0,0 +1,67 @@ |
||||
#pragma once |
||||
|
||||
#include <map> |
||||
#include <mutex> |
||||
|
||||
//#include <nlohmann/json.hpp>
|
||||
|
||||
#include <mtx/responses.hpp> |
||||
#include <mtxclient/crypto/client.hpp> |
||||
|
||||
// Extra information associated with an outbound megolm session.
|
||||
struct OutboundGroupSessionData |
||||
{ |
||||
std::string session_id; |
||||
std::string session_key; |
||||
uint64_t message_index = 0; |
||||
}; |
||||
|
||||
void |
||||
to_json(nlohmann::json &obj, const OutboundGroupSessionData &msg); |
||||
void |
||||
from_json(const nlohmann::json &obj, OutboundGroupSessionData &msg); |
||||
|
||||
struct OutboundGroupSessionDataRef |
||||
{ |
||||
OlmOutboundGroupSession *session; |
||||
OutboundGroupSessionData data; |
||||
}; |
||||
|
||||
struct DevicePublicKeys |
||||
{ |
||||
std::string ed25519; |
||||
std::string curve25519; |
||||
}; |
||||
|
||||
void |
||||
to_json(nlohmann::json &obj, const DevicePublicKeys &msg); |
||||
void |
||||
from_json(const nlohmann::json &obj, DevicePublicKeys &msg); |
||||
|
||||
//! Represents a unique megolm session identifier.
|
||||
struct MegolmSessionIndex |
||||
{ |
||||
//! The room in which this session exists.
|
||||
std::string room_id; |
||||
//! The session_id of the megolm session.
|
||||
std::string session_id; |
||||
//! The curve25519 public key of the sender.
|
||||
std::string sender_key; |
||||
}; |
||||
|
||||
void |
||||
to_json(nlohmann::json &obj, const MegolmSessionIndex &msg); |
||||
void |
||||
from_json(const nlohmann::json &obj, MegolmSessionIndex &msg); |
||||
|
||||
struct OlmSessionStorage |
||||
{ |
||||
// Megolm sessions
|
||||
std::map<std::string, mtx::crypto::InboundGroupSessionPtr> group_inbound_sessions; |
||||
std::map<std::string, mtx::crypto::OutboundGroupSessionPtr> group_outbound_sessions; |
||||
std::map<std::string, OutboundGroupSessionData> group_outbound_session_data; |
||||
|
||||
// Guards for accessing megolm sessions.
|
||||
std::mutex group_outbound_mtx; |
||||
std::mutex group_inbound_mtx; |
||||
}; |
@ -0,0 +1,91 @@ |
||||
#pragma once |
||||
|
||||
#include <QDateTime> |
||||
#include <QImage> |
||||
#include <QString> |
||||
|
||||
#include <string> |
||||
|
||||
#include <mtx/events/join_rules.hpp> |
||||
|
||||
struct RoomMember |
||||
{ |
||||
QString user_id; |
||||
QString display_name; |
||||
QImage avatar; |
||||
}; |
||||
|
||||
struct SearchResult |
||||
{ |
||||
QString user_id; |
||||
QString display_name; |
||||
}; |
||||
|
||||
//! Used to uniquely identify a list of read receipts.
|
||||
struct ReadReceiptKey |
||||
{ |
||||
std::string event_id; |
||||
std::string room_id; |
||||
}; |
||||
|
||||
void |
||||
to_json(json &j, const ReadReceiptKey &key); |
||||
|
||||
void |
||||
from_json(const json &j, ReadReceiptKey &key); |
||||
|
||||
struct DescInfo |
||||
{ |
||||
QString event_id; |
||||
QString userid; |
||||
QString body; |
||||
QString timestamp; |
||||
QDateTime datetime; |
||||
}; |
||||
|
||||
//! UI info associated with a room.
|
||||
struct RoomInfo |
||||
{ |
||||
//! The calculated name of the room.
|
||||
std::string name; |
||||
//! The topic of the room.
|
||||
std::string topic; |
||||
//! The calculated avatar url of the room.
|
||||
std::string avatar_url; |
||||
//! The calculated version of this room set at creation time.
|
||||
std::string version; |
||||
//! Whether or not the room is an invite.
|
||||
bool is_invite = false; |
||||
//! Total number of members in the room.
|
||||
int16_t member_count = 0; |
||||
//! Who can access to the room.
|
||||
mtx::events::state::JoinRule join_rule = mtx::events::state::JoinRule::Public; |
||||
bool guest_access = false; |
||||
//! Metadata describing the last message in the timeline.
|
||||
DescInfo msgInfo; |
||||
//! The list of tags associated with this room
|
||||
std::vector<std::string> tags; |
||||
}; |
||||
|
||||
void |
||||
to_json(json &j, const RoomInfo &info); |
||||
void |
||||
from_json(const json &j, RoomInfo &info); |
||||
|
||||
//! Basic information per member;
|
||||
struct MemberInfo |
||||
{ |
||||
std::string name; |
||||
std::string avatar_url; |
||||
}; |
||||
|
||||
void |
||||
to_json(json &j, const MemberInfo &info); |
||||
void |
||||
from_json(const json &j, MemberInfo &info); |
||||
|
||||
struct RoomSearchResult |
||||
{ |
||||
std::string room_id; |
||||
RoomInfo info; |
||||
}; |
Loading…
Reference in new issue