pull/162/head
M66B 5 years ago
parent 03f97c7e3b
commit 91e9212289

@ -1295,13 +1295,13 @@ class Core {
Log.i(folder.name + " sent orphans=" + orphans.size());
for (EntityMessage orphan : orphans) {
Log.i(folder.name + " adding orphan id=" + orphan.id);
if (orphan.content)
if (orphan.content && orphan.ui_hide == 0L)
EntityOperation.queue(context, orphan, EntityOperation.ADD);
}
}
} else {
// Delete not synchronized messages without uid
db.message().deleteOrphans(folder.id);
}
int count = ifolder.getMessageCount();
db.folder().setFolderTotal(folder.id, count < 0 ? null : count);

@ -188,13 +188,17 @@ public class EntityMessage implements Serializable {
return addresses.toArray(new Address[0]);
}
File getFile(Context context) {
static File getFile(Context context, Long id) {
File dir = new File(context.getFilesDir(), "messages");
if (!dir.exists())
dir.mkdir();
return new File(dir, id.toString());
}
File getFile(Context context) {
return getFile(context, id);
}
File getFile(Context context, int revision) {
File dir = new File(context.getFilesDir(), "revision");
if (!dir.exists())

@ -1017,6 +1017,8 @@ public class MessageHelper {
private void getMessageParts(Part part, MessageParts parts, boolean pgp) throws IOException, FolderClosedException {
try {
if (BuildConfig.DEBUG)
Log.i("Part class=" + part.getClass() + " type=" + part.getContentType());
if (part.isMimeType("multipart/*")) {
Multipart multipart;
Object content = part.getContent();

@ -375,14 +375,8 @@ public class ServiceSend extends ServiceBase {
message.error = null;
message.id = db.message().insertMessage(message);
MessageHelper.MessageParts parts = helper.getMessageParts();
String body = parts.getHtml(this);
Helper.writeText(message.getFile(this), body);
db.message().setMessageContent(message.id,
true,
parts.isPlainOnly(),
HtmlHelper.getPreview(body),
parts.getWarnings(message.warning));
message.getFile(this).createNewFile();
EntityAttachment.copy(this, id, message.id);
sid = message.id;
message.id = id;
@ -412,6 +406,16 @@ public class ServiceSend extends ServiceBase {
db.message().deleteMessage(message.id);
if (sid != null) {
MessageHelper helper = new MessageHelper(imessage);
MessageHelper.MessageParts parts = helper.getMessageParts();
String body = parts.getHtml(this);
Helper.writeText(EntityMessage.getFile(this, sid), body);
db.message().setMessageContent(message.id,
true,
parts.isPlainOnly(),
HtmlHelper.getPreview(body),
parts.getWarnings(message.warning));
db.message().setMessageSent(sid, time);
db.message().setMessageUiHide(sid, 0L);
}

Loading…
Cancel
Save