Allow duplicate message IDs

Some providers, in any case Gmail, allow duplicate message IDs as well
This commit is contained in:
M66B 2019-03-31 16:36:41 +02:00
parent f9737d68e2
commit d612ec55d3
4 changed files with 1668 additions and 11 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1070,20 +1070,18 @@ class Core {
Log.i(folder.name + " found as id=" + dup.id +
" uid=" + dup.uid + "/" + uid +
" msgid=" + msgid + " thread=" + thread);
dup.folder = folder.id; // outbox to sent
if (dup.uid == null) {
Log.i(folder.name + " set uid=" + uid);
dup.folder = folder.id; // outbox to sent
dup.uid = uid;
dup.msgid = msgid;
dup.thread = thread;
dup.error = null;
message = dup;
update = true;
filter = true;
} else
Log.w(folder.name + " changed uid=" + dup.uid + " -> " + uid);
dup.msgid = msgid;
dup.thread = thread;
dup.error = null;
update = true;
message = dup;
}
}
}

View File

@ -50,7 +50,7 @@ import io.requery.android.database.sqlite.RequerySQLiteOpenHelperFactory;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 62,
version = 63,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -676,6 +676,14 @@ public abstract class DB extends RoomDatabase {
db.execSQL("ALTER TABLE `account` ADD COLUMN `warning` TEXT");
}
})
.addMigrations(new Migration(62, 63) {
@Override
public void migrate(SupportSQLiteDatabase db) {
Log.i("DB migration from version " + startVersion + " to " + endVersion);
db.execSQL("DROP INDEX index_message_msgid_folder");
db.execSQL("CREATE INDEX `index_message_msgid` ON `message` (`msgid`)");
}
})
.build();
}

View File

@ -58,7 +58,7 @@ import static androidx.room.ForeignKey.SET_NULL;
@Index(value = {"folder"}),
@Index(value = {"identity"}),
@Index(value = {"folder", "uid"}, unique = true),
@Index(value = {"msgid", "folder"}, unique = true),
@Index(value = {"msgid"}),
@Index(value = {"thread"}),
@Index(value = {"sender"}),
@Index(value = {"received"}),