diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index fa1819124..e50ffc73c 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -14,6 +14,7 @@ import org.json.JSONException; import java.lang.ref.WeakReference; import java.util.ArrayList; +import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Set; @@ -633,9 +634,8 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable message.getEncryption() != Message.ENCRYPTION_PGP && message.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED && this.getType() == message.getType() && - //this.getStatus() == message.getStatus() && isStatusMergeable(this.getStatus(), message.getStatus()) && - this.getEncryption() == message.getEncryption() && + isEncryptionMergeable(this.getEncryption(),message.getEncryption()) && this.getCounterpart() != null && this.getCounterpart().equals(message.getCounterpart()) && this.edited() == message.edited() && @@ -668,6 +668,12 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable ); } + private static boolean isEncryptionMergeable(final int a, final int b) { + return a == b + && Arrays.asList(ENCRYPTION_NONE, ENCRYPTION_DECRYPTED, ENCRYPTION_AXOLOTL) + .contains(a); + } + public void setCounterparts(List counterparts) { this.counterparts = counterparts; } diff --git a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java index 0f121b0b3..7965a4e31 100644 --- a/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/main/java/eu/siacs/conversations/services/XmppConnectionService.java @@ -4128,7 +4128,7 @@ public class XmppConnectionService extends Service { } public void updateAccountUi() { - for (OnAccountUpdate listener : threadSafeList(this.mOnAccountUpdates)) { + for (final OnAccountUpdate listener : threadSafeList(this.mOnAccountUpdates)) { listener.onAccountUpdate(); } }