diff --git a/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java b/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java index d0eb2bf2c0..782b62a043 100644 --- a/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java +++ b/app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java @@ -32,6 +32,7 @@ import com.sun.mail.iap.Argument; import com.sun.mail.iap.Response; import com.sun.mail.imap.IMAPFolder; import com.sun.mail.imap.IMAPMessage; +import com.sun.mail.imap.IMAPStore; import com.sun.mail.imap.protocol.IMAPProtocol; import com.sun.mail.imap.protocol.IMAPResponse; @@ -451,7 +452,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback rules, State state) throws MessagingException, IOException { long uid = ifolder.getUID(imessage); try { - return _synchronizeMessage(context, account, folder, uid, imessage, browsed, download, rules, state); + return _synchronizeMessage(context, account, folder, uid, istore, imessage, browsed, download, rules, state); } catch (MessagingException ex) { // https://javaee.github.io/javamail/FAQ#imapserverbug if (MessageHelper.retryRaw(ex)) try { @@ -1980,7 +1981,7 @@ class Core { file.delete(); Log.i(folder.name + " synchronizing again uid=" + uid); - return _synchronizeMessage(context, account, folder, uid, imessage, browsed, download, rules, state); + return _synchronizeMessage(context, account, folder, uid, istore, imessage, browsed, download, rules, state); } catch (MessagingException ex1) { if (MessageHelper.retryRaw(ex1)) Log.e(ex1); @@ -1993,8 +1994,8 @@ class Core { private static EntityMessage _synchronizeMessage( Context context, - EntityAccount account, EntityFolder folder, - long uid, MimeMessage imessage, + EntityAccount account, EntityFolder folder, long uid, + IMAPStore istore, MimeMessage imessage, boolean browsed, boolean download, List rules, State state) throws MessagingException, IOException { @@ -2141,6 +2142,24 @@ class Core { message.warning = Helper.formatThrowable(ex, false); } + if (message.total != null && message.total == 0) + try { + if (istore.hasCapability("ID")) { + Map id = new LinkedHashMap<>(); + id.put("name", context.getString(R.string.app_name)); + id.put("version", BuildConfig.VERSION_NAME); + Map sid = istore.id(id); + if (sid != null) { + StringBuilder sb = new StringBuilder(); + for (String key : sid.keySet()) + sb.append(" ").append(key).append("=").append(sid.get(key)); + Log.e("Empty message" + sb.toString()); + } + } + } catch (Throwable ex) { + Log.w(ex); + } + try { db.beginTransaction(); diff --git a/app/src/main/java/eu/faircode/email/MessageHelper.java b/app/src/main/java/eu/faircode/email/MessageHelper.java index a8468c76cd..195e9a8a9f 100644 --- a/app/src/main/java/eu/faircode/email/MessageHelper.java +++ b/app/src/main/java/eu/faircode/email/MessageHelper.java @@ -747,8 +747,8 @@ public class MessageHelper { Long getSize() throws MessagingException { long size = imessage.getSize(); - if (size == 0) - throw new MessagingException("Message empty"); + //if (size == 0) + // throw new MessagingException("Message empty"); return (size < 0 ? null : size); }