|
|
@ -2299,12 +2299,33 @@ class Core {
|
|
|
|
? imessages.length
|
|
|
|
? imessages.length
|
|
|
|
: Math.min(imessages.length, account.max_messages));
|
|
|
|
: Math.min(imessages.length, account.max_messages));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
boolean sync = true;
|
|
|
|
|
|
|
|
if (imessages.length > 0 && folder.last_sync_count != null &&
|
|
|
|
|
|
|
|
imessages.length == folder.last_sync_count) {
|
|
|
|
|
|
|
|
// Check if last message known as new messages indicator
|
|
|
|
|
|
|
|
MessageHelper helper = new MessageHelper((MimeMessage) imessages[imessages.length - 1], context);
|
|
|
|
|
|
|
|
String msgid = helper.getMessageID();
|
|
|
|
|
|
|
|
if (msgid != null) {
|
|
|
|
|
|
|
|
int count = db.message().countMessageByMsgId(folder.id, msgid);
|
|
|
|
|
|
|
|
if (count == 1) {
|
|
|
|
|
|
|
|
Log.i(account.name + " POP having last msgid=" + msgid);
|
|
|
|
|
|
|
|
sync = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
EntityLog.log(context, account.name + " POP" +
|
|
|
|
EntityLog.log(context, account.name + " POP" +
|
|
|
|
" device=" + ids.size() +
|
|
|
|
" device=" + ids.size() +
|
|
|
|
" server=" + imessages.length +
|
|
|
|
" server=" + imessages.length +
|
|
|
|
" max=" + max + "/" + account.max_messages +
|
|
|
|
" max=" + max + "/" + account.max_messages +
|
|
|
|
|
|
|
|
" last=" + folder.last_sync_count +
|
|
|
|
|
|
|
|
" sync=" + sync +
|
|
|
|
" uidl=" + hasUidl);
|
|
|
|
" uidl=" + hasUidl);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
folder.last_sync_count = imessages.length;
|
|
|
|
|
|
|
|
db.folder().setFolderLastSyncCount(folder.id, folder.last_sync_count);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sync) {
|
|
|
|
// Index IDs
|
|
|
|
// Index IDs
|
|
|
|
Map<String, String> uidlMsgId = new HashMap<>();
|
|
|
|
Map<String, String> uidlMsgId = new HashMap<>();
|
|
|
|
for (TupleUidl id : ids) {
|
|
|
|
for (TupleUidl id : ids) {
|
|
|
@ -2550,6 +2571,7 @@ class Core {
|
|
|
|
((POP3Message) imessage).invalidate(true);
|
|
|
|
((POP3Message) imessage).invalidate(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
db.folder().setFolderLastSync(folder.id, new Date().getTime());
|
|
|
|
db.folder().setFolderLastSync(folder.id, new Date().getTime());
|
|
|
|
EntityLog.log(context, account.name + " POP done");
|
|
|
|
EntityLog.log(context, account.name + " POP done");
|
|
|
|