Added identity logging

pull/213/head
M66B 2 years ago
parent 0361f79f57
commit d369cccdf3

@ -4944,6 +4944,10 @@ class Core {
if (EntityFolder.DRAFTS.equals(folder.type)) if (EntityFolder.DRAFTS.equals(folder.type))
return null; return null;
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
int level = prefs.getInt("log_level", android.util.Log.INFO);
boolean log = (level <= android.util.Log.INFO || BuildConfig.DEBUG);
List<Address> addresses = new ArrayList<>(); List<Address> addresses = new ArrayList<>();
if (folder.isOutgoing()) { if (folder.isOutgoing()) {
if (message.from != null) if (message.from != null)
@ -4972,19 +4976,45 @@ class Core {
if (identities != null) { if (identities != null) {
for (Address address : addresses) for (Address address : addresses)
for (EntityIdentity identity : identities) for (EntityIdentity identity : identities)
if (identity.sameAddress(address)) if (identity.sameAddress(address)) {
if (log)
Log.i("Matched same" +
" identity=" + identity.email +
" address=" + ((InternetAddress) address).getAddress() +
" folder=" + folder.name);
return identity; return identity;
}
for (Address address : addresses) for (Address address : addresses)
for (EntityIdentity identity : identities) for (EntityIdentity identity : identities)
if (identity.similarAddress(address)) if (identity.similarAddress(address)) {
if (log)
Log.i("Matched similar" +
" identity=" + identity.email +
" regex=" + identity.sender_extra_regex +
" address=" + ((InternetAddress) address).getAddress() +
" folder=" + folder.name);
return identity; return identity;
}
if (deliveredto != null) if (deliveredto != null)
for (EntityIdentity identity : identities) for (EntityIdentity identity : identities)
if (identity.sameAddress(deliveredto) || identity.similarAddress(deliveredto)) if (identity.sameAddress(deliveredto) || identity.similarAddress(deliveredto)) {
if (log)
Log.i("Matched deliveredto" +
" identity=" + identity.email +
" regex=" + identity.sender_extra_regex +
" address=" + ((InternetAddress) deliveredto).getAddress() +
" folder=" + folder.name);
return identity; return identity;
} }
}
if (log)
Log.i("Matched none" +
" addresses=" + MessageHelper.formatAddresses(addresses.toArray(new Address[0])) +
" deliveredto=" + (deliveredto == null ? null : ((InternetAddress) deliveredto).getAddress()) +
" folder=" + folder.name);
return null; return null;
} }

Loading…
Cancel
Save