diff options
Diffstat (limited to '')
4 files changed, 12 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Message.java b/src/main/java/de/pixart/messenger/entities/Message.java index b82ae887b..9a529877b 100644 --- a/src/main/java/de/pixart/messenger/entities/Message.java +++ b/src/main/java/de/pixart/messenger/entities/Message.java @@ -72,7 +72,7 @@ public class Message extends AbstractEntity { public static final String READ_BY_MARKERS = "readByMarkers"; public static final String MARKABLE = "markable"; public static final String ME_COMMAND = "/me"; - + public static final String ERROR_MESSAGE_CANCELLED = "eu.siacs.conversations.cancelled"; public boolean markable = false; protected String conversationUuid; diff --git a/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java b/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java index a88298417..dfe616c4d 100644 --- a/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java +++ b/src/main/java/de/pixart/messenger/http/HttpUploadConnection.java @@ -40,7 +40,7 @@ public class HttpUploadConnection implements Transferable { private final SlotRequester mSlotRequester; private final Method method; private final boolean mUseTor; - private boolean canceled = false; + private boolean cancelled = false; private boolean delayed = false; private DownloadableFile file; private Message message; @@ -83,13 +83,13 @@ public class HttpUploadConnection implements Transferable { @Override public void cancel() { - this.canceled = true; + this.cancelled = true; } private void fail(String errorMessage) { mHttpConnectionManager.finishUploadConnection(this); message.setTransferable(null); - mXmppConnectionService.markMessage(message, Message.STATUS_SEND_FAILED, errorMessage); + mXmppConnectionService.markMessage(message, Message.STATUS_SEND_FAILED, cancelled ? Message.ERROR_MESSAGE_CANCELLED : errorMessage); } public void init(Message message, boolean delay) { @@ -128,7 +128,7 @@ public class HttpUploadConnection implements Transferable { this.mSlotRequester.request(method, account, file, mime, md5, new SlotRequester.OnSlotRequested() { @Override public void success(SlotRequester.Slot slot) { - if (!canceled) { + if (!cancelled) { HttpUploadConnection.this.slot = slot; new Thread(HttpUploadConnection.this::upload).start(); } @@ -181,7 +181,7 @@ public class HttpUploadConnection implements Transferable { transmitted = 0; int count; byte[] buffer = new byte[4096]; - while (((count = innerInputStream.read(buffer)) != -1) && !canceled) { + while (((count = innerInputStream.read(buffer)) != -1) && !cancelled) { transmitted += count; os.write(buffer, 0, count); mHttpConnectionManager.updateConversationUi(false); diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java index 788c8553e..bc65fd68a 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -275,7 +275,11 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie if (isResendable && file.exists()) { info = getContext().getString(R.string.send_failed_resend); } else { - info = getContext().getString(R.string.send_failed); + if (Message.ERROR_MESSAGE_CANCELLED.equals(message.getErrorMessage())) { + info = getContext().getString(R.string.cancelled); + } else { + info = getContext().getString(R.string.send_failed); + } } error = true; break; diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index 331737eeb..a00750708 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -832,5 +832,6 @@ <string name="security_violation_not_attaching_file">File omitted due to security violation.</string> <string name="delete_file_dialog">Delete file</string> <string name="delete_file_dialog_msg">Are you sure you want to delete this file?\n\n<b>Warning:</b> This will not delete copies of this file that are stored on other devices or servers. </string> + <string name="cancelled">cancelled</string> </resources> |