diff options
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/ConversationFragment.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index dfc150e5a..40cd257fb 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -1635,7 +1635,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke Transferable transferable = message.getTransferable(); if (transferable != null) { if (transferable instanceof TransferablePlaceholder && message.hasFileOnRemoteHost()) { - activity.xmppConnectionService.getHttpConnectionManager().createNewDownloadConnection(message, true); + createNewConnection(message); return; } if (!transferable.start()) { @@ -1643,10 +1643,18 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke Toast.makeText(getActivity(), R.string.not_connected_try_again, Toast.LENGTH_SHORT).show(); } } else if (message.treatAsDownloadable()) { - activity.xmppConnectionService.getHttpConnectionManager().createNewDownloadConnection(message, true); + createNewConnection(message); } } + private void createNewConnection(final Message message) { + if (!activity.xmppConnectionService.getHttpConnectionManager().checkConnection(message)) { + Toast.makeText(getActivity(), R.string.not_connected_try_again, Toast.LENGTH_SHORT).show(); + return; + } + activity.xmppConnectionService.getHttpConnectionManager().createNewDownloadConnection(message, true); + } + @SuppressLint("InflateParams") protected void clearHistoryDialog(final Conversation conversation) { AlertDialog.Builder builder = new AlertDialog.Builder(getActivity()); |