diff options
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Matrix.cpp | 37 |
1 files changed, 13 insertions, 24 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index a28aedc..a38c063 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -160,32 +160,21 @@ namespace QuickMedia { } static void room_messages_to_body_items(RoomData *room_data, Message *messages, size_t num_messages, BodyItems &result_items) { - // TODO: This prev_user_id should check previous message, otherwise if after a sync there is only 1 new message then it wont - // merge with the previous message. But for that to work then also have to send existing body items to this function, - // to get the body item to merge with - size_t prev_user_id = -1; for(size_t i = 0; i < num_messages; ++i) { const UserInfo &user_info = room_data->user_info[messages[i].user_id]; - if(messages[i].user_id == prev_user_id && messages[i].url.empty()) { - assert(!result_items.empty()); - result_items.back()->append_description("\n"); - result_items.back()->append_description(messages[i].body); - } else { - auto body_item = std::make_unique<BodyItem>(""); - body_item->set_author(user_info.display_name); - body_item->set_description(messages[i].body); - if(!messages[i].thumbnail_url.empty()) - body_item->thumbnail_url = messages[i].thumbnail_url; - else if(!messages[i].url.empty()) - body_item->thumbnail_url = messages[i].url; - else - body_item->thumbnail_url = user_info.avatar_url; - // TODO: Show image thumbnail inline instead of url to image - body_item->url = messages[i].url; - body_item->author_color = user_info.display_name_color; - result_items.push_back(std::move(body_item)); - prev_user_id = messages[i].user_id; - } + auto body_item = std::make_unique<BodyItem>(""); + body_item->set_author(user_info.display_name); + body_item->set_description(messages[i].body); + if(!messages[i].thumbnail_url.empty()) + body_item->thumbnail_url = messages[i].thumbnail_url; + else if(!messages[i].url.empty()) + body_item->thumbnail_url = messages[i].url; + else + body_item->thumbnail_url = user_info.avatar_url; + // TODO: Show image thumbnail inline instead of url to image and showing it as the thumbnail of the body item + body_item->url = messages[i].url; + body_item->author_color = user_info.display_name_color; + result_items.push_back(std::move(body_item)); } } |