mirror of https://github.com/M66B/FairEmail.git
Fixing duplicate POP3 messages
This commit is contained in:
parent
fb75830d0b
commit
e05aa83e94
|
@ -1533,9 +1533,16 @@ class Core {
|
||||||
Log.i(folder.name + " POP existing=" + ids.size());
|
Log.i(folder.name + " POP existing=" + ids.size());
|
||||||
|
|
||||||
Map<String, TupleUidl> uidls = new HashMap<>();
|
Map<String, TupleUidl> uidls = new HashMap<>();
|
||||||
|
Map<String, TupleUidl> msgids = new HashMap<>();
|
||||||
for (TupleUidl id : ids)
|
for (TupleUidl id : ids)
|
||||||
if (id.uidl != null)
|
if (id.uidl != null)
|
||||||
uidls.put(id.uidl, id);
|
uidls.put(id.uidl, id);
|
||||||
|
else if (id.msgid != null)
|
||||||
|
msgids.put(id.msgid, id);
|
||||||
|
|
||||||
|
for (TupleUidl id : uidls.values())
|
||||||
|
if (id.msgid != null && msgids.containsKey(id.msgid))
|
||||||
|
db.message().deleteMessage(id.id);
|
||||||
|
|
||||||
for (Message imessage : imessages)
|
for (Message imessage : imessages)
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -485,7 +485,7 @@ public interface DaoMessage {
|
||||||
" AND NOT uid IS NULL")
|
" AND NOT uid IS NULL")
|
||||||
List<Long> getUids(long folder, Long received);
|
List<Long> getUids(long folder, Long received);
|
||||||
|
|
||||||
@Query("SELECT uidl, msgid FROM message" +
|
@Query("SELECT id, uidl, msgid FROM message" +
|
||||||
" WHERE folder = :folder")
|
" WHERE folder = :folder")
|
||||||
List<TupleUidl> getUidls(long folder);
|
List<TupleUidl> getUidls(long folder);
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ package eu.faircode.email;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class TupleUidl {
|
public class TupleUidl {
|
||||||
|
long id;
|
||||||
String uidl;
|
String uidl;
|
||||||
String msgid;
|
String msgid;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue