|
|
|
@ -3025,34 +3025,40 @@ class Core {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
EntityLog.log(context, account.name + " POP" +
|
|
|
|
|
" device=" + ids.size() +
|
|
|
|
|
" server=" + imessages.length +
|
|
|
|
|
" max=" + max + "/" + account.max_messages +
|
|
|
|
|
" reversed=" + reversed +
|
|
|
|
|
" last=" + folder.last_sync_count +
|
|
|
|
|
" sync=" + sync +
|
|
|
|
|
" uidl=" + hasUidl);
|
|
|
|
|
|
|
|
|
|
if (sync) {
|
|
|
|
|
// Index IDs
|
|
|
|
|
int flagged = 0;
|
|
|
|
|
Map<String, TupleUidl> uidlTuple = new HashMap<>();
|
|
|
|
|
Map<String, TupleUidl> msgIdTuple = new HashMap<>();
|
|
|
|
|
for (TupleUidl id : ids) {
|
|
|
|
|
if (id.ui_flagged && !id.ui_hide)
|
|
|
|
|
flagged++;
|
|
|
|
|
|
|
|
|
|
if (id.uidl != null) {
|
|
|
|
|
if (uidlTuple.containsKey(id.uidl))
|
|
|
|
|
Log.w(account.name + " POP duplicate uidl/msgid=" + id.uidl + "/" + id.msgid);
|
|
|
|
|
uidlTuple.put(id.uidl, id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, TupleUidl> msgIdTuple = new HashMap<>();
|
|
|
|
|
for (TupleUidl id : ids)
|
|
|
|
|
if (id.msgid != null) {
|
|
|
|
|
if (msgIdTuple.containsKey(id.msgid))
|
|
|
|
|
Log.w(account.name + " POP duplicate msgid/uidl=" + id.msgid + "/" + id.uidl);
|
|
|
|
|
msgIdTuple.put(id.msgid, id);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
max = Math.min(max + flagged, imessages.length);
|
|
|
|
|
|
|
|
|
|
EntityLog.log(context, account.name + " POP" +
|
|
|
|
|
" device=" + ids.size() +
|
|
|
|
|
" server=" + imessages.length +
|
|
|
|
|
" flagged=" + flagged +
|
|
|
|
|
" max=" + max + "/" + account.max_messages +
|
|
|
|
|
" reversed=" + reversed +
|
|
|
|
|
" last=" + folder.last_sync_count +
|
|
|
|
|
" sync=" + sync +
|
|
|
|
|
" uidl=" + hasUidl);
|
|
|
|
|
|
|
|
|
|
if (sync) {
|
|
|
|
|
// Fetch UIDLs
|
|
|
|
|
if (hasUidl) {
|
|
|
|
|
FetchProfile ifetch = new FetchProfile();
|
|
|
|
@ -3424,8 +3430,8 @@ class Core {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (account.max_messages != null && !account.leave_on_device) {
|
|
|
|
|
int hidden = db.message().setMessagesUiHide(folder.id, Math.abs(account.max_messages));
|
|
|
|
|
int deleted = db.message().deleteMessagesKeep(folder.id, Math.abs(account.max_messages) + 100);
|
|
|
|
|
int hidden = db.message().setMessagesUiHide(folder.id, Math.abs(account.max_messages) + flagged);
|
|
|
|
|
int deleted = db.message().deleteMessagesKeep(folder.id, Math.abs(account.max_messages) + flagged + 100);
|
|
|
|
|
EntityLog.log(context, account.name + " POP" +
|
|
|
|
|
" cleanup max=" + account.max_messages + "" +
|
|
|
|
|
" hidden=" + hidden + " deleted=" + deleted);
|
|
|
|
|