Special case identity selection

pull/206/head
M66B 4 years ago
parent 2b8f149dc6
commit 09ba8dc080

@ -4263,46 +4263,54 @@ public class FragmentCompose extends FragmentBase {
break; break;
} }
Address[] refto = (ref == null ? null if (ref != null) {
: ref.replySelf(data.identities, ref.account) ? ref.from : ref.to); Address[] refto;
if (refto != null && refto.length > 0) { boolean self = ref.replySelf(data.identities, ref.account);
if (selected == null) if (ref.to == null || ref.to.length == 0 || self)
for (Address sender : refto) refto = ref.from;
for (EntityIdentity identity : data.identities) else
if (identity.account.equals(aid) && refto = ref.to;
identity.sameAddress(sender)) { Log.i("Ref self=" + self +
selected = identity; " to=" + MessageHelper.formatAddresses(refto));
EntityLog.log(context, "Selected same account/identity"); if (refto != null && refto.length > 0) {
break; if (selected == null)
} for (Address sender : refto)
for (EntityIdentity identity : data.identities)
if (identity.account.equals(aid) &&
identity.sameAddress(sender)) {
selected = identity;
EntityLog.log(context, "Selected same account/identity");
break;
}
if (selected == null) if (selected == null)
for (Address sender : refto) for (Address sender : refto)
for (EntityIdentity identity : data.identities) for (EntityIdentity identity : data.identities)
if (identity.account.equals(aid) && if (identity.account.equals(aid) &&
identity.similarAddress(sender)) { identity.similarAddress(sender)) {
selected = identity; selected = identity;
EntityLog.log(context, "Selected similar account/identity"); EntityLog.log(context, "Selected similar account/identity");
break; break;
} }
if (selected == null) if (selected == null)
for (Address sender : refto) for (Address sender : refto)
for (EntityIdentity identity : data.identities) for (EntityIdentity identity : data.identities)
if (identity.sameAddress(sender)) { if (identity.sameAddress(sender)) {
selected = identity; selected = identity;
EntityLog.log(context, "Selected same */identity"); EntityLog.log(context, "Selected same */identity");
break; break;
} }
if (selected == null) if (selected == null)
for (Address sender : refto) for (Address sender : refto)
for (EntityIdentity identity : data.identities) for (EntityIdentity identity : data.identities)
if (identity.similarAddress(sender)) { if (identity.similarAddress(sender)) {
selected = identity; selected = identity;
EntityLog.log(context, "Selected similer */identity"); EntityLog.log(context, "Selected similer */identity");
break; break;
} }
}
} }
if (selected == null) if (selected == null)

Loading…
Cancel
Save