Commit 37b4cc40 authored by Francisco Cunha's avatar Francisco Cunha

P4A-776 - Fix outgoing mails rating being set incorrectly

parent abac1543
......@@ -1739,14 +1739,14 @@ public class MessagingController implements Sync.MessageToSendCallback, KeyImpor
|| message.getFrom().length > 0 && message.getFrom()[0].getAddress() == null))
) {
MimeMessage decryptedMessage = alreadyDecrypted ? ((MimeMessage) message) : result.msg;
if (message.getFolder().getName().equals(account.getSentFolderName())
|| message.getFolder().getName().equals(account.getDraftsFolderName())) {
decryptedMessage.setHeader(MimeHeader.HEADER_PEP_RATING, PEpUtils.ratingToString(pEpProvider.getRating(message)));
} else {
decryptedMessage.setHeader(MimeHeader.HEADER_PEP_RATING, PEpUtils.ratingToString(result.rating));
}
decryptedMessage.setUid(message.getUid()); // sync UID so we know our mail...
// sync UID so we know our mail
decryptedMessage.setUid(message.getUid());
// get rating depending on being an outgoing message
Rating ratingToSave = PEpUtils.shouldUseOutgoingRating(message, account, result.rating)
? pEpProvider.getRating(message)
: result.rating;
decryptedMessage.setHeader(MimeHeader.HEADER_PEP_RATING, PEpUtils.ratingToString(ratingToSave));
// Store the updated message locally
final LocalMessage localMessage = localFolder.storeSmallMessage(decryptedMessage, new Runnable() {
......
......@@ -472,6 +472,10 @@ public class PEpUtils {
|| message.getFolder().getName().equals(account.getOutboxFolderName());
}
public static boolean shouldUseOutgoingRating(Message message, Account account, Rating rating) {
return isMessageOnOutgoingFolder(message, account) && !isRatingUnsecure(rating);
}
public static Message generateKeyImportRequest(Context context, PEpProvider pEp, Account account,
boolean ispEp, boolean encrypted) throws MessagingException {
foundation.pEp.jniadapter.Message result;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment