mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-22 07:42:52 +00:00
Check for message removed exception
This commit is contained in:
parent
a4dccc09d0
commit
e68142de47
1 changed files with 12 additions and 14 deletions
|
@ -419,11 +419,14 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
public void messagesRemoved(MessageCountEvent e) {
|
||||
try {
|
||||
Log.i(Helper.TAG, folder.name + " messages removed");
|
||||
for (Message imessage : e.getMessages()) {
|
||||
for (Message imessage : e.getMessages())
|
||||
try {
|
||||
long uid = ffolder.getUID(imessage);
|
||||
DB db = DB.getInstance(ServiceSynchronize.this);
|
||||
db.message().deleteMessage(folder.id, uid);
|
||||
Log.i(Helper.TAG, "Deleted uid=" + uid);
|
||||
} catch (MessageRemovedException ex) {
|
||||
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
|
@ -804,10 +807,12 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
|
||||
List<Message> added = new ArrayList<>();
|
||||
for (Message imessage : imessages)
|
||||
if (!imessage.isExpunged() && !imessage.isSet(Flags.Flag.DELETED)) {
|
||||
try {
|
||||
long uid = ifolder.getUID(imessage);
|
||||
if (!uids.remove(uid))
|
||||
added.add(imessage);
|
||||
} catch (MessageRemovedException ex) {
|
||||
Log.w(Helper.TAG, folder.name + " " + ex + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
|
||||
// Delete local messages not at remote
|
||||
|
@ -845,13 +850,6 @@ public class ServiceSynchronize extends LifecycleService {
|
|||
fp.add(IMAPFolder.FetchProfileItem.FLAGS);
|
||||
ifolder.fetch(new Message[]{imessage}, fp);
|
||||
|
||||
boolean expunged = imessage.isExpunged();
|
||||
boolean deleted = (!expunged && imessage.isSet(Flags.Flag.DELETED));
|
||||
if (expunged || deleted) {
|
||||
Log.i(Helper.TAG, "Message gone expunged=" + expunged + " deleted=" + deleted);
|
||||
return;
|
||||
}
|
||||
|
||||
long uid = ifolder.getUID(imessage);
|
||||
Log.i(Helper.TAG, folder.name + " sync uid=" + uid);
|
||||
|
||||
|
|
Loading…
Reference in a new issue