diff options
author | iNPUTmice <daniel@gultsch.de> | 2014-06-06 20:06:06 +0200 |
---|---|---|
committer | iNPUTmice <daniel@gultsch.de> | 2014-06-06 20:06:06 +0200 |
commit | df7f7c5c4e133d7b055a3c146e1c8bc577178939 (patch) | |
tree | 83bcc6c344a85baad0aa4c4de376350b1d2cf9e7 | |
parent | 3fd371cd53fe49f3ee0d13ba1c3877e974ab4500 (diff) |
do not just simply resend images
-rw-r--r-- | src/eu/siacs/conversations/services/XmppConnectionService.java | 44 |
1 files changed, 24 insertions, 20 deletions
diff --git a/src/eu/siacs/conversations/services/XmppConnectionService.java b/src/eu/siacs/conversations/services/XmppConnectionService.java index 55e727f9..81ac77c2 100644 --- a/src/eu/siacs/conversations/services/XmppConnectionService.java +++ b/src/eu/siacs/conversations/services/XmppConnectionService.java @@ -725,27 +725,31 @@ public class XmppConnectionService extends Service { private void resendMessage(Message message) { Account account = message.getConversation().getAccount(); - MessagePacket packet = null; - if (message.getEncryption() == Message.ENCRYPTION_NONE) { - packet = prepareMessagePacket(account, message, null); - } else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) { - packet = prepareMessagePacket(account, message, null); - packet.setBody("This is an XEP-0027 encryted message"); - if (message.getEncryptedBody() == null) { - markMessage(message, Message.STATUS_SEND_FAILED); - return; + if (message.getType() == Message.TYPE_TEXT) { + MessagePacket packet = null; + if (message.getEncryption() == Message.ENCRYPTION_NONE) { + packet = prepareMessagePacket(account, message, null); + } else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) { + packet = prepareMessagePacket(account, message, null); + packet.setBody("This is an XEP-0027 encryted message"); + if (message.getEncryptedBody() == null) { + markMessage(message, Message.STATUS_SEND_FAILED); + return; + } + packet.addChild("x", "jabber:x:encrypted").setContent( + message.getEncryptedBody()); + } else if (message.getEncryption() == Message.ENCRYPTION_PGP) { + packet = prepareMessagePacket(account, message, null); + packet.setBody("This is an XEP-0027 encryted message"); + packet.addChild("x", "jabber:x:encrypted").setContent( + message.getBody()); } - packet.addChild("x", "jabber:x:encrypted").setContent( - message.getEncryptedBody()); - } else if (message.getEncryption() == Message.ENCRYPTION_PGP) { - packet = prepareMessagePacket(account, message, null); - packet.setBody("This is an XEP-0027 encryted message"); - packet.addChild("x", "jabber:x:encrypted").setContent( - message.getBody()); - } - if (packet != null) { - account.getXmppConnection().sendMessagePacket(packet); - markMessage(message, Message.STATUS_SEND); + if (packet != null) { + account.getXmppConnection().sendMessagePacket(packet); + markMessage(message, Message.STATUS_SEND); + } + } else if (message.getType() == Message.TYPE_IMAGE) { + //TODO: send images } } |