aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-12-03 01:43:26 +0100
committerdec05eba <dec05eba@protonmail.com>2020-12-03 01:43:26 +0100
commitdf33764eeb6d038419d8a88a2888b5472b86316b (patch)
tree7d11165a2ed118bb4d265db35484fbe6ec7fd8c7
parent091c181958d306d8decd1628473ebf4af6c2ada0 (diff)
Matrix: make messages that reply to us red even if the text itself doesn't contain reference to our name
-rw-r--r--TODO8
-rw-r--r--src/QuickMedia.cpp16
2 files changed, 18 insertions, 6 deletions
diff --git a/TODO b/TODO
index bce0bf4..6ff1f16 100644
--- a/TODO
+++ b/TODO
@@ -128,7 +128,7 @@ Automatically retry sending messages that fails to send (after timeout). These f
Also make message deletion provisional (make it gray while its deleting the message).
Continue matrix requests when switching room, instead of resetting them when going from chat page to room list page (such as post message request).
Improve /sync by not removing cached data on initial sync, and also always append data to sync file instead of overwriting sync file on "initial sync". Also cache "since", but take into consideration that not all messages are fetched on the initial sync,
-then add a gap between old messages from before sync and after sync so we can fetch the messages between the old messages and new messages and remove the gap when the fetched messages contains any of the old messages.
+then add a gap between old messages from before sync and after sync so we can fetch the messages between the old messages and new messages and remove the gap when the fetched messages contains any of the old messages. After the sync, ignored users messages should be removed from the cache and messages list. Also take into consideration unignoring users.
Fetching of previous messages should also be saved in the /sync file and messages fetched with get_message_by_id, which would cache embedded items and pinned messages; also cache users.
If manga page fails to download then show "failed to download image" as text and bind F5 to refresh (retry download).
Use <img src to add custom emojis, and add setting for adding/removing custom emoji.
@@ -143,4 +143,8 @@ Allow removing reactions.
When fetching previous messages in matrix, fetching until there are 0 messages or until there is at least 1 visible item. This is needed because right now we could fetch 10 messages, all which are delete/edit/react and it will look like there are no more messages to fetch to the user.
QuickMedia crashes if you enter a room that you have left before. This could happen if cache is loaded that has a room that is then getting removed when sync is finished.
Removing a reaction should be shown as "removed reaction: <reaction text>" in the room description instead of "Message deleted".
-Limit size of Entry and scroll content instead. \ No newline at end of file
+Limit size of Entry and scroll content instead.
+Have an option to remove membership events from room unread messages, so that only text/media messages update room unread description in the room list. This could be implemented by doing /sync and filtering to only show m.room.message event types or something similar and limiting it to the last message,
+then comparing that to the read marker.
+Comparing latest message for unread message should be done by comparing event id ascii-wise instead of checking if the latest message is equal to the read marker event id. This is to fix unread messages in the case of the latest message in a room being deleted.
+Support replying to messages with media, by typing /upload in the reply text. \ No newline at end of file
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index da22d72..424ccbb 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -2082,7 +2082,7 @@ namespace QuickMedia {
std::vector<CommandArg> extra_args;
if(strcmp(images_page->get_service_name(), "manganelo") == 0) {
extra_args = {
- CommandArg { "-H", "accept: image/webp,image/apng,image/*,*/*;q=0.8" },
+ CommandArg { "-H", "accept: image/png,image/*,*/*;q=0.8" },
CommandArg { "-H", "sec-fetch-site: cross-site" },
CommandArg { "-H", "sec-fetch-mode: no-cors" },
CommandArg { "-H", "sec-fetch-dest: image" },
@@ -3627,7 +3627,7 @@ namespace QuickMedia {
int fetch_message_tab = -1;
// TODO: How about instead fetching all messages we have, not only the visible ones? also fetch with multiple threads.
- tabs[PINNED_TAB_INDEX].body->body_item_render_callback = [this, &current_room, &fetch_message_future, &tabs, &fetch_message, &find_body_item_by_event_id, &fetch_body_item, &fetch_message_tab](BodyItem *body_item) {
+ tabs[PINNED_TAB_INDEX].body->body_item_render_callback = [this, &current_room, &me, &fetch_message_future, &tabs, &fetch_message, &find_body_item_by_event_id, &fetch_body_item, &fetch_message_tab](BodyItem *body_item) {
if(fetch_message_future.valid())
return;
@@ -3658,6 +3658,8 @@ namespace QuickMedia {
// TODO: Optimize from linear search to hash map
auto related_body_item = find_body_item_by_event_id(tabs[MESSAGES_TAB_INDEX].body->items.data(), tabs[MESSAGES_TAB_INDEX].body->items.size(), event_data->message->related_event_id);
if(related_body_item) {
+ if(related_body_item->userdata && static_cast<Message*>(related_body_item->userdata)->user == me)
+ body_item->set_description_color(sf::Color(255, 100, 100));
body_item->embedded_item = std::make_shared<BodyItem>("");
*body_item->embedded_item = *related_body_item;
body_item->embedded_item_status = FetchStatus::FINISHED_LOADING;
@@ -3682,6 +3684,8 @@ namespace QuickMedia {
// TODO: Optimize from linear search to hash map
auto related_body_item = find_body_item_by_event_id(tabs[MESSAGES_TAB_INDEX].body->items.data(), tabs[MESSAGES_TAB_INDEX].body->items.size(), event_data->event_id);
if(related_body_item) {
+ if(related_body_item->userdata && static_cast<Message*>(related_body_item->userdata)->user == me)
+ body_item->set_description_color(sf::Color(255, 100, 100));
*body_item = *related_body_item;
event_data->status = FetchStatus::FINISHED_LOADING;
event_data->message = static_cast<Message*>(related_body_item->userdata);
@@ -3700,7 +3704,7 @@ namespace QuickMedia {
};
// TODO: How about instead fetching all messages we have, not only the visible ones? also fetch with multiple threads.
- tabs[MESSAGES_TAB_INDEX].body->body_item_render_callback = [this, &current_room, &fetch_message_future, &tabs, &fetch_message, &find_body_item_by_event_id, &fetch_body_item, &fetch_message_tab](BodyItem *body_item) {
+ tabs[MESSAGES_TAB_INDEX].body->body_item_render_callback = [this, &current_room, &me, &fetch_message_future, &tabs, &fetch_message, &find_body_item_by_event_id, &fetch_body_item, &fetch_message_tab](BodyItem *body_item) {
Message *message = static_cast<Message*>(body_item->userdata);
if(!message)
return;
@@ -3732,6 +3736,8 @@ namespace QuickMedia {
// TODO: Optimize from linear search to hash map
auto related_body_item = find_body_item_by_event_id(tabs[MESSAGES_TAB_INDEX].body->items.data(), tabs[MESSAGES_TAB_INDEX].body->items.size(), message->related_event_id);
if(related_body_item) {
+ if(related_body_item->userdata && static_cast<Message*>(related_body_item->userdata)->user == me)
+ body_item->set_description_color(sf::Color(255, 100, 100));
body_item->embedded_item = std::make_shared<BodyItem>("");
*body_item->embedded_item = *related_body_item;
body_item->embedded_item_status = FetchStatus::FINISHED_LOADING;
@@ -4521,6 +4527,8 @@ namespace QuickMedia {
}
} else if(fetch_message_tab == MESSAGES_TAB_INDEX) {
if(fetch_message_result.message) {
+ if(fetch_message_result.message->user == me)
+ fetch_body_item->set_description_color(sf::Color(255, 100, 100));
fetch_body_item->embedded_item = message_to_body_item(current_room, fetch_message_result.message.get(), current_room->get_user_display_name(me), me->user_id);
fetch_body_item->embedded_item_status = FetchStatus::FINISHED_LOADING;
} else {
@@ -4713,7 +4721,7 @@ namespace QuickMedia {
fetched_messages_set.insert(message->event_id);
}
all_messages.insert(all_messages.end(), all_messages_new.begin(), all_messages_new.end());
- me = matrix->get_me(current_room);
+ //me = matrix->get_me(current_room);
filter_sent_messages(all_messages_new);
add_new_messages_to_current_room(all_messages_new);
modify_related_messages_in_current_room(all_messages_new);