Fix images from another client in our account not being displayed right away
This commit is contained in:
parent
ef8fb0e94c
commit
65efaca6fd
|
@ -276,8 +276,13 @@ public class FileManager : StreamInteractionModule, Object {
|
|||
file_transfer.ourpart = stream_interactor.get_module(MucManager.IDENTITY).get_own_jid(conversation.counterpart, conversation.account) ?? conversation.account.bare_jid;
|
||||
file_transfer.direction = from.equals(file_transfer.ourpart) ? FileTransfer.DIRECTION_SENT : FileTransfer.DIRECTION_RECEIVED;
|
||||
} else {
|
||||
file_transfer.ourpart = conversation.account.full_jid;
|
||||
file_transfer.direction = from.equals_bare(file_transfer.ourpart) ? FileTransfer.DIRECTION_SENT : FileTransfer.DIRECTION_RECEIVED;
|
||||
if (from.equals_bare(conversation.account.bare_jid)) {
|
||||
file_transfer.ourpart = from;
|
||||
file_transfer.direction = FileTransfer.DIRECTION_SENT;
|
||||
} else {
|
||||
file_transfer.ourpart = conversation.account.full_jid;
|
||||
file_transfer.direction = FileTransfer.DIRECTION_RECEIVED;
|
||||
}
|
||||
}
|
||||
file_transfer.time = time;
|
||||
file_transfer.local_time = local_time;
|
||||
|
|
|
@ -108,7 +108,7 @@ public class FileWidget : SizeRequestBox {
|
|||
} catch (Error e) { }
|
||||
}
|
||||
|
||||
if (state != State.DEFAULT) {
|
||||
if (!show_image() && state != State.DEFAULT) {
|
||||
if (content != null) this.remove(content);
|
||||
FileDefaultWidget default_file_widget = new FileDefaultWidget();
|
||||
default_widget_controller = new FileDefaultWidgetController(default_file_widget);
|
||||
|
@ -121,8 +121,12 @@ public class FileWidget : SizeRequestBox {
|
|||
|
||||
private bool show_image() {
|
||||
if (file_transfer.mime_type == null) return false;
|
||||
if (file_transfer.state != FileTransfer.State.COMPLETE &&
|
||||
!(file_transfer.direction == FileTransfer.DIRECTION_SENT && file_transfer.state == FileTransfer.State.IN_PROGRESS)) {
|
||||
|
||||
// If the image is being sent by this client, we already have the file
|
||||
bool in_progress_from_us = file_transfer.direction == FileTransfer.DIRECTION_SENT &&
|
||||
file_transfer.ourpart.equals(file_transfer.account.full_jid) &&
|
||||
file_transfer.state == FileTransfer.State.IN_PROGRESS;
|
||||
if (file_transfer.state != FileTransfer.State.COMPLETE && !in_progress_from_us) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue