Added attachment section IDs

pull/213/head
M66B 2 years ago
parent c20c416730
commit 7d1ca2840f

File diff suppressed because it is too large Load Diff

@ -71,6 +71,10 @@ public class IMAPBodyPart extends MimeBodyPart implements ReadableMime {
return;
}
public String getSectionId() {
return this.sectionId;
}
@Override
public int getSize() throws MessagingException {
return bs.size;
@ -173,7 +177,6 @@ public class IMAPBodyPart extends MimeBodyPart implements ReadableMime {
// Check whether this message is expunged
message.checkExpunged();
if (p.isREV1() && (message.getFetchBlockSize() != -1))
return new IMAPInputStream(message, sectionId,
message.ignoreBodyStructureSize() ? -1 : bs.size, pk);

@ -204,6 +204,7 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
sb.append(' ').append(attachment.cid);
if (attachment.related != null)
sb.append(' ').append(attachment.related);
sb.append(' ').append(attachment.section).append('/').append(attachment.sequence);
}
if (attachment.isEncryption())
sb.append(' ').append(attachment.encryption);

@ -68,7 +68,7 @@ import javax.mail.internet.InternetAddress;
// https://developer.android.com/topic/libraries/architecture/room.html
@Database(
version = 280,
version = 281,
entities = {
EntityIdentity.class,
EntityAccount.class,
@ -2841,6 +2841,12 @@ public abstract class DB extends RoomDatabase {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `folder` ADD COLUMN `flags` TEXT");
}
}).addMigrations(new Migration(280, 281) {
@Override
public void migrate(@NonNull SupportSQLiteDatabase db) {
logMigration(startVersion, endVersion);
db.execSQL("ALTER TABLE `attachment` ADD COLUMN `section` TEXT");
}
})
.addMigrations(new Migration(998, 999) {
@Override

@ -78,6 +78,7 @@ public class EntityAttachment {
@PrimaryKey(autoGenerate = true)
public Long id;
public String section;
@NonNull
public Long message;
@NonNull
@ -427,7 +428,8 @@ public class EntityAttachment {
public boolean equals(Object obj) {
if (obj instanceof EntityAttachment) {
EntityAttachment other = (EntityAttachment) obj;
return (this.message.equals(other.message) &&
return (Objects.equals(this.section, other.section) &&
this.message.equals(other.message) &&
this.sequence.equals(other.sequence) &&
Objects.equals(this.name, other.name) &&
this.type.equals(other.type) &&

@ -5040,6 +5040,8 @@ public class MessageHelper {
}
apart.attachment = new EntityAttachment();
if (part instanceof IMAPBodyPart)
apart.attachment.section = ((IMAPBodyPart) part).getSectionId();
apart.attachment.disposition = apart.disposition;
apart.attachment.name = apart.filename;
apart.attachment.type = contentType.getBaseType().toLowerCase(Locale.ROOT);

Loading…
Cancel
Save