Fixed selecting identity with multiple recipients

pull/147/head
M66B 7 years ago
parent 0f8e958935
commit 1ebf77edd1

@ -1625,26 +1625,29 @@ public class FragmentCompose extends FragmentBase {
// Select identity matching from address // Select identity matching from address
int icount = 0; int icount = 0;
String from = null;
EntityIdentity first = null; EntityIdentity first = null;
EntityIdentity primary = null; EntityIdentity primary = null;
if (result.draft.from != null && result.draft.from.length > 0) if (result.draft.from != null)
from = Helper.canonicalAddress(((InternetAddress) result.draft.from[0]).getAddress()); for (Address afrom : result.draft.from) {
for (EntityIdentity identity : identities) { String from = Helper.canonicalAddress(((InternetAddress) afrom).getAddress());
String email = Helper.canonicalAddress(identity.email); for (EntityIdentity identity : identities) {
if (email.equals(from)) { String email = Helper.canonicalAddress(identity.email);
result.draft.identity = identity.id; if (email.equals(from)) {
result.draft.from = new InternetAddress[]{new InternetAddress(identity.email, identity.name)}; result.draft.identity = identity.id;
break; result.draft.from = new InternetAddress[]{new InternetAddress(identity.email, identity.name)};
} break;
if (identity.account.equals(result.draft.account)) { }
icount++; if (identity.account.equals(result.draft.account)) {
if (identity.primary) icount++;
primary = identity; if (identity.primary)
if (first == null) primary = identity;
first = identity; if (first == null)
first = identity;
}
}
if (result.draft.identity != null)
break;
} }
}
// Select primary identity // Select primary identity
if (result.draft.identity == null) { if (result.draft.identity == null) {

Loading…
Cancel
Save