diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-07-07 01:22:34 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-07-07 01:24:32 +0200 |
commit | 3c1ab9864d7f89a0649027a32e6af772df9a991e (patch) | |
tree | bfe389e9da82d0a72d6ba1a07513bb22960cef18 /src | |
parent | fe4fa66919dc00019dd34e44aeeb6e795efb1d5f (diff) |
Strip newlines from room name and topic
Diffstat (limited to 'src')
-rw-r--r-- | src/FileAnalyzer.cpp | 1 | ||||
-rw-r--r-- | src/QuickMedia.cpp | 2 | ||||
-rw-r--r-- | src/plugins/Matrix.cpp | 5 |
3 files changed, 5 insertions, 3 deletions
diff --git a/src/FileAnalyzer.cpp b/src/FileAnalyzer.cpp index a3611f5..32fbbdb 100644 --- a/src/FileAnalyzer.cpp +++ b/src/FileAnalyzer.cpp @@ -19,7 +19,6 @@ namespace QuickMedia { // https://en.wikipedia.org/wiki/List_of_file_signatures // https://mimesniff.spec.whatwg.org/ - // What about audio ogg files that are not opus? // TODO: Test all of these static const std::array<MagicNumber, 28> magic_numbers = { MagicNumber{ {'R', 'I', 'F', 'F', -1, -1, -1, -1, 'A', 'V', 'I', ' '}, 12, ContentType::VIDEO_AVI }, diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp index b30a448..1f468d9 100644 --- a/src/QuickMedia.cpp +++ b/src/QuickMedia.cpp @@ -4833,6 +4833,8 @@ namespace QuickMedia { std::string room_name = current_room->get_name(); std::string room_topic = current_room->get_topic(); + string_replace_all(room_name, '\n', ' '); + string_replace_all(room_topic, '\n', ' '); room_name_text.setString(sf::String::fromUtf8(room_name.begin(), room_name.end())); room_topic_text.setString(sf::String::fromUtf8(room_topic.begin(), room_topic.end())); diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index cd4f637..17bc17b 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -364,6 +364,7 @@ namespace QuickMedia { if(room_name.empty()) room_name = room->id; + string_replace_all(room_name, '\n', ' '); auto body_item = BodyItem::create(std::move(room_name)); body_item->url = room->id; body_item->thumbnail_url = room->get_avatar_url(); @@ -908,7 +909,7 @@ namespace QuickMedia { auto body_item = BodyItem::create(""); body_item->url = user_info.user_id; - body_item->set_author(std::move(display_name)); + body_item->set_author(extract_first_line_remove_newline_elipses(display_name, AUTHOR_MAX_LENGTH)); body_item->set_author_color(user_id_to_color(user_info.user_id)); body_item->set_description(user_info.user_id); body_item->set_description_color(get_current_theme().faded_text_color); @@ -962,7 +963,7 @@ namespace QuickMedia { else display_name = user_info.display_name.value(); - (*it)->set_author(std::move(display_name)); + (*it)->set_author(extract_first_line_remove_newline_elipses(display_name, AUTHOR_MAX_LENGTH)); auto user_body_item = *it; users_body->items.erase(it); |