~singpolyma/cheogram-android

15dfa7f404768fbf0eb20d4f6dbdd1ee0799f7d2 — Stephen Paul Weber 3 months ago ecec584
Reset html when resetting body (on MUC reflection)
M src/main/java/eu/siacs/conversations/entities/Message.java => src/main/java/eu/siacs/conversations/entities/Message.java +6 -0
@@ 563,6 563,12 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable 
        }
    }

    public synchronized void setHtml(Element html) {
        final Element oldHtml = getHtml(true);
        if (oldHtml != null) this.payloads.remove(oldHtml);
        if (html != null) addPayload(html);
    }

    public synchronized void setBody(String body) {
        this.body = body;
        this.isGeoUri = null;

M src/main/java/eu/siacs/conversations/parser/MessageParser.java => src/main/java/eu/siacs/conversations/parser/MessageParser.java +1 -1
@@ 587,7 587,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
                if (conversation.getMucOptions().isSelf(counterpart)) {
                    status = Message.STATUS_SEND_RECEIVED;
                    isCarbon = true; //not really carbon but received from another resource
                    if (mXmppConnectionService.markMessage(conversation, remoteMsgId, status, serverMsgId, body)) {
                    if (mXmppConnectionService.markMessage(conversation, remoteMsgId, status, serverMsgId, body, html)) {
                        return;
                    } else if (remoteMsgId == null || Config.IGNORE_ID_REWRITE_IN_MUC) {
                        if (body != null) {

M src/main/java/eu/siacs/conversations/services/XmppConnectionService.java => src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +3 -2
@@ 4517,10 4517,10 @@ public class XmppConnectionService extends Service {
    }

    public boolean markMessage(final Conversation conversation, final String uuid, final int status, final String serverMessageId) {
        return markMessage(conversation, uuid, status, serverMessageId, null);
        return markMessage(conversation, uuid, status, serverMessageId, null, null);
    }

    public boolean markMessage(final Conversation conversation, final String uuid, final int status, final String serverMessageId, final LocalizedContent body) {
    public boolean markMessage(final Conversation conversation, final String uuid, final int status, final String serverMessageId, final LocalizedContent body, final Element html) {
        if (uuid == null) {
            return false;
        } else {


@@ 4533,6 4533,7 @@ public class XmppConnectionService extends Service {
                        && message.isTypeText()
                        && isBodyModified(message, body)) {
                    message.setBody(body.content);
                    message.setHtml(html);
                    if (body.count > 1) {
                        message.setBodyLanguage(body.language);
                    }