aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2017-09-24 21:43:47 +0200
committerChristian Schneppe <christian@pix-art.de>2017-09-24 21:43:47 +0200
commit76beff245abef47c952bc59516cc88a69cce2878 (patch)
treee72db5bf175de4dc66a49c1c04863c0d5400918e
parentdf2203b155c988bd96b4cfa69bdaa2a5c2e90dd8 (diff)
select presence if necessary when resending file
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java21
1 files changed, 18 insertions, 3 deletions
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();