diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-10-17 18:56:44 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-10-17 18:56:44 +0200 |
commit | 12cdc09759edf506fbafe051895343b20a67798c (patch) | |
tree | 43f561a78eb4869bde1638ab44288ff825265800 /src/plugins | |
parent | 4a7b86829025664f6eeef6fcb5fc0894733f2ad6 (diff) |
Matrix: make text that mentions us red
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Matrix.cpp | 7 | ||||
-rw-r--r-- | src/plugins/NyaaSi.cpp | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index ea5f86c..f9bfe30 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -415,7 +415,7 @@ namespace QuickMedia { } // TODO: Do not show notification if mention is a reply to somebody else that replies to me? also dont show notification everytime a mention is edited - static bool message_contains_user_mention(const std::string &msg, const std::string &username) { + bool message_contains_user_mention(const std::string &msg, const std::string &username) { if(msg.empty()) return false; @@ -447,6 +447,7 @@ namespace QuickMedia { return; std::vector<std::shared_ptr<Message>> new_messages; + auto me = get_me(room_data); for(const rapidjson::Value &event_item_json : events_json.GetArray()) { std::shared_ptr<Message> new_message = parse_message_event(event_item_json, room_data.get()); @@ -454,8 +455,8 @@ namespace QuickMedia { continue; // TODO: Is @room ok? shouldn't we also check if the user has permission to do @room? (only when notifications are limited to @mentions) - if(has_unread_notifications && !username.empty()) - new_message->mentions_me = message_contains_user_mention(new_message->body, username) || message_contains_user_mention(new_message->body, "@room"); + if(has_unread_notifications && me) + new_message->mentions_me = message_contains_user_mention(new_message->body, me->display_name) || message_contains_user_mention(new_message->body, "@room"); new_messages.push_back(std::move(new_message)); } diff --git a/src/plugins/NyaaSi.cpp b/src/plugins/NyaaSi.cpp index 8d0679e..dc6e19f 100644 --- a/src/plugins/NyaaSi.cpp +++ b/src/plugins/NyaaSi.cpp @@ -170,9 +170,9 @@ namespace QuickMedia { body_item->set_description(std::move(description)); body_item->url = "https://nyaa.si" + std::move(view_url); if(is_trusted) - body_item->title_color = sf::Color(43, 255, 47); + body_item->set_title_color(sf::Color(43, 255, 47)); else if(is_remake) - body_item->title_color = sf::Color(255, 45, 47); + body_item->set_title_color(sf::Color(255, 45, 47)); result_items.push_back(std::move(body_item)); } |