aboutsummaryrefslogtreecommitdiff
path: root/plugins/Matrix.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Matrix.hpp')
-rw-r--r--plugins/Matrix.hpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp
index 97ba3cc..07c6f61 100644
--- a/plugins/Matrix.hpp
+++ b/plugins/Matrix.hpp
@@ -6,6 +6,7 @@
namespace QuickMedia {
struct UserInfo {
+ std::string user_id;
std::string display_name;
std::string avatar_url;
sf::Color display_name_color;
@@ -20,10 +21,12 @@ namespace QuickMedia {
struct Message {
// Index into |RoomData.user_info|
size_t user_id;
+ std::string event_id;
std::string body;
std::string url;
std::string thumbnail_url;
MessageType type;
+ bool is_reply;
};
struct MessageInfo {
@@ -39,7 +42,8 @@ namespace QuickMedia {
// The value is an index to |user_info|.
std::unordered_map<std::string, size_t> user_info_by_user_id;
std::vector<UserInfo> user_info;
- std::vector<Message> messages;
+ std::vector<std::shared_ptr<Message>> messages;
+ std::unordered_map<std::string, std::shared_ptr<Message>> message_by_event_id;
std::string name;
std::string avatar_url;
std::string prev_batch;
@@ -73,6 +77,10 @@ namespace QuickMedia {
// |url| should only be set when uploading media.
// TODO: Make api better.
PluginResult post_message(const std::string &room_id, const std::string &body, const std::string &url = "", MessageType msgtype = MessageType::TEXT, MessageInfo *info = nullptr);
+ // |relates_to| is from |BodyItem.userdata| and is of type |Message*|
+ PluginResult post_reply(const std::string &room_id, const std::string &body, void *relates_to);
+
+ // TODO: Make this work for all image types and videos and regular files
PluginResult post_file(const std::string &room_id, const std::string &filepath);
PluginResult login(const std::string &username, const std::string &password, const std::string &homeserver, std::string &err_msg);
PluginResult logout();