|
|
@ -1532,35 +1532,15 @@ class Core {
|
|
|
|
List<String> existing = db.message().getMsgIds(folder.id);
|
|
|
|
List<String> existing = db.message().getMsgIds(folder.id);
|
|
|
|
Log.i(folder.name + " POP existing=" + existing.size());
|
|
|
|
Log.i(folder.name + " POP existing=" + existing.size());
|
|
|
|
|
|
|
|
|
|
|
|
int count = 0;
|
|
|
|
|
|
|
|
for (Message imessage : imessages)
|
|
|
|
for (Message imessage : imessages)
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if (!state.isRunning())
|
|
|
|
if (!state.isRunning())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
MessageHelper helper = new MessageHelper((MimeMessage) imessage);
|
|
|
|
MessageHelper helper = new MessageHelper((MimeMessage) imessage);
|
|
|
|
|
|
|
|
String msgid = caps.containsKey("UIDL")
|
|
|
|
String msgid;
|
|
|
|
? ifolder.getUID(imessage)
|
|
|
|
if (caps.containsKey("UIDL")) {
|
|
|
|
: helper.getMessageID();
|
|
|
|
String uid = ifolder.getUID(imessage);
|
|
|
|
|
|
|
|
if (existing.contains(uid))
|
|
|
|
|
|
|
|
msgid = uid;
|
|
|
|
|
|
|
|
else {
|
|
|
|
|
|
|
|
msgid = helper.getMessageID();
|
|
|
|
|
|
|
|
if (existing.contains(msgid)) {
|
|
|
|
|
|
|
|
List<EntityMessage> messages = db.message().getMessagesByMsgId(account.id, msgid);
|
|
|
|
|
|
|
|
if (messages.size() == 1) {
|
|
|
|
|
|
|
|
messages.get(0).msgid = uid;
|
|
|
|
|
|
|
|
db.message().updateMessage(messages.get(0));
|
|
|
|
|
|
|
|
existing.remove(msgid);
|
|
|
|
|
|
|
|
existing.add(uid);
|
|
|
|
|
|
|
|
msgid = uid;
|
|
|
|
|
|
|
|
Log.w(folder.name + " POP update uid=" + uid + " msgid=" + msgid);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else
|
|
|
|
|
|
|
|
msgid = helper.getMessageID();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (TextUtils.isEmpty(msgid)) {
|
|
|
|
if (TextUtils.isEmpty(msgid)) {
|
|
|
|
Log.w(folder.name + " POP no message ID");
|
|
|
|
Log.w(folder.name + " POP no message ID");
|
|
|
@ -1573,6 +1553,7 @@ class Core {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
Log.i(folder.name + " POP sync=" + msgid);
|
|
|
|
Log.i(folder.name + " POP sync=" + msgid);
|
|
|
|
|
|
|
|
|
|
|
|
Long sent = helper.getSent();
|
|
|
|
Long sent = helper.getSent();
|
|
|
@ -1684,6 +1665,7 @@ class Core {
|
|
|
|
updateContactInfo(context, folder, message);
|
|
|
|
updateContactInfo(context, folder, message);
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
db.folder().setFolderError(folder.id, Log.formatThrowable(ex));
|
|
|
|
db.folder().setFolderError(folder.id, Log.formatThrowable(ex));
|
|
|
|
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
((POP3Message) imessage).invalidate(true);
|
|
|
|
((POP3Message) imessage).invalidate(true);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -1694,7 +1676,7 @@ class Core {
|
|
|
|
db.message().deleteMessage(folder.id, msgid);
|
|
|
|
db.message().deleteMessage(folder.id, msgid);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Log.i(folder.name + " done");
|
|
|
|
Log.i(folder.name + " POP done");
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
db.folder().setFolderSyncState(folder.id, null);
|
|
|
|
db.folder().setFolderSyncState(folder.id, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|