Prevent replying to self

This commit is contained in:
M66B 2019-04-01 07:58:20 +02:00
parent 1c5d6c7738
commit 826c59fcec
1 changed files with 5 additions and 4 deletions

View File

@ -1718,16 +1718,17 @@ public class FragmentCompose extends FragmentBase {
draft.thread = ref.thread; draft.thread = ref.thread;
// Prevent replying to self // Prevent replying to self
String from = null; String to = null;
String via = null; String via = null;
if (ref.from != null && ref.from.length > 0) Address[] recipient = (ref.reply == null || ref.reply.length == 0 ? ref.from : ref.reply);
from = Helper.canonicalAddress(((InternetAddress) ref.from[0]).getAddress()); if (recipient != null && recipient.length > 0)
to = Helper.canonicalAddress(((InternetAddress) recipient[0]).getAddress());
if (ref.identity != null) { if (ref.identity != null) {
EntityIdentity v = db.identity().getIdentity(ref.identity); EntityIdentity v = db.identity().getIdentity(ref.identity);
via = Helper.canonicalAddress(v.email); via = Helper.canonicalAddress(v.email);
} }
if (from != null && from.equals(via)) { if (to != null && to.equals(via)) {
draft.to = ref.to; draft.to = ref.to;
draft.from = ref.from; draft.from = ref.from;
} else { } else {