mirror of https://github.com/M66B/FairEmail.git
Simplified resolving styles and images
This commit is contained in:
parent
33e0ad5d8c
commit
24bc2e7002
|
@ -563,18 +563,14 @@ public class MessageHelper {
|
||||||
|
|
||||||
// When sending message
|
// When sending message
|
||||||
if (identity != null && send) {
|
if (identity != null && send) {
|
||||||
boolean save = false;
|
|
||||||
|
|
||||||
for (Element child : document.body().children())
|
for (Element child : document.body().children())
|
||||||
if (!TextUtils.isEmpty(child.text()) &&
|
if (!TextUtils.isEmpty(child.text()) &&
|
||||||
TextUtils.isEmpty(child.attr("fairemail"))) {
|
TextUtils.isEmpty(child.attr("fairemail"))) {
|
||||||
String old = child.attr("style");
|
String old = child.attr("style");
|
||||||
String style = HtmlHelper.mergeStyles(
|
String style = HtmlHelper.mergeStyles(
|
||||||
"font-family:" + compose_font, old);
|
"font-family:" + compose_font, old);
|
||||||
if (!old.equals(style)) {
|
if (!old.equals(style))
|
||||||
save = true;
|
|
||||||
child.attr("style", style);
|
child.attr("style", style);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
document.select("div[fairemail=signature]").removeAttr("fairemail");
|
document.select("div[fairemail=signature]").removeAttr("fairemail");
|
||||||
|
@ -602,30 +598,30 @@ public class MessageHelper {
|
||||||
if (TextUtils.isEmpty(type))
|
if (TextUtils.isEmpty(type))
|
||||||
type = "image/*";
|
type = "image/*";
|
||||||
|
|
||||||
EntityAttachment attachment = new EntityAttachment();
|
String cid = BuildConfig.APPLICATION_ID + ".content." + Math.abs(source.hashCode());
|
||||||
attachment.message = message.id;
|
String acid = "<" + cid + ">";
|
||||||
attachment.sequence = db.attachment().getAttachmentSequence(message.id) + 1;
|
|
||||||
attachment.name = name;
|
|
||||||
attachment.type = type;
|
|
||||||
attachment.disposition = Part.INLINE;
|
|
||||||
attachment.cid = null;
|
|
||||||
attachment.size = null;
|
|
||||||
attachment.progress = 0;
|
|
||||||
|
|
||||||
attachment.id = db.attachment().insertAttachment(attachment);
|
if (db.attachment().getAttachment(message.id, acid) == null) {
|
||||||
|
EntityAttachment attachment = new EntityAttachment();
|
||||||
|
attachment.message = message.id;
|
||||||
|
attachment.sequence = db.attachment().getAttachmentSequence(message.id) + 1;
|
||||||
|
attachment.name = name;
|
||||||
|
attachment.type = type;
|
||||||
|
attachment.disposition = Part.INLINE;
|
||||||
|
attachment.cid = acid;
|
||||||
|
attachment.size = null;
|
||||||
|
attachment.progress = 0;
|
||||||
|
attachment.id = db.attachment().insertAttachment(attachment);
|
||||||
|
|
||||||
String cid = BuildConfig.APPLICATION_ID + "." + attachment.id;
|
attachment.size = Helper.copy(context, uri, attachment.getFile(context));
|
||||||
attachment.cid = "<" + BuildConfig.APPLICATION_ID + "." + attachment.id + ">";
|
attachment.progress = null;
|
||||||
db.attachment().setCid(attachment.id, attachment.cid);
|
attachment.available = true;
|
||||||
|
db.attachment().setDownloaded(attachment.id, attachment.size);
|
||||||
|
|
||||||
attachment.size = Helper.copy(context, uri, attachment.getFile(context));
|
attachments.add(attachment);
|
||||||
attachment.progress = null;
|
}
|
||||||
attachment.available = true;
|
|
||||||
db.attachment().setDownloaded(attachment.id, attachment.size);
|
|
||||||
|
|
||||||
attachments.add(attachment);
|
|
||||||
img.attr("src", "cid:" + cid);
|
img.attr("src", "cid:" + cid);
|
||||||
save = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
db.setTransactionSuccessful();
|
db.setTransactionSuccessful();
|
||||||
|
@ -634,9 +630,6 @@ public class MessageHelper {
|
||||||
} finally {
|
} finally {
|
||||||
db.endTransaction();
|
db.endTransaction();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save)
|
|
||||||
Helper.writeText(message.getFile(context), document.html());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// multipart/mixed
|
// multipart/mixed
|
||||||
|
|
Loading…
Reference in New Issue