~singpolyma/cheogram-android

3ec4ee9b89372069bee8d848dfc6bdbfcaeead81 — Stephen Paul Weber 1 year, 6 months ago d087f31
Allow null body for message

Be careful with this, but can at least be used for sending
M src/main/java/eu/siacs/conversations/entities/Message.java => src/main/java/eu/siacs/conversations/entities/Message.java +0 -3
@@ 531,9 531,6 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable 
    }

    public synchronized void setBody(String body) {
        if (body == null) {
            throw new Error("You should not set the message body to null");
        }
        this.body = body;
        this.isGeoUri = null;
        this.isEmojisOnly = null;

M src/main/java/eu/siacs/conversations/generator/MessageGenerator.java => src/main/java/eu/siacs/conversations/generator/MessageGenerator.java +1 -1
@@ 120,7 120,7 @@ public class MessageGenerator extends AbstractGenerator {

            packet.addChild("x", Namespace.OOB).addChild("url").setContent(fileParams.url);
        }
        packet.setBody(message.getQuoteableBody());
        if (message.getQuoteableBody() != null) packet.setBody(message.getQuoteableBody());
        return packet;
    }


M src/main/java/eu/siacs/conversations/services/XmppConnectionService.java => src/main/java/eu/siacs/conversations/services/XmppConnectionService.java +1 -1
@@ 1636,7 1636,7 @@ public class XmppConnectionService extends Service {
        }

        MessagePacket packet = null;
        final boolean addToConversation = !message.edited();
        final boolean addToConversation = !message.edited() && message.getQuoteableBody() != null;
        boolean saveInDb = addToConversation;
        message.setStatus(Message.STATUS_WAITING);