synchronize message body changes for message correction
This commit is contained in:
parent
f8b1e8098c
commit
1eb776f39c
|
@ -104,6 +104,7 @@ public class PgpDecryptionService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void executeApi(Message message) {
|
private void executeApi(Message message) {
|
||||||
|
synchronized (message) {
|
||||||
Intent params = new Intent();
|
Intent params = new Intent();
|
||||||
params.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
|
params.setAction(OpenPgpApi.ACTION_DECRYPT_VERIFY);
|
||||||
if (message.getType() == Message.TYPE_TEXT) {
|
if (message.getType() == Message.TYPE_TEXT) {
|
||||||
|
@ -151,7 +152,7 @@ public class PgpDecryptionService {
|
||||||
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
|
switch (result.getIntExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR)) {
|
||||||
case OpenPgpApi.RESULT_CODE_SUCCESS:
|
case OpenPgpApi.RESULT_CODE_SUCCESS:
|
||||||
URL url = message.getFileParams().url;
|
URL url = message.getFileParams().url;
|
||||||
mXmppConnectionService.getFileBackend().updateFileParams(message,url);
|
mXmppConnectionService.getFileBackend().updateFileParams(message, url);
|
||||||
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
|
message.setEncryption(Message.ENCRYPTION_DECRYPTED);
|
||||||
inputFile.delete();
|
inputFile.delete();
|
||||||
mXmppConnectionService.getFileBackend().updateMediaScanner(outputFile);
|
mXmppConnectionService.getFileBackend().updateMediaScanner(outputFile);
|
||||||
|
@ -174,6 +175,7 @@ public class PgpDecryptionService {
|
||||||
mXmppConnectionService.updateMessage(message);
|
mXmppConnectionService.updateMessage(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
notifyIfPending(message);
|
notifyIfPending(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -468,6 +468,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
||||||
&& replacedMessage.getTrueCounterpart().equals(message.getTrueCounterpart());
|
&& replacedMessage.getTrueCounterpart().equals(message.getTrueCounterpart());
|
||||||
if (fingerprintsMatch && (trueCountersMatch || !conversationMultiMode)) {
|
if (fingerprintsMatch && (trueCountersMatch || !conversationMultiMode)) {
|
||||||
Log.d(Config.LOGTAG, "replaced message '" + replacedMessage.getBody() + "' with '" + message.getBody() + "'");
|
Log.d(Config.LOGTAG, "replaced message '" + replacedMessage.getBody() + "' with '" + message.getBody() + "'");
|
||||||
|
synchronized (replacedMessage) {
|
||||||
final String uuid = replacedMessage.getUuid();
|
final String uuid = replacedMessage.getUuid();
|
||||||
replacedMessage.setUuid(UUID.randomUUID().toString());
|
replacedMessage.setUuid(UUID.randomUUID().toString());
|
||||||
replacedMessage.setBody(message.getBody());
|
replacedMessage.setBody(message.getBody());
|
||||||
|
@ -486,6 +487,7 @@ public class MessageParser extends AbstractParser implements OnMessagePacketRece
|
||||||
conversation.getAccount().getPgpDecryptionService().discard(replacedMessage);
|
conversation.getAccount().getPgpDecryptionService().discard(replacedMessage);
|
||||||
conversation.getAccount().getPgpDecryptionService().decrypt(replacedMessage, false);
|
conversation.getAccount().getPgpDecryptionService().decrypt(replacedMessage, false);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": received message correction but verification didn't check out");
|
Log.d(Config.LOGTAG,account.getJid().toBareJid()+": received message correction but verification didn't check out");
|
||||||
|
|
Loading…
Reference in New Issue