From 76beff245abef47c952bc59516cc88a69cce2878 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Sun, 24 Sep 2017 21:43:47 +0200 Subject: select presence if necessary when resending file --- .../pixart/messenger/ui/ConversationFragment.java | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/main/java/de/pixart') diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index d6e3f49da..ff023997f 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -781,10 +781,25 @@ public class ConversationFragment extends Fragment implements EditMessage.Keyboa } } - public void resendMessage(Message message) { - if (message.getType() == Message.TYPE_FILE || message.getType() == Message.TYPE_IMAGE) { + public void resendMessage(final Message message) { + if (message.isFileOrImage()) { DownloadableFile file = activity.xmppConnectionService.getFileBackend().getFile(message); - if (!file.exists()) { + if (file.exists()) { + final Conversation conversation = message.getConversation(); + final XmppConnection xmppConnection = conversation.getAccount().getXmppConnection(); + if (!message.hasFileOnRemoteHost() + && xmppConnection != null + && !xmppConnection.getFeatures().httpUpload(message.getFileParams().size)) { + activity.selectPresence(conversation, new OnPresenceSelected() { + @Override + public void onPresenceSelected() { + message.setCounterpart(conversation.getNextCounterpart()); + activity.xmppConnectionService.resendFailedMessages(message); + } + }); + return; + } + } else { Toast.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show(); message.setTransferable(new TransferablePlaceholder(Transferable.STATUS_DELETED)); activity.updateConversationList(); -- cgit v1.2.3