Fixed selecting identity

pull/147/head
M66B 7 years ago
parent 2add8a9ca5
commit 0fbdb65f79

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

Loading…
Cancel
Save