From 945bdee8a88179ef4afa0ede8ddba1acfbab5c92 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 12 Nov 2019 13:30:24 +0100 Subject: [PATCH] Cleanup --- app/src/main/java/eu/faircode/email/Core.java | 25 ------------------- .../java/eu/faircode/email/DaoAttachment.java | 5 ---- 2 files changed, 30 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/Core.java b/app/src/main/java/eu/faircode/email/Core.java index e4ce8d128a..2d3d0b4c89 100644 --- a/app/src/main/java/eu/faircode/email/Core.java +++ b/app/src/main/java/eu/faircode/email/Core.java @@ -58,7 +58,6 @@ import com.sun.mail.util.MessageRemovedIOException; import org.json.JSONArray; import org.json.JSONException; -import org.jsoup.nodes.Element; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; @@ -97,7 +96,6 @@ import javax.mail.FolderNotFoundException; import javax.mail.Message; import javax.mail.MessageRemovedException; import javax.mail.MessagingException; -import javax.mail.Part; import javax.mail.Session; import javax.mail.Store; import javax.mail.UIDFolder; @@ -1100,9 +1098,6 @@ class Core { parts.isPlainOnly(), HtmlHelper.getPreview(body), parts.getWarnings(message.warning)); - - if (!TextUtils.isEmpty(body)) - fixAttachments(context, message.id, body); } private static void onAttachment(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, EntityOperation op, IMAPFolder ifolder) throws JSONException, MessagingException, IOException { @@ -2222,9 +2217,6 @@ class Core { Log.i(folder.name + " inline downloaded message id=" + message.id + " size=" + message.size + "/" + (body == null ? null : body.length())); - if (!TextUtils.isEmpty(body)) - fixAttachments(context, message.id, body); - Long size = parts.getBodySize(); if (TextUtils.isEmpty(body) && size != null && size > 0) reportEmptyMessage(context, account, istore); @@ -2552,9 +2544,6 @@ class Core { Log.i(folder.name + " downloaded message id=" + message.id + " size=" + message.size + "/" + (body == null ? null : body.length())); - if (!TextUtils.isEmpty(body)) - fixAttachments(context, message.id, body); - Long size = parts.getBodySize(); if (TextUtils.isEmpty(body) && size != null && size > 0) reportEmptyMessage(context, account, istore); @@ -2594,20 +2583,6 @@ class Core { } } - private static void fixAttachments(Context context, long id, String body) { - DB db = DB.getInstance(context); - for (Element element : JsoupEx.parse(body).select("img")) { - String src = element.attr("src"); - if (src.startsWith("cid:")) { - EntityAttachment attachment = db.attachment().getAttachment(id, "<" + src.substring(4) + ">"); - if (attachment != null && !attachment.isInline()) { - Log.i("Setting attachment type to inline id=" + attachment.id); - db.attachment().setDisposition(attachment.id, Part.INLINE); - } - } - } - } - static void notifyMessages(Context context, List messages, Map> groupNotifying) { if (messages == null) messages = new ArrayList<>(); diff --git a/app/src/main/java/eu/faircode/email/DaoAttachment.java b/app/src/main/java/eu/faircode/email/DaoAttachment.java index 8f6516ab69..03062e9afa 100644 --- a/app/src/main/java/eu/faircode/email/DaoAttachment.java +++ b/app/src/main/java/eu/faircode/email/DaoAttachment.java @@ -87,11 +87,6 @@ public interface DaoAttachment { " WHERE id = :id") void setError(long id, String error); - @Query("UPDATE attachment" + - " SET disposition = :disposition" + - " WHERE id = :id") - void setDisposition(long id, String disposition); - @Query("UPDATE attachment" + " SET cid = :cid" + " WHERE id = :id")