mirror of https://github.com/M66B/FairEmail.git
parent
922b4dfb31
commit
501360afff
|
@ -1269,9 +1269,9 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
String selector = (reverse ? null : message.bimi_selector);
|
||||
Address[] addresses = (reverse ? message.to : (message.isForwarder() ? message.submitter : message.from));
|
||||
Address[] senders = ContactInfo.fillIn(
|
||||
reverse && !show_recipients ? message.to : message.addresses[0], prefer_contact, only_contact);
|
||||
reverse && !show_recipients ? message.to : message.senders, prefer_contact, only_contact);
|
||||
Address[] recipients = ContactInfo.fillIn(
|
||||
reverse && !show_recipients ? message.from : message.addresses[1], prefer_contact, only_contact);
|
||||
reverse && !show_recipients ? message.from : message.recipients, prefer_contact, only_contact);
|
||||
boolean authenticated =
|
||||
!((Boolean.FALSE.equals(message.dkim) && check_authentication) ||
|
||||
(Boolean.FALSE.equals(message.spf) && check_authentication) ||
|
||||
|
@ -2563,7 +2563,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
boolean hasChannel = (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O);
|
||||
int maxRecipients = (compact ? MAX_RECIPIENTS_COMPACT : MAX_RECIPIENTS_NORMAL);
|
||||
Spanned submitter = formatAddresses(message.submitter, true);
|
||||
Spanned from = formatAddresses(message.addresses[0], true);
|
||||
Spanned from = formatAddresses(message.senders, true);
|
||||
|
||||
grpAddresses.setVisibility(View.VISIBLE);
|
||||
|
||||
|
@ -7841,7 +7841,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
|
||||
boolean outgoing = isOutgoing(message);
|
||||
Address[] addresses = (EntityFolder.isOutgoing(message.folderType) &&
|
||||
(viewType != ViewType.THREAD || !threading) ? message.to : message.addresses[0]);
|
||||
(viewType != ViewType.THREAD || !threading) ? message.to : message.senders);
|
||||
MessageHelper.AddressFormat format = email_format;
|
||||
String from = MessageHelper.formatAddresses(addresses, format, false);
|
||||
|
||||
|
@ -8617,7 +8617,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
|||
keyPosition.put(message.id, i);
|
||||
positionKey.put(i, message.id);
|
||||
addExtra(message.from, message.extra);
|
||||
addExtra(message.addresses[0], message.extra);
|
||||
addExtra(message.senders, message.extra);
|
||||
message.resolveLabelColors(context);
|
||||
message.resolveKeywordColors(context);
|
||||
}
|
||||
|
|
|
@ -3116,8 +3116,14 @@ public abstract class DB extends RoomDatabase {
|
|||
List<Address> result = new ArrayList<>();
|
||||
try {
|
||||
JSONArray jroot = new JSONArray(json);
|
||||
for (int i = 0; i < jroot.length(); i++)
|
||||
result.addAll(getAddresses(jroot.get(i)));
|
||||
for (int i = 0; i < jroot.length(); i++) {
|
||||
Object item = jroot.get(i);
|
||||
if (jroot.get(i) instanceof JSONArray)
|
||||
for (int j = 0; j < ((JSONArray) item).length(); j++)
|
||||
result.add(InternetAddressJson.from((JSONObject) ((JSONArray) item).get(j)));
|
||||
else
|
||||
result.add(InternetAddressJson.from((JSONObject) item));
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
// Compose can store invalid addresses
|
||||
Log.w(ex);
|
||||
|
@ -3125,46 +3131,6 @@ public abstract class DB extends RoomDatabase {
|
|||
return result.toArray(new Address[0]);
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
public static Address[][] decodeAddressesArray(String json) {
|
||||
if (json == null)
|
||||
return new Address[][]{new Address[0], new Address[0]};
|
||||
|
||||
List<Address> senders = new ArrayList<>();
|
||||
List<Address> recipients = new ArrayList<>();
|
||||
try {
|
||||
JSONArray jroot = new JSONArray(json);
|
||||
senders.addAll(getAddresses(jroot.get(0)));
|
||||
recipients.addAll(getAddresses(jroot.get(1)));
|
||||
} catch (Throwable ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
return new Address[][]{
|
||||
senders.toArray(new Address[0]),
|
||||
recipients.toArray(new Address[0])
|
||||
};
|
||||
}
|
||||
|
||||
private static List<Address> getAddresses(Object item) {
|
||||
List<Address> result = new ArrayList<>();
|
||||
if (item instanceof JSONArray)
|
||||
for (int j = 0; j < ((JSONArray) item).length(); j++)
|
||||
try {
|
||||
result.add(InternetAddressJson.from((JSONObject) ((JSONArray) item).get(j)));
|
||||
} catch (Throwable ex) {
|
||||
// Compose can store invalid addresses
|
||||
Log.w(ex);
|
||||
}
|
||||
else
|
||||
try {
|
||||
result.add(InternetAddressJson.from((JSONObject) item));
|
||||
} catch (Throwable ex) {
|
||||
// Compose can store invalid addresses
|
||||
Log.w(ex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@TypeConverter
|
||||
public static EntityLog.Type toLogType(int ordinal) {
|
||||
return EntityLog.Type.values()[ordinal];
|
||||
|
|
|
@ -51,7 +51,8 @@ public interface DaoMessage {
|
|||
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
|
||||
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, NULL AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
|
||||
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
|
||||
", (SELECT '[' || group_concat(`from`, ',') || ',' || group_concat(`to`, ',') || ']' FROM (SELECT DISTINCT `from`, `to` FROM message m0 WHERE m0.account = message.account AND m0.thread = message.thread ORDER BY m0.received DESC LIMIT 3)) AS addresses" +
|
||||
", '[' || (SELECT group_concat(`from`, ',') FROM (SELECT DISTINCT `from` FROM message m0 WHERE m0.account = message.account AND m0.thread = message.thread ORDER BY m0.received DESC LIMIT 3)) || ']' AS senders" +
|
||||
", '[' || (SELECT group_concat(`to`, ',') FROM (SELECT DISTINCT `to` FROM message m0 WHERE m0.account = message.account AND m0.thread = message.thread ORDER BY m0.received DESC LIMIT 3)) || ']' AS recipients" +
|
||||
", COUNT(message.id) AS count" +
|
||||
", SUM(1 - message.ui_seen) AS unseen" +
|
||||
", SUM(1 - message.ui_flagged) AS unflagged" +
|
||||
|
@ -76,7 +77,7 @@ public interface DaoMessage {
|
|||
" THEN message.received ELSE 0 END) AS dummy" +
|
||||
" FROM message" +
|
||||
|
||||
" JOIN message AS mm ON mm.account = message.account AND mm.thread = message.thread" +
|
||||
" JOIN message AS mm ON mm.thread = message.thread" +
|
||||
" AND (NOT :found OR mm.ui_found) AND (NOT mm.ui_hide OR :debug)" +
|
||||
" JOIN folder AS ff ON ff.id = mm.folder" +
|
||||
" AND (:found OR (:type IS NULL AND ff.unified) OR (:type IS NOT NULL AND ff.type = :type))" +
|
||||
|
@ -128,7 +129,8 @@ public interface DaoMessage {
|
|||
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
|
||||
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, f.inherited_type AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
|
||||
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
|
||||
", (SELECT '[' || group_concat(`from`, ',') || ',' || group_concat(`to`, ',') || ']' FROM (SELECT DISTINCT `from`, `to` FROM message m0 WHERE m0.account = message.account AND m0.thread = message.thread ORDER BY m0.received DESC LIMIT 3)) AS addresses" +
|
||||
", '[' || (SELECT group_concat(`from`, ',') FROM (SELECT DISTINCT `from` FROM message m0 WHERE m0.account = message.account AND m0.thread = message.thread ORDER BY m0.received DESC LIMIT 3)) || ']' AS senders" +
|
||||
", '[' || (SELECT group_concat(`to`, ',') FROM (SELECT DISTINCT `to` FROM message m0 WHERE m0.account = message.account AND m0.thread = message.thread ORDER BY m0.received DESC LIMIT 3)) || ']' AS recipients" +
|
||||
", COUNT(message.id) AS count" +
|
||||
", SUM(1 - message.ui_seen) AS unseen" +
|
||||
", SUM(1 - message.ui_flagged) AS unflagged" +
|
||||
|
@ -152,7 +154,7 @@ public interface DaoMessage {
|
|||
" THEN message.received ELSE 0 END) AS dummy" +
|
||||
" FROM message" +
|
||||
|
||||
" JOIN message AS mm ON mm.account = message.account AND mm.thread = message.thread" +
|
||||
" JOIN message AS mm ON mm.thread = message.thread" +
|
||||
" AND (NOT :found OR mm.ui_found) AND (NOT mm.ui_hide OR :debug)" +
|
||||
" AND message.folder = :folder" +
|
||||
|
||||
|
@ -198,7 +200,8 @@ public interface DaoMessage {
|
|||
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
|
||||
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, NULL AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
|
||||
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
|
||||
", ('[' || message.`from` || ',' || message.`to` || ']') AS addresses" +
|
||||
", message.`from` AS senders" +
|
||||
", message.`to` AS recipients" +
|
||||
", 1 AS count" +
|
||||
", CASE WHEN message.ui_seen THEN 0 ELSE 1 END AS unseen" +
|
||||
", CASE WHEN message.ui_flagged THEN 0 ELSE 1 END AS unflagged" +
|
||||
|
@ -503,7 +506,8 @@ public interface DaoMessage {
|
|||
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
|
||||
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, NULL AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
|
||||
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
|
||||
", ('[' || message.`from` || ',' || message.`to` || ']') AS addresses" +
|
||||
", message.`from` AS senders" +
|
||||
", message.`to` AS recipients" +
|
||||
", 1 AS count" +
|
||||
", CASE WHEN message.ui_seen THEN 0 ELSE 1 END AS unseen" +
|
||||
", CASE WHEN message.ui_flagged THEN 0 ELSE 1 END AS unflagged" +
|
||||
|
@ -533,7 +537,8 @@ public interface DaoMessage {
|
|||
", account.notify AS accountNotify, account.summary AS accountSummary, account.leave_deleted AS accountLeaveDeleted, account.auto_seen AS accountAutoSeen" +
|
||||
", folder.name AS folderName, folder.color AS folderColor, folder.display AS folderDisplay, folder.type AS folderType, NULL AS folderInheritedType, folder.unified AS folderUnified, folder.read_only AS folderReadOnly" +
|
||||
", IFNULL(identity.display, identity.name) AS identityName, identity.email AS identityEmail, identity.color AS identityColor, identity.synchronize AS identitySynchronize" +
|
||||
", ('[' || message.`from` || ',' || message.`to` || ']') AS addresses" +
|
||||
", message.`from` AS senders" +
|
||||
", message.`to` AS recipients" +
|
||||
", 1 AS count" +
|
||||
", 1 AS unseen" +
|
||||
", 0 AS unflagged" +
|
||||
|
|
|
@ -53,7 +53,8 @@ public class TupleMessageEx extends EntityMessage {
|
|||
public String identityEmail;
|
||||
public Integer identityColor;
|
||||
public Boolean identitySynchronize;
|
||||
public Address[][] addresses;
|
||||
public Address[] senders;
|
||||
public Address[] recipients;
|
||||
public int count;
|
||||
public int unseen;
|
||||
public int unflagged;
|
||||
|
@ -159,8 +160,8 @@ public class TupleMessageEx extends EntityMessage {
|
|||
Objects.equals(this.identityEmail, other.identityEmail) &&
|
||||
Objects.equals(this.identityColor, other.identityColor) &&
|
||||
Objects.equals(this.identitySynchronize, other.identitySynchronize) &&
|
||||
MessageHelper.equal(this.addresses[0], other.addresses[0]) &&
|
||||
MessageHelper.equal(this.addresses[1], other.addresses[1]) &&
|
||||
MessageHelper.equal(this.senders, other.senders) &&
|
||||
MessageHelper.equal(this.recipients, other.recipients) &&
|
||||
this.count == other.count &&
|
||||
this.unseen == other.unseen &&
|
||||
this.unflagged == other.unflagged &&
|
||||
|
|
Loading…
Reference in New Issue