Allow duplicate message IDs

Some providers, in any case Gmail, allow duplicate message IDs as well
pull/153/head
M66B 6 years ago
parent f9737d68e2
commit d612ec55d3

File diff suppressed because it is too large Load Diff

@ -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;
}
}
}

@ -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();
}

@ -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"}),

Loading…
Cancel
Save