Check if message expunged/deleted on fetch

This commit is contained in:
M66B 2020-07-16 20:11:07 +02:00
parent c6ed38bafe
commit d55750f3c1
1 changed files with 6 additions and 2 deletions

View File

@ -1087,7 +1087,7 @@ class Core {
private static void onFetch(Context context, JSONArray jargs, EntityFolder folder, IMAPStore istore, IMAPFolder ifolder, State state) throws JSONException, MessagingException, IOException {
long uid = jargs.getLong(0);
if (uid < 0)
throw new MessageRemovedException("uid");
throw new MessageRemovedException(folder.name + " fetch uid=" + uid);
DB db = DB.getInstance(context);
EntityAccount account = db.account().getAccount(folder.account);
@ -1099,7 +1099,11 @@ class Core {
MimeMessage imessage = (MimeMessage) ifolder.getMessageByUID(uid);
if (imessage == null)
throw new MessageRemovedException();
throw new MessageRemovedException(folder.name + " fetch not found uid=" + uid);
if (imessage.isExpunged())
throw new MessageRemovedException(folder.name + " fetch expunged uid=" + uid);
if (imessage.isSet(Flags.Flag.DELETED))
throw new MessageRemovedException(folder.name + " fetch deleted uid=" + uid);
try {
FetchProfile fp = new FetchProfile();