Update message size on message content changes

pull/153/head
M66B 6 years ago
parent 02ad2b4189
commit d13cb219e7

@ -626,6 +626,8 @@ class Core {
Helper.writeText(message.getFile(context), body);
db.message().setMessageContent(message.id, true,
HtmlHelper.getPreview(body), parts.getWarnings(message.warning));
updateMessageSize(context, message.id);
}
private static void onAttachment(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, EntityOperation op, IMAPFolder ifolder) throws JSONException, MessagingException, IOException {
@ -648,6 +650,8 @@ class Core {
MessageHelper helper = new MessageHelper((MimeMessage) imessage);
MessageHelper.MessageParts parts = helper.getMessageParts();
parts.downloadAttachment(context, sequence - 1, attachment.id);
updateMessageSize(context, message.id);
}
static void onSynchronizeFolders(Context context, EntityAccount account, Store istore, State state) throws MessagingException {
@ -1462,7 +1466,7 @@ class Core {
}
}
private static void updateMessageSize(Context context, long id) {
static void updateMessageSize(Context context, long id) {
DB db = DB.getInstance(context);
EntityMessage message = db.message().getMessage(id);

@ -267,6 +267,8 @@ public class EntityRule {
Helper.writeText(reply.getFile(context), body);
db.message().setMessageContent(reply.id, true, HtmlHelper.getPreview(body), null);
Core.updateMessageSize(context, reply.id);
EntityOperation.queue(context, db, reply, EntityOperation.SEND);
}

@ -1827,6 +1827,8 @@ public class FragmentCompose extends FragmentBase {
db.message().setMessageContent(draft.id, true, HtmlHelper.getPreview(body), null);
Core.updateMessageSize(context, draft.id);
// Write reference text
if (ref != null && ref.content) {
String refBody = String.format("<p>%s %s:</p>\n<blockquote>%s</blockquote>",
@ -2180,6 +2182,8 @@ public class FragmentCompose extends FragmentBase {
db.message().updateMessage(draft);
Helper.writeText(draft.getFile(context), body);
db.message().setMessageContent(draft.id, true, HtmlHelper.getPreview(body), null);
Core.updateMessageSize(context, draft.id);
}
// Remove unused inline images

@ -433,6 +433,8 @@ public class Helper {
attachOperations(context, draft.id, 5);
attachLogcat(context, draft.id, 6);
Core.updateMessageSize(context, draft.id);
EntityOperation.queue(context, db, draft, EntityOperation.ADD);
db.setTransactionSuccessful();

Loading…
Cancel
Save