|
|
@ -1618,7 +1618,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
public void messagesAdded(MessageCountEvent e) {
|
|
|
|
public void messagesAdded(MessageCountEvent e) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
wlMessage.acquire();
|
|
|
|
wlMessage.acquire();
|
|
|
|
fetch(folder, ifolder, e.getMessages(), false, "added");
|
|
|
|
fetch(folder, ifolder, e.getMessages(), false, false, "added");
|
|
|
|
Thread.sleep(FETCH_YIELD_DURATION);
|
|
|
|
Thread.sleep(FETCH_YIELD_DURATION);
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.e(folder.name, ex);
|
|
|
|
Log.e(folder.name, ex);
|
|
|
@ -1634,7 +1634,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
public void messagesRemoved(MessageCountEvent e) {
|
|
|
|
public void messagesRemoved(MessageCountEvent e) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
wlMessage.acquire();
|
|
|
|
wlMessage.acquire();
|
|
|
|
fetch(folder, ifolder, e.getMessages(), true, "removed");
|
|
|
|
fetch(folder, ifolder, e.getMessages(), false, true, "removed");
|
|
|
|
Thread.sleep(FETCH_YIELD_DURATION);
|
|
|
|
Thread.sleep(FETCH_YIELD_DURATION);
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.e(folder.name, ex);
|
|
|
|
Log.e(folder.name, ex);
|
|
|
@ -1656,9 +1656,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
wlMessage.acquire();
|
|
|
|
wlMessage.acquire();
|
|
|
|
Message imessage = e.getMessage();
|
|
|
|
Message imessage = e.getMessage();
|
|
|
|
if (imessage instanceof IMAPMessage)
|
|
|
|
fetch(folder, ifolder, new Message[]{imessage}, true, false, "changed");
|
|
|
|
((IMAPMessage) imessage).invalidateHeaders();
|
|
|
|
|
|
|
|
fetch(folder, ifolder, new Message[]{imessage}, false, "changed");
|
|
|
|
|
|
|
|
Thread.sleep(FETCH_YIELD_DURATION);
|
|
|
|
Thread.sleep(FETCH_YIELD_DURATION);
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
Log.e(folder.name, ex);
|
|
|
|
Log.e(folder.name, ex);
|
|
|
@ -2367,7 +2365,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void fetch(EntityFolder folder, IMAPFolder ifolder, Message[] messages, boolean deleted, String reason) throws MessagingException {
|
|
|
|
private void fetch(EntityFolder folder, IMAPFolder ifolder, Message[] messages, boolean invalidate, boolean deleted, String reason) throws MessagingException {
|
|
|
|
Log.i(folder.name + " " + messages.length + " messages " + reason);
|
|
|
|
Log.i(folder.name + " " + messages.length + " messages " + reason);
|
|
|
|
|
|
|
|
|
|
|
|
List<Long> uids = new ArrayList<>();
|
|
|
|
List<Long> uids = new ArrayList<>();
|
|
|
@ -2386,7 +2384,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
|
|
|
|
db.beginTransaction();
|
|
|
|
db.beginTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
for (long uid : uids)
|
|
|
|
for (long uid : uids)
|
|
|
|
EntityOperation.queue(this, folder, EntityOperation.FETCH, uid, deleted);
|
|
|
|
EntityOperation.queue(this, folder, EntityOperation.FETCH, uid, invalidate, deleted);
|
|
|
|
|
|
|
|
|
|
|
|
db.setTransactionSuccessful();
|
|
|
|
db.setTransactionSuccessful();
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|