aboutsummaryrefslogtreecommitdiff
path: root/src/QuickMedia.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/QuickMedia.cpp')
-rw-r--r--src/QuickMedia.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 50b0608..ca3cedb 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -3383,7 +3383,7 @@ namespace QuickMedia {
message->mentions_me = false;
// TODO: What if the message or username begins with "-"? also make the notification image be the avatar of the user
std::string desc = "QuickMedia Matrix\n\n" + message->body;
- show_notification(matrix->message_get_author_displayname(room, message.get()), desc.c_str());
+ show_notification(matrix->message_get_author_displayname(message.get()), desc.c_str());
}
}
@@ -3392,17 +3392,18 @@ namespace QuickMedia {
continue;
// TODO: this wont always because we dont display all types of messages from server, such as "joined", "left", "kicked", "banned", "changed avatar", "changed display name", etc.
+ // TODO: Update local marker when another client with our user sets read marker, in that case our read marker (room->get_user_read_marker) will be updated.
bool unread_messages_previous_session = false;
if(!messages.empty()) {
- const UserInfo *me = matrix->get_me(room->id);
- if(me->read_marker_event_id != messages.back()->event_id)
+ std::shared_ptr<UserInfo> me = matrix->get_me(room->id);
+ if(me && room->get_user_read_marker(me) != messages.back()->event_id)
unread_messages_previous_session = true;
}
if(only_show_mentions && !unread_messages_previous_session) {
std::string room_desc;
if(!messages.empty())
- room_desc = matrix->message_get_author_displayname(room, messages.back().get()) + ": " + extract_first_line(messages.back()->body, 150);
+ room_desc = matrix->message_get_author_displayname(messages.back().get()) + ": " + extract_first_line(messages.back()->body, 150);
if(was_mentioned) {
room_desc += "\n** You were mentioned **"; // TODO: Better notification?
room_body_item_it->second.body_item->title_color = sf::Color(255, 100, 100);
@@ -3410,7 +3411,7 @@ namespace QuickMedia {
}
room_body_item_it->second.body_item->set_description(std::move(room_desc));
} else if(!messages.empty()) {
- std::string room_desc = "Unread: " + matrix->message_get_author_displayname(room, messages.back().get()) + ": " + extract_first_line(messages.back()->body, 150);
+ std::string room_desc = "Unread: " + matrix->message_get_author_displayname(messages.back().get()) + ": " + extract_first_line(messages.back()->body, 150);
if(was_mentioned)
room_desc += "\n** You were mentioned **"; // TODO: Better notification?
room_body_item_it->second.body_item->set_description(std::move(room_desc));
@@ -3744,7 +3745,7 @@ namespace QuickMedia {
if(!selected->url.empty()) { // cant edit messages that are image/video posts
// TODO: Show inline notification
show_notification("QuickMedia", "You can only edit messages with no file attached to it");
- } else if(!matrix->was_message_posted_by_me(current_room_id, selected->userdata)) {
+ } else if(!matrix->was_message_posted_by_me(selected->userdata)) {
// TODO: Show inline notification
show_notification("QuickMedia", "You can't edit a message that was posted by somebody else");
} else {