mirror of
https://github.com/M66B/FairEmail.git
synced 2025-03-19 10:25:29 +00:00
Prefer same/similar address from extra
This commit is contained in:
parent
d26ba9dd92
commit
7bc405537d
1 changed files with 18 additions and 1 deletions
|
@ -2768,7 +2768,24 @@ public class FragmentCompose extends FragmentBase {
|
|||
}
|
||||
|
||||
if (data.draft.from != null && data.draft.from.length > 0) {
|
||||
String from = ((InternetAddress) data.draft.from[0]).getAddress();
|
||||
Address preferred = null;
|
||||
if (ref.identity != null) {
|
||||
EntityIdentity recognized = db.identity().getIdentity(ref.identity);
|
||||
if (recognized != null) {
|
||||
Address same = null;
|
||||
Address similar = null;
|
||||
for (Address from : data.draft.from) {
|
||||
if (same == null && recognized.sameAddress(from))
|
||||
same = from;
|
||||
if (similar == null && recognized.similarAddress(from))
|
||||
similar = from;
|
||||
}
|
||||
preferred = (same == null ? similar : same);
|
||||
}
|
||||
}
|
||||
if (preferred == null)
|
||||
preferred = data.draft.from[0];
|
||||
String from = ((InternetAddress) preferred).getAddress();
|
||||
if (from != null && from.contains("@"))
|
||||
data.draft.extra = from.substring(0, from.indexOf("@"));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue