From 6cd06c7cbbfd66b019fe2de3ca18cb2bcc3153a4 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 26 Aug 2024 14:28:18 -0500 Subject: [PATCH] When MUC strips image, show body (cherry picked from commit 28874921bffd0520063239e78c616fc0fba9bf5e) --- src/main/java/eu/siacs/conversations/entities/Message.java | 5 +++++ .../eu/siacs/conversations/http/HttpDownloadConnection.java | 2 +- .../siacs/conversations/services/XmppConnectionService.java | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index 3b8ab24841..2b3db844cf 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -1471,7 +1471,12 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable } public synchronized void resetFileParams() { + this.oob = false; this.fileParams = null; + this.transferable = null; + this.payloads.removeAll(getSims()); + clearFallbacks(Namespace.OOB); + setType(isPrivateMessage() ? TYPE_PRIVATE : TYPE_TEXT); } public synchronized void setFileParams(FileParams fileParams) { diff --git a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java index 731b31dae5..50339be378 100644 --- a/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java +++ b/src/main/java/eu/siacs/conversations/http/HttpDownloadConnection.java @@ -339,7 +339,7 @@ public class HttpDownloadConnection implements Transferable { FileBackend.updateFileParams(message, fileParams.url, size); mXmppConnectionService.databaseBackend.updateMessage(message, true); file.setExpectedSize(size); - message.resetFileParams(); + message.setFileParams(null); if (mHttpConnectionManager.hasStoragePermission() && size <= mHttpConnectionManager.getAutoAcceptFileSize() && mXmppConnectionService.isDataSaverDisabled()) { diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 152018e03a..65e56d8e37 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -5359,8 +5359,8 @@ public class XmppConnectionService extends Service { message.setSubject(subject); message.setThread(thread); if (attachments != null && attachments.isEmpty()) { - message.setFileParams(null); message.setRelativeFilePath(null); + message.resetFileParams(); } markMessage(message, status, null, true); } else {