mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-14 04:53:22 +02:00
Improved empty message check
This commit is contained in:
@@ -2375,9 +2375,6 @@ class Core {
|
||||
}
|
||||
}
|
||||
|
||||
if (message.total != null && message.total == 0)
|
||||
reportEmptyMessage(context, state, account, istore);
|
||||
|
||||
try {
|
||||
db.beginTransaction();
|
||||
|
||||
@@ -2448,8 +2445,7 @@ class Core {
|
||||
Log.i(folder.name + " inline downloaded message id=" + message.id +
|
||||
" size=" + message.size + "/" + (body == null ? null : body.length()));
|
||||
|
||||
Long size = parts.getBodySize();
|
||||
if (TextUtils.isEmpty(body) && size != null && size > 0)
|
||||
if (TextUtils.isEmpty(body) && parts.hasBody())
|
||||
reportEmptyMessage(context, state, account, istore);
|
||||
}
|
||||
}
|
||||
@@ -2796,8 +2792,7 @@ class Core {
|
||||
Log.i(folder.name + " downloaded message id=" + message.id +
|
||||
" size=" + message.size + "/" + (body == null ? null : body.length()));
|
||||
|
||||
Long size = parts.getBodySize();
|
||||
if (TextUtils.isEmpty(body) && size != null && size > 0)
|
||||
if (TextUtils.isEmpty(body) && parts.hasBody())
|
||||
reportEmptyMessage(context, state, account, istore);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1458,6 +1458,20 @@ public class MessageHelper {
|
||||
return (html.size() == 0);
|
||||
}
|
||||
|
||||
boolean hasBody() throws MessagingException {
|
||||
List<Part> all = new ArrayList<>();
|
||||
all.addAll(plain);
|
||||
all.addAll(html);
|
||||
if (all.size() == 0)
|
||||
return true;
|
||||
|
||||
for (Part p : all)
|
||||
if (p.getSize() > 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Long getBodySize() throws MessagingException {
|
||||
Long size = null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user