Fixed selecting identity

This commit is contained in:
M66B 2019-02-05 08:27:50 +00:00
parent 2add8a9ca5
commit 0fbdb65f79
1 changed files with 27 additions and 22 deletions

View File

@ -1627,9 +1627,12 @@ 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 {
String from = null;
if (iindex >= 0)
from = Helper.canonicalAddress(((InternetAddress) result.draft.from[iindex]).getAddress());
for (EntityIdentity identity : identities) { for (EntityIdentity identity : identities) {
String email = Helper.canonicalAddress(identity.email); String email = Helper.canonicalAddress(identity.email);
if (email.equals(from)) { if (email.equals(from)) {
@ -1647,9 +1650,11 @@ public class FragmentCompose extends FragmentBase {
} }
if (result.draft.identity != null) if (result.draft.identity != null)
break; 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;