Browse Source

Limit getting messages by ID by account

Refs #41
main
M66B 6 years ago
parent
commit
84189816ec
2 changed files with 4 additions and 3 deletions
  1. +3
    -2
      app/src/main/java/eu/faircode/email/DaoMessage.java
  2. +1
    -1
      app/src/main/java/eu/faircode/email/ServiceSynchronize.java

+ 3
- 2
app/src/main/java/eu/faircode/email/DaoMessage.java View File

@ -82,10 +82,11 @@ public interface DaoMessage {
@Query("SELECT message.* FROM message" +
" JOIN folder ON folder.id = message.folder" +
" WHERE msgid = :msgid" +
" WHERE message.account = :account" +
" AND message.msgid = :msgid" +
" AND folder.type <> '" + EntityFolder.INBOX + "'" +
" AND folder.type <> '" + EntityFolder.ARCHIVE + "'")
List<EntityMessage> getMessageByMsgId(String msgid);
List<EntityMessage> getMessageByMsgId(long account, String msgid);
@Query("SELECT message.* FROM message" +
" JOIN folder ON folder.id = message.folder" +


+ 1
- 1
app/src/main/java/eu/faircode/email/ServiceSynchronize.java View File

@ -1225,7 +1225,7 @@ public class ServiceSynchronize extends LifecycleService {
if (message == null) {
// Will fetch headers within database transaction
String msgid = helper.getMessageID();
for (EntityMessage dup : db.message().getMessageByMsgId(msgid)) {
for (EntityMessage dup : db.message().getMessageByMsgId(folder.account, msgid)) {
EntityFolder dfolder = db.folder().getFolder(dup.folder);
Log.i(Helper.TAG, folder.name + " found as id=" + dup.id +
" folder=" + dfolder.type + ":" + dup.folder + "/" + folder.type + ":" + folder.id);


Loading…
Cancel
Save