1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-24 08:44:26 +00:00

UIDL capability cannot change

This commit is contained in:
M66B 2022-11-24 12:00:43 +01:00
parent f3f88f7b4e
commit af1824aa41
5 changed files with 2849 additions and 2 deletions

File diff suppressed because it is too large Load diff

View file

@ -3058,7 +3058,19 @@ class Core {
// Get capabilities
Map<String, String> caps = istore.capabilities();
boolean hasUidl = caps.containsKey("UIDL");
EntityLog.log(context, account.name + " POP capabilities= " + caps.keySet());
EntityLog.log(context, account.name +
" POP capabilities= " + caps.keySet() +
" uidl=" + account.capability_uidl);
if (hasUidl) {
if (Boolean.FALSE.equals(account.capability_uidl)) {
hasUidl = false;
Log.w(account.host + " did not had UIDL before");
}
} else {
account.capability_uidl = false;
db.account().setAccountUidl(account.id, account.capability_uidl);
}
// Get messages
Message[] imessages = ifolder.getMessages();

View file

@ -68,7 +68,7 @@ import javax.mail.internet.InternetAddress;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 255,
version = 256,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -2589,6 +2589,12 @@ public abstract class DB extends RoomDatabase {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `message` ADD COLUMN `ui_local_only` INTEGER NOT NULL DEFAULT 0");
}
}).addMigrations(new Migration(255, 256) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `account` ADD COLUMN `capability_uidl` INTEGER");
}
}).addMigrations(new Migration(998, 999) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {

View file

@ -297,6 +297,9 @@ public interface DaoAccount {
@Query("UPDATE account SET tbd = 1 WHERE id = :id AND NOT (tbd IS 1)")
int setAccountTbd(long id);
@Query("UPDATE account SET capability_uidl = :uidl WHERE id = :id AND NOT (capability_uidl IS :uidl)")
int setAccountUidl(long id, Boolean uidl);
@Query("DELETE FROM account WHERE id = :id")
int deleteAccount(long id);
}

View file

@ -167,6 +167,7 @@ public class EntityAccount extends EntityOrder implements Serializable {
public String capabilities;
public Boolean capability_idle;
public Boolean capability_utf8;
public Boolean capability_uidl;
boolean isGmail() {
return "imap.gmail.com".equalsIgnoreCase(host) ||