|
|
@ -614,7 +614,7 @@ class Core {
|
|
|
|
if (TextUtils.isEmpty(message.msgid))
|
|
|
|
if (TextUtils.isEmpty(message.msgid))
|
|
|
|
throw new IllegalArgumentException("Message without msgid for " + op.name);
|
|
|
|
throw new IllegalArgumentException("Message without msgid for " + op.name);
|
|
|
|
|
|
|
|
|
|
|
|
Long uid = findUid(ifolder, message.msgid, false);
|
|
|
|
Long uid = findUid(context, ifolder, message.msgid, false);
|
|
|
|
if (uid == null)
|
|
|
|
if (uid == null)
|
|
|
|
throw new IllegalArgumentException("Message not found for " + op.name + " folder=" + folder.name);
|
|
|
|
throw new IllegalArgumentException("Message not found for " + op.name + " folder=" + folder.name);
|
|
|
|
|
|
|
|
|
|
|
@ -623,7 +623,7 @@ class Core {
|
|
|
|
message.uid = uid;
|
|
|
|
message.uid = uid;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static Long findUid(IMAPFolder ifolder, String msgid, boolean purge) throws MessagingException {
|
|
|
|
private static Long findUid(Context context, IMAPFolder ifolder, String msgid, boolean purge) throws MessagingException {
|
|
|
|
String name = ifolder.getFullName();
|
|
|
|
String name = ifolder.getFullName();
|
|
|
|
Log.i(name + " searching for msgid=" + msgid);
|
|
|
|
Log.i(name + " searching for msgid=" + msgid);
|
|
|
|
|
|
|
|
|
|
|
@ -657,7 +657,9 @@ class Core {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (purged)
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
boolean perform_expunge = prefs.getBoolean("perform_expunge", true);
|
|
|
|
|
|
|
|
if (purged && perform_expunge)
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
ifolder.expunge();
|
|
|
|
ifolder.expunge();
|
|
|
|
} catch (MessagingException ex) {
|
|
|
|
} catch (MessagingException ex) {
|
|
|
@ -833,6 +835,10 @@ class Core {
|
|
|
|
if (imessage == null)
|
|
|
|
if (imessage == null)
|
|
|
|
throw new MessageRemovedException();
|
|
|
|
throw new MessageRemovedException();
|
|
|
|
imessage.setFlag(Flags.Flag.DELETED, true);
|
|
|
|
imessage.setFlag(Flags.Flag.DELETED, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
boolean perform_expunge = prefs.getBoolean("perform_expunge", true);
|
|
|
|
|
|
|
|
if (perform_expunge)
|
|
|
|
ifolder.expunge();
|
|
|
|
ifolder.expunge();
|
|
|
|
} catch (MessagingException ex) {
|
|
|
|
} catch (MessagingException ex) {
|
|
|
|
Log.w(ex);
|
|
|
|
Log.w(ex);
|
|
|
@ -971,7 +977,7 @@ class Core {
|
|
|
|
|
|
|
|
|
|
|
|
// Some providers do not list the new message yet
|
|
|
|
// Some providers do not list the new message yet
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Long found = findUid(ifolder, message.msgid, true);
|
|
|
|
Long found = findUid(context, ifolder, message.msgid, true);
|
|
|
|
if (found != null)
|
|
|
|
if (found != null)
|
|
|
|
if (newuid == null)
|
|
|
|
if (newuid == null)
|
|
|
|
newuid = found;
|
|
|
|
newuid = found;
|
|
|
@ -1102,6 +1108,10 @@ class Core {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
for (Message imessage : map.keySet())
|
|
|
|
for (Message imessage : map.keySet())
|
|
|
|
imessage.setFlag(Flags.Flag.DELETED, true);
|
|
|
|
imessage.setFlag(Flags.Flag.DELETED, true);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
boolean perform_expunge = prefs.getBoolean("perform_expunge", true);
|
|
|
|
|
|
|
|
if (perform_expunge)
|
|
|
|
ifolder.expunge();
|
|
|
|
ifolder.expunge();
|
|
|
|
} catch (MessageRemovedException ex) {
|
|
|
|
} catch (MessageRemovedException ex) {
|
|
|
|
Log.w(ex);
|
|
|
|
Log.w(ex);
|
|
|
@ -1126,7 +1136,7 @@ class Core {
|
|
|
|
if (TextUtils.isEmpty(message.msgid))
|
|
|
|
if (TextUtils.isEmpty(message.msgid))
|
|
|
|
throw new IllegalArgumentException("move: msgid missing");
|
|
|
|
throw new IllegalArgumentException("move: msgid missing");
|
|
|
|
|
|
|
|
|
|
|
|
Long uid = findUid(itarget, message.msgid, false);
|
|
|
|
Long uid = findUid(context, itarget, message.msgid, false);
|
|
|
|
if (uid == null)
|
|
|
|
if (uid == null)
|
|
|
|
throw new IllegalArgumentException("move: uid not found");
|
|
|
|
throw new IllegalArgumentException("move: uid not found");
|
|
|
|
|
|
|
|
|
|
|
@ -1354,8 +1364,12 @@ class Core {
|
|
|
|
Log.w(ex);
|
|
|
|
Log.w(ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (deleted)
|
|
|
|
if (deleted) {
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
boolean perform_expunge = prefs.getBoolean("perform_expunge", true);
|
|
|
|
|
|
|
|
if (perform_expunge)
|
|
|
|
ifolder.expunge(); // NO EXPUNGE failed.
|
|
|
|
ifolder.expunge(); // NO EXPUNGE failed.
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
db.message().deleteMessage(message.id);
|
|
|
|
db.message().deleteMessage(message.id);
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
@ -1958,6 +1972,9 @@ class Core {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
Log.i(folder.name + " purge deleted");
|
|
|
|
Log.i(folder.name + " purge deleted");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
boolean perform_expunge = prefs.getBoolean("perform_expunge", true);
|
|
|
|
|
|
|
|
if (perform_expunge)
|
|
|
|
ifolder.expunge();
|
|
|
|
ifolder.expunge();
|
|
|
|
Log.i(folder.name + " purge expunged");
|
|
|
|
Log.i(folder.name + " purge expunged");
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
@ -2301,6 +2318,7 @@ class Core {
|
|
|
|
boolean sync_flagged = prefs.getBoolean("sync_flagged", false);
|
|
|
|
boolean sync_flagged = prefs.getBoolean("sync_flagged", false);
|
|
|
|
boolean sync_kept = prefs.getBoolean("sync_kept", true);
|
|
|
|
boolean sync_kept = prefs.getBoolean("sync_kept", true);
|
|
|
|
boolean delete_unseen = prefs.getBoolean("delete_unseen", false);
|
|
|
|
boolean delete_unseen = prefs.getBoolean("delete_unseen", false);
|
|
|
|
|
|
|
|
boolean perform_expunge = prefs.getBoolean("perform_expunge", true);
|
|
|
|
|
|
|
|
|
|
|
|
Log.i(folder.name + " start sync after=" + sync_days + "/" + keep_days +
|
|
|
|
Log.i(folder.name + " start sync after=" + sync_days + "/" + keep_days +
|
|
|
|
" force=" + force +
|
|
|
|
" force=" + force +
|
|
|
@ -2437,7 +2455,7 @@ class Core {
|
|
|
|
db.folder().setFolderError(folder.id, Log.formatThrowable(ex));
|
|
|
|
db.folder().setFolderError(folder.id, Log.formatThrowable(ex));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (expunge > 0)
|
|
|
|
if (expunge > 0 && perform_expunge)
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
Log.i(folder.name + " expunging=" + expunge);
|
|
|
|
Log.i(folder.name + " expunging=" + expunge);
|
|
|
|
ifolder.expunge();
|
|
|
|
ifolder.expunge();
|
|
|
|