aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/QuickMedia.cpp8
-rw-r--r--src/plugins/Matrix.cpp16
2 files changed, 16 insertions, 8 deletions
diff --git a/src/QuickMedia.cpp b/src/QuickMedia.cpp
index 5fc5fb7..c9072b2 100644
--- a/src/QuickMedia.cpp
+++ b/src/QuickMedia.cpp
@@ -1532,7 +1532,7 @@ namespace QuickMedia {
static int accumulate_string_limit_head(char *data, int size, void *userdata) {
std::string *str = (std::string*)userdata;
str->append(data, size);
- if(str->size() >= 40)
+ if(str->size() >= 42)
return 1;
return 0;
}
@@ -1540,10 +1540,10 @@ namespace QuickMedia {
static bool video_url_is_non_streamable_mp4(const char *url) {
std::string result;
const char *args[] = { "curl", "-sLf", "-r", "0-40", "-H", useragent_str, "--", url, nullptr };
- exec_program(args, accumulate_string_limit_head, &result, 40);
- return (result.size() >= 40)
+ exec_program(args, accumulate_string_limit_head, &result, 42);
+ return (result.size() >= 42)
&& (memcmp(&result[4], "ftypisom", 8) == 0 || memcmp(&result[4], "ftypmp42", 8) == 0 || memcmp(&result[4], "ftymp42", 7) == 0 || memcmp(&result[4], "fty3gp5", 7) == 0)
- && (memcmp(&result[36], "moov", 4) != 0);
+ && (memmem(&result[0], result.size(), "moov", 4) == NULL);
}
const char* Program::get_plugin_name() const {
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 32700a7..8abffa7 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -323,6 +323,7 @@ namespace QuickMedia {
}
static void sort_room_body_items(std::vector<std::shared_ptr<BodyItem>> &room_body_items) {
+ #if 0
std::sort(room_body_items.begin(), room_body_items.end(), [](const std::shared_ptr<BodyItem> &body_item1, const std::shared_ptr<BodyItem> &body_item2) {
RoomData *room1 = static_cast<RoomData*>(body_item1->userdata);
RoomData *room2 = static_cast<RoomData*>(body_item2->userdata);
@@ -330,6 +331,11 @@ namespace QuickMedia {
int room2_focus_sum = (int)(room2->unread_notification_count > 0) + (int)!room2->last_message_read;
return room1_focus_sum > room2_focus_sum;
});
+ #else
+ std::sort(room_body_items.begin(), room_body_items.end(), [](const std::shared_ptr<BodyItem> &body_item1, const std::shared_ptr<BodyItem> &body_item2) {
+ return body_item1->get_title() > body_item2->get_title();
+ });
+ #endif
}
void MatrixQuickMedia::update(MatrixPageType page_type) {
@@ -399,8 +405,8 @@ namespace QuickMedia {
room_body_item->set_title_color(sf::Color(255, 100, 100));
room->last_message_read = false;
- rooms_page->move_room_to_top(room);
- room_tags_page->move_room_to_top(room);
+ //rooms_page->move_room_to_top(room);
+ //room_tags_page->move_room_to_top(room);
} else if(is_initial_sync) {
Message *last_message = nullptr;
if(!messages.empty())
@@ -460,6 +466,7 @@ namespace QuickMedia {
void MatrixRoomsPage::on_navigate_to_page(Body *body) {
if(search_bar)
body->filter_search_fuzzy(search_bar->get_text());
+ sort_room_body_items(body->items);
}
void MatrixRoomsPage::update() {
@@ -489,13 +496,14 @@ namespace QuickMedia {
}
if(sort_on_update) {
sort_on_update = false;
- sort_room_body_items(body->items);
+ //sort_room_body_items(body->items);
}
matrix_delegate->update(MatrixPageType::ROOM_LIST);
if(filter_on_update) {
filter_on_update = false;
if(search_bar)
body->filter_search_fuzzy(search_bar->get_text());
+ sort_room_body_items(body->items);
}
}
@@ -557,7 +565,7 @@ namespace QuickMedia {
Body *body_ptr = body.get();
TagData &tag_data = tag_body_items_by_name[url];
body->items = tag_data.room_body_items;
- sort_room_body_items(body->items);
+ //sort_room_body_items(body->items);
auto search_bar = create_search_bar("Search...", SEARCH_DELAY_FILTER);
auto rooms_page = std::make_unique<MatrixRoomsPage>(program, body_ptr, tag_data.tag_item->get_title(), this, search_bar.get());
rooms_page->matrix_delegate = matrix_delegate;