do not just simply resend images

This commit is contained in:
iNPUTmice 2014-06-06 20:06:06 +02:00
parent 3fd371cd53
commit df7f7c5c4e
1 changed files with 24 additions and 20 deletions

View File

@ -725,27 +725,31 @@ public class XmppConnectionService extends Service {
private void resendMessage(Message message) { private void resendMessage(Message message) {
Account account = message.getConversation().getAccount(); Account account = message.getConversation().getAccount();
MessagePacket packet = null; if (message.getType() == Message.TYPE_TEXT) {
if (message.getEncryption() == Message.ENCRYPTION_NONE) { MessagePacket packet = null;
packet = prepareMessagePacket(account, message, null); if (message.getEncryption() == Message.ENCRYPTION_NONE) {
} else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) { packet = prepareMessagePacket(account, message, null);
packet = prepareMessagePacket(account, message, null); } else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTED) {
packet.setBody("This is an XEP-0027 encryted message"); packet = prepareMessagePacket(account, message, null);
if (message.getEncryptedBody() == null) { packet.setBody("This is an XEP-0027 encryted message");
markMessage(message, Message.STATUS_SEND_FAILED); if (message.getEncryptedBody() == null) {
return; 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( if (packet != null) {
message.getEncryptedBody()); account.getXmppConnection().sendMessagePacket(packet);
} else if (message.getEncryption() == Message.ENCRYPTION_PGP) { markMessage(message, Message.STATUS_SEND);
packet = prepareMessagePacket(account, message, null); }
packet.setBody("This is an XEP-0027 encryted message"); } else if (message.getType() == Message.TYPE_IMAGE) {
packet.addChild("x", "jabber:x:encrypted").setContent( //TODO: send images
message.getBody());
}
if (packet != null) {
account.getXmppConnection().sendMessagePacket(packet);
markMessage(message, Message.STATUS_SEND);
} }
} }