Skip decoding attachment for outgoing messages

pull/212/head
M66B 2 years ago
parent 56a4591d9d
commit 57c19b05f3

@ -2078,7 +2078,7 @@ class Core {
MessageHelper.MessageParts parts = helper.getMessageParts(); MessageHelper.MessageParts parts = helper.getMessageParts();
// Download attachment // Download attachment
parts.downloadAttachment(context, attachment); parts.downloadAttachment(context, attachment, folder);
if (attachment.size != null) if (attachment.size != null)
EntityLog.log(context, "Operation attachment size=" + attachment.size); EntityLog.log(context, "Operation attachment size=" + attachment.size);
@ -2137,7 +2137,7 @@ class Core {
MessageHelper.MessageParts parts = helper.getMessageParts(); MessageHelper.MessageParts parts = helper.getMessageParts();
// Download attachment // Download attachment
parts.downloadAttachment(context, attachment); parts.downloadAttachment(context, attachment, folder);
if (attachment.size != null) if (attachment.size != null)
EntityLog.log(context, "Operation attachment size=" + attachment.size); EntityLog.log(context, "Operation attachment size=" + attachment.size);
@ -3386,7 +3386,7 @@ class Core {
try { try {
for (EntityAttachment attachment : parts.getAttachments()) for (EntityAttachment attachment : parts.getAttachments())
if (attachment.subsequence == null) if (attachment.subsequence == null)
parts.downloadAttachment(context, attachment); parts.downloadAttachment(context, attachment, folder);
} catch (Throwable ex) { } catch (Throwable ex) {
Log.w(ex); Log.w(ex);
} }
@ -5155,7 +5155,7 @@ class Core {
if (state.getNetworkState().isUnmetered() || if (state.getNetworkState().isUnmetered() ||
(attachment.size != null && attachment.size < maxSize)) (attachment.size != null && attachment.size < maxSize))
try { try {
parts.downloadAttachment(context, attachment); parts.downloadAttachment(context, attachment, folder);
if (stats != null && attachment.size != null) if (stats != null && attachment.size != null)
stats.attachments += attachment.size; stats.attachments += attachment.size;
} catch (Throwable ex) { } catch (Throwable ex) {

@ -8658,7 +8658,7 @@ public class FragmentMessages extends FragmentBase
remote.sequence = index + 1; remote.sequence = index + 1;
remote.id = db.attachment().insertAttachment(remote); remote.id = db.attachment().insertAttachment(remote);
try { try {
parts.downloadAttachment(context, index, remote); parts.downloadAttachment(context, index, remote, null);
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
} }
@ -9369,7 +9369,7 @@ public class FragmentMessages extends FragmentBase
Log.i("s/mime attachment=" + remote); Log.i("s/mime attachment=" + remote);
try { try {
parts.downloadAttachment(context, index, remote); parts.downloadAttachment(context, index, remote, null);
} catch (Throwable ex) { } catch (Throwable ex) {
Log.e(ex); Log.e(ex);
} }

@ -3952,7 +3952,7 @@ public class MessageHelper {
return null; return null;
} }
void downloadAttachment(Context context, EntityAttachment local) throws IOException, MessagingException { void downloadAttachment(Context context, EntityAttachment local, EntityFolder folder) throws IOException, MessagingException {
List<EntityAttachment> remotes = getAttachments(); List<EntityAttachment> remotes = getAttachments();
// Some servers order attachments randomly // Some servers order attachments randomly
@ -4014,10 +4014,10 @@ public class MessageHelper {
if (index < 0) if (index < 0)
throw new IllegalArgumentException("Attachment not found"); throw new IllegalArgumentException("Attachment not found");
downloadAttachment(context, index, local); downloadAttachment(context, index, local, folder);
} }
void downloadAttachment(Context context, int index, EntityAttachment local) throws MessagingException, IOException { void downloadAttachment(Context context, int index, EntityAttachment local, EntityFolder folder) throws MessagingException, IOException {
Log.i("downloading attachment id=" + local.id + " index=" + index + " " + local); Log.i("downloading attachment id=" + local.id + " index=" + index + " " + local);
// Get data // Get data
@ -4075,6 +4075,7 @@ public class MessageHelper {
throw ex; throw ex;
} }
if (folder == null || !EntityFolder.isOutgoing(folder.type)) {
if ("message/rfc822".equals(local.type)) if ("message/rfc822".equals(local.type))
decodeRfc822(context, local, 1); decodeRfc822(context, local, 1);
@ -4091,6 +4092,7 @@ public class MessageHelper {
decodeOutlook(context, local, 1); decodeOutlook(context, local, 1);
} }
} }
}
private void decodeEncrypted(Context context, EntityAttachment local, AttachmentPart apart) throws MessagingException, IOException { private void decodeEncrypted(Context context, EntityAttachment local, AttachmentPart apart) throws MessagingException, IOException {
ContentType ct = new ContentType(apart.part.getContentType()); ContentType ct = new ContentType(apart.part.getContentType());

Loading…
Cancel
Save