Open EionRobb opened 8 years ago
Original comment by tofurky (Bitbucket: tofurky, GitHub: tofurky).
i took a look at this and it seems like it'd be tricky to fix.
the previous 50 messages are fetched upon opening the conversation using hangouts_got_conversation_events(). each of these messages is then passed to hangouts_process_conversation_event().
in hangouts_got_conversation_events(), images are fetched using a call to to purple_http_get(), which uses asynchronous http requests to download the images and executes hangouts_got_http_image_for_conv() for each image after it's finished downloading.
the hangouts_got_http_image_for_conv() callback then inserts the images into the conversation using purple_conversation_write_message().
this means that most likely the image callback and subsequent insertion of the image message into the conversation will occur AFTER all of the other text-only messages have been inserted.
i tried to wrap my head around a way to fix this - the only thing i can come up with is a major rework of the initial fetch of 50 messages, which queues up all results, and then inserts them sequentially, in-order, once all the dependent attachments have been downloaded.
i did see the PURPLE_MESSAGE_DELAYED flag, which at first seemed promising, but it didn't seem to make any difference in which order the messages appeared in the conversation. i guess it just disables notifications and/or pounces for messages inserted with that flag.
@EionRobb, if there is a way other than queuing everything up to address this, i'd be happy to give it a try. the whole queue thing seems like it'd be too much for me to take on, though.
thanks!
Original comment by Sheree Grier (Bitbucket: Shaeree, GitHub: Shaeree).
This isn't a minor issue for me. My friends sometimes send me NSFW images over the weekend, and when I get to work and open Pidgin, there's the NSFW images right at the bottom for everyone to see (my monitor faces a hallway) even though they should be scrolled off the top. Sadface.
Original comment by tofurky (Bitbucket: tofurky, GitHub: tofurky).
here's a simple patch that adds an advanced option under the hangouts account settings which defaults to true.
to use, uncheck "Fetch attachment history (e.g. images) when opening conversation", save, and restart pidgin. opening conversations will then load messages but not attachments.
it hasn't crashed on me yet ;) but no idea if it's the "right" way to do it.
if it's something worth adding i can open a PR, otherwise those affected feel free to apply the patch and rebuild/reinstall.
#!c
diff -r cccf2f62d439 hangouts_conversation.c
--- a/hangouts_conversation.c Sun Dec 02 22:34:01 2018 +1300
+++ b/hangouts_conversation.c Thu Jan 24 23:29:22 2019 -0500
@@ -529,6 +529,10 @@
// Ignore join/parts when loading history
if (!event->membership_change) {
+ if(event->chat_message != NULL && event->chat_message->message_content->n_attachment && !purple_account_get_bool(ha->account, "fetch_attachment_history", TRUE)) {
+ purple_debug_info("hangouts", "skipping attachment due to fetch_attachment_history disabled\n");
+ continue;
+ }
//Send event to the hangouts_events.c slaughterhouse
hangouts_process_conversation_event(ha, conversation, event, response->response_header->current_server_time);
}
diff -r cccf2f62d439 libhangouts.c
--- a/libhangouts.c Sun Dec 02 22:34:01 2018 +1300
+++ b/libhangouts.c Thu Jan 24 23:29:22 2019 -0500
@@ -92,6 +92,9 @@
option = purple_account_option_bool_new(N_("Hide self from buddy list (requires reconnect)"), "hide_self", FALSE);
account_options = g_list_append(account_options, option);
+
+ option = purple_account_option_bool_new(N_("Fetch attachment history (e.g. images) when opening conversation"), "fetch_attachment_history", TRUE);
+ account_options = g_list_append(account_options, option);
return account_options;
}
Original report by Anonymous.
In group chat, someone sends a picture. At the moment everything is alright.
But when I come back to this group chat, the picture is at the end of the history where it should be somewhere in the middle...
You may find an example in the attachment file.
Regards