Fixed updating hash of drafts

pull/178/head
M66B 5 years ago
parent b4b281c50a
commit 73f67215ab

@ -318,7 +318,7 @@ class Core {
break; break;
case EntityOperation.ADD: case EntityOperation.ADD:
onAdd(context, jargs, folder, message, (IMAPStore) istore, (IMAPFolder) ifolder); onAdd(context, jargs, folder, message, (IMAPStore) istore, (IMAPFolder) ifolder, state);
break; break;
case EntityOperation.MOVE: case EntityOperation.MOVE:
@ -683,7 +683,7 @@ class Core {
imessage.setFlags(flags, set); imessage.setFlags(flags, set);
} }
private static void onAdd(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, IMAPStore istore, IMAPFolder ifolder) throws MessagingException, IOException { private static void onAdd(Context context, JSONArray jargs, EntityFolder folder, EntityMessage message, IMAPStore istore, IMAPFolder ifolder, State state) throws MessagingException, IOException {
// Add message // Add message
DB db = DB.getInstance(context); DB db = DB.getInstance(context);
@ -764,19 +764,14 @@ class Core {
if (folder.id.equals(message.folder)) { if (folder.id.equals(message.folder)) {
// Some providers do not list the new message yet // Some providers do not list the new message yet
Long newuid = findUid(ifolder, message.msgid, true); Long newuid = findUid(ifolder, message.msgid, true);
if (newuid != null && (message.uid == null || newuid > message.uid)) { if (newuid != null && (message.uid == null || newuid > message.uid))
message.uid = newuid; try {
Log.i(folder.name + " appended uid=" + message.uid); JSONArray fargs = new JSONArray();
db.message().setMessageUid(message.id, message.uid); fargs.put(newuid);
onFetch(context, fargs, folder, istore, ifolder, state);
EntityIdentity identity = matchIdentity(context, folder, message); } catch (JSONException ex) {
message.identity = (identity == null ? null : identity.id); Log.e(ex);
db.message().setMessageIdentity(message.id, message.identity); }
List<EntityRule> rules = db.rule().getEnabledRules(folder.id);
runRules(context, imessage, message, rules);
updateContactInfo(context, folder, message);
}
ifolder.expunge(); ifolder.expunge();
} else { } else {
@ -2410,7 +2405,7 @@ class Core {
" keywords=" + TextUtils.join(" ", keywords)); " keywords=" + TextUtils.join(" ", keywords));
} }
if (message.hash == null) { if (message.hash == null || EntityFolder.DRAFTS.equals(folder.type)) {
update = true; update = true;
message.hash = helper.getHash(); message.hash = helper.getHash();
Log.i(folder.name + " updated id=" + message.id + " uid=" + message.uid + " hash=" + message.hash); Log.i(folder.name + " updated id=" + message.id + " uid=" + message.uid + " hash=" + message.hash);

Loading…
Cancel
Save