From a34033dea36646dc15d6e9b7a9b56a7a1e26d26a Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 3 Oct 2018 23:23:44 +0200 Subject: [PATCH] run through sendMessage() procedure instead of taking shortcut after returning from TrustKeys MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shortcut didn’t take care of message edits and some other things --- .../conversations/ui/ConversationFragment.java | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java index 26c59003c..9555d9050 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationFragment.java @@ -721,11 +721,15 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke commitAttachments(); return; } - final String body = this.binding.textinput.getText().toString(); + final Editable text = this.binding.textinput.getText(); + final String body = text == null ? "" : text.toString(); final Conversation conversation = this.conversation; if (body.length() == 0 || conversation == null) { return; } + if (conversation.getNextEncryption() == Message.ENCRYPTION_AXOLOTL && trustKeysIfNeeded(REQUEST_TRUST_KEYS_TEXT)) { + return; + } final Message message; if (conversation.getCorrectingMessage() == null) { message = new Message(conversation, body, conversation.getNextEncryption()); @@ -747,11 +751,6 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke case Message.ENCRYPTION_PGP: sendPgpMessage(message); break; - case Message.ENCRYPTION_AXOLOTL: - if (!trustKeysIfNeeded(REQUEST_TRUST_KEYS_TEXT)) { - sendMessage(message); - } - break; default: sendMessage(message); } @@ -814,9 +813,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke private void handlePositiveActivityResult(int requestCode, final Intent data) { switch (requestCode) { case REQUEST_TRUST_KEYS_TEXT: - final String body = this.binding.textinput.getText().toString(); - Message message = new Message(conversation, body, conversation.getNextEncryption()); - sendMessage(message); + sendMessage(); break; case REQUEST_TRUST_KEYS_ATTACHMENTS: commitAttachments();