run through sendMessage() procedure instead of taking shortcut after returning from TrustKeys

The shortcut didn’t take care of message edits and some other things
This commit is contained in:
Daniel Gultsch 2018-10-03 23:23:44 +02:00
parent 23282484d6
commit a34033dea3
1 changed files with 6 additions and 9 deletions

View File

@ -721,11 +721,15 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
commitAttachments(); commitAttachments();
return; 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; final Conversation conversation = this.conversation;
if (body.length() == 0 || conversation == null) { if (body.length() == 0 || conversation == null) {
return; return;
} }
if (conversation.getNextEncryption() == Message.ENCRYPTION_AXOLOTL && trustKeysIfNeeded(REQUEST_TRUST_KEYS_TEXT)) {
return;
}
final Message message; final Message message;
if (conversation.getCorrectingMessage() == null) { if (conversation.getCorrectingMessage() == null) {
message = new Message(conversation, body, conversation.getNextEncryption()); message = new Message(conversation, body, conversation.getNextEncryption());
@ -747,11 +751,6 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
case Message.ENCRYPTION_PGP: case Message.ENCRYPTION_PGP:
sendPgpMessage(message); sendPgpMessage(message);
break; break;
case Message.ENCRYPTION_AXOLOTL:
if (!trustKeysIfNeeded(REQUEST_TRUST_KEYS_TEXT)) {
sendMessage(message);
}
break;
default: default:
sendMessage(message); sendMessage(message);
} }
@ -814,9 +813,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
private void handlePositiveActivityResult(int requestCode, final Intent data) { private void handlePositiveActivityResult(int requestCode, final Intent data) {
switch (requestCode) { switch (requestCode) {
case REQUEST_TRUST_KEYS_TEXT: case REQUEST_TRUST_KEYS_TEXT:
final String body = this.binding.textinput.getText().toString(); sendMessage();
Message message = new Message(conversation, body, conversation.getNextEncryption());
sendMessage(message);
break; break;
case REQUEST_TRUST_KEYS_ATTACHMENTS: case REQUEST_TRUST_KEYS_ATTACHMENTS:
commitAttachments(); commitAttachments();