mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-06 00:53:26 +02:00
Process delivered to header
This commit is contained in:
@@ -45,7 +45,7 @@ import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||
// https://developer.android.com/topic/libraries/architecture/room.html
|
||||
|
||||
@Database(
|
||||
version = 16,
|
||||
version = 17,
|
||||
entities = {
|
||||
EntityIdentity.class,
|
||||
EntityAccount.class,
|
||||
@@ -229,6 +229,13 @@ public abstract class DB extends RoomDatabase {
|
||||
db.execSQL("ALTER TABLE `message` ADD COLUMN `content` INTEGER NOT NULL DEFAULT 1");
|
||||
}
|
||||
})
|
||||
.addMigrations(new Migration(16, 17) {
|
||||
@Override
|
||||
public void migrate(SupportSQLiteDatabase db) {
|
||||
Log.i(Helper.TAG, "DB migration from version " + startVersion + " to " + endVersion);
|
||||
db.execSQL("ALTER TABLE `message` ADD COLUMN `deliveredto` TEXT");
|
||||
}
|
||||
})
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -80,6 +80,7 @@ public class EntityMessage implements Serializable {
|
||||
public Long uid; // compose = null
|
||||
public String msgid;
|
||||
public String references;
|
||||
public String deliveredto;
|
||||
public String inreplyto;
|
||||
public String thread; // compose = null
|
||||
public String avatar; // URI
|
||||
|
||||
@@ -756,6 +756,15 @@ public class FragmentCompose extends FragmentEx {
|
||||
}
|
||||
}
|
||||
|
||||
if (ref.deliveredto != null) {
|
||||
try {
|
||||
Log.i(Helper.TAG, "Setting delivered to=" + ref.deliveredto);
|
||||
ref.to = InternetAddress.parse(ref.deliveredto);
|
||||
} catch (AddressException ex) {
|
||||
Log.w(Helper.TAG, ex + "\n" + Log.getStackTraceString(ex));
|
||||
}
|
||||
}
|
||||
|
||||
if (ref.from != null && ref.from.length > 0) {
|
||||
String from = Helper.canonicalAddress(((InternetAddress) ref.from[0]).getAddress());
|
||||
for (EntityIdentity identity : identities) {
|
||||
|
||||
@@ -251,6 +251,10 @@ public class MessageHelper {
|
||||
return (refs == null ? new String[0] : refs.split("\\s+"));
|
||||
}
|
||||
|
||||
String getDeliveredTo() throws MessagingException {
|
||||
return imessage.getHeader("Delivered-To", imessage.getHeader("X-Delivered-To", null));
|
||||
}
|
||||
|
||||
String getInReplyTo() throws MessagingException {
|
||||
return imessage.getHeader("In-Reply-To", null);
|
||||
}
|
||||
|
||||
@@ -1490,6 +1490,7 @@ public class ServiceSynchronize extends LifecycleService {
|
||||
|
||||
message.references = TextUtils.join(" ", helper.getReferences());
|
||||
message.inreplyto = helper.getInReplyTo();
|
||||
message.deliveredto = helper.getDeliveredTo();
|
||||
message.thread = helper.getThreadId(uid);
|
||||
message.from = helper.getFrom();
|
||||
message.to = helper.getTo();
|
||||
|
||||
Reference in New Issue
Block a user