aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-10-17 09:40:10 +0200
committerdec05eba <dec05eba@protonmail.com>2020-10-17 10:49:13 +0200
commit9bf163d51a252fb5a611e88c2e0b4123a98169e1 (patch)
treee742979a7128e3ead913e9348c4b207c0fd95ab4 /plugins
parentfd9178b9d500a0b5f30f388f8d419ac386ce87cb (diff)
Matrix: show reply messages embedded in messages that reply to them, like element does
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Matrix.hpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp
index 8d078a0..9f58b24 100644
--- a/plugins/Matrix.hpp
+++ b/plugins/Matrix.hpp
@@ -6,7 +6,7 @@
#include <SFML/Graphics/Color.hpp>
#include <unordered_map>
#include <mutex>
-#include <rapidjson/document.h>
+#include <rapidjson/fwd.h>
namespace QuickMedia {
// Dummy, only play one video. TODO: Play all videos in room, as related videos?
@@ -91,6 +91,11 @@ namespace QuickMedia {
std::string avatar_url;
std::string prev_batch;
bool initial_fetch_finished = false;
+
+ // These are messages fetched with |Matrix::get_message_by_id|. Needed to show replies, when replying to old message not part of /sync.
+ // The value is nullptr if the message is fetched and cached but the event if referenced an invalid message.
+ // TODO: Verify if replied to messages are also part of /sync; then this is not needed.
+ std::unordered_map<std::string, std::shared_ptr<Message>> fetched_messages_by_event_id;
private:
std::mutex user_mutex;
std::mutex room_mutex;
@@ -157,6 +162,9 @@ namespace QuickMedia {
std::shared_ptr<UserInfo> get_me(std::shared_ptr<RoomData> room);
+ // Returns nullptr if message cant be found. Note: cached
+ std::shared_ptr<Message> get_message_by_id(RoomData *room, const std::string &event_id);
+
bool use_tor = false;
private:
PluginResult sync_response_to_body_items(const rapidjson::Document &root, RoomSyncMessages &room_messages);
@@ -165,6 +173,7 @@ namespace QuickMedia {
void events_add_user_read_markers(const rapidjson::Value &events_json, RoomData *room_data);
void events_add_messages(const rapidjson::Value &events_json, std::shared_ptr<RoomData> &room_data, MessageDirection message_dir, RoomSyncMessages *room_messages, bool has_unread_notifications);
void events_set_room_name(const rapidjson::Value &events_json, RoomData *room_data);
+ std::shared_ptr<Message> parse_message_event(const rapidjson::Value &event_item_json, RoomData *room_data);
PluginResult upload_file(std::shared_ptr<RoomData> room, const std::string &filepath, UploadInfo &file_info, UploadInfo &thumbnail_info, std::string &err_msg);
std::shared_ptr<Message> get_edited_message_original_message(RoomData *room_data, std::shared_ptr<Message> message);