Map uidl/msgid

This commit is contained in:
M66B 2020-05-09 08:49:04 +02:00
parent f8c6487940
commit 33800c221b
4 changed files with 40 additions and 10 deletions

View File

@ -13,8 +13,8 @@ android {
applicationId "eu.faircode.email"
minSdkVersion 21
targetSdkVersion 29
versionCode 1148
versionName "1.1148"
versionCode 1149
versionName "1.1149"
archivesBaseName = "FairEmail-v$versionName"
// https://en.wikipedia.org/wiki/List_of_dinosaur_genera

View File

@ -1529,8 +1529,13 @@ class Core {
db.folder().setFolderSyncState(folder.id, "downloading");
List<String> uidls = db.message().getUidls(folder.id);
Log.i(folder.name + " POP existing=" + uidls.size());
List<TupleUidl> ids = db.message().getUidls(folder.id);
Log.i(folder.name + " POP existing=" + ids.size());
Map<String, TupleUidl> uidls = new HashMap<>();
for (TupleUidl id : ids)
if (id.uidl != null)
uidls.put(id.uidl, id);
for (Message imessage : imessages)
try {
@ -1547,7 +1552,7 @@ class Core {
continue;
}
if (uidls.contains(uidl)) {
if (uidls.containsKey(uidl)) {
uidls.remove(uidl);
Log.i(folder.name + " POP having=" + uidl);
continue;
@ -1671,9 +1676,9 @@ class Core {
}
if (!account.leave_on_device)
for (String msgid : uidls) {
Log.i(folder.name + " POP deleted=" + msgid);
db.message().deleteMessage(folder.id, msgid);
for (TupleUidl id : uidls.values()) {
Log.i(folder.name + " POP deleting=" + id.msgid);
db.message().deleteMessage(folder.id, id.msgid);
}
Log.i(folder.name + " POP done");

View File

@ -483,9 +483,9 @@ public interface DaoMessage {
" AND NOT uid IS NULL")
List<Long> getUids(long folder, Long received);
@Query("SELECT uidl FROM message" +
@Query("SELECT uidl, msgid FROM message" +
" WHERE folder = :folder")
List<String> getUidls(long folder);
List<TupleUidl> getUidls(long folder);
@Query("SELECT * FROM message" +
" WHERE folder = :folder" +

View File

@ -0,0 +1,25 @@
package eu.faircode.email;
/*
This file is part of FairEmail.
FairEmail is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
FairEmail is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FairEmail. If not, see <http://www.gnu.org/licenses/>.
Copyright 2018-2020 by Marcel Bokhorst (M66B)
*/
public class TupleUidl {
String uidl;
String msgid;
}