mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-27 02:07:12 +00:00
Prevent bouncing to recipients
This commit is contained in:
parent
d0d0960f1f
commit
89393d0299
2 changed files with 18 additions and 5 deletions
|
@ -3612,8 +3612,6 @@ public class FragmentCompose extends FragmentBase {
|
|||
} else if (EntityMessage.DSN_HARD_BOUNCE.equals(dsn)) {
|
||||
if (ref.return_path != null)
|
||||
data.draft.to = ref.return_path;
|
||||
else if (BuildConfig.DEBUG)
|
||||
data.draft.to = ref.from;
|
||||
}
|
||||
} else {
|
||||
// Prevent replying to self
|
||||
|
|
|
@ -2421,14 +2421,29 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
|
|||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
boolean experiments = prefs.getBoolean("experiments", false);
|
||||
|
||||
boolean canBounce = false;
|
||||
if (message.return_path != null && message.return_path.length == 1) {
|
||||
canBounce = true;
|
||||
List<Address> addresses = new ArrayList<>();
|
||||
if (message.to != null)
|
||||
addresses.addAll(Arrays.asList(message.to));
|
||||
if (message.cc != null)
|
||||
addresses.addAll(Arrays.asList(message.cc));
|
||||
if (message.bcc != null)
|
||||
addresses.addAll(Arrays.asList(message.bcc));
|
||||
for (Address address : addresses)
|
||||
if (MessageHelper.equalEmail(address, message.return_path[0])) {
|
||||
canBounce = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
PopupMenuLifecycle popupMenu = new PopupMenuLifecycle(context, getViewLifecycleOwner(), anchor);
|
||||
popupMenu.inflate(R.menu.popup_reply);
|
||||
popupMenu.getMenu().findItem(R.id.menu_reply_to_all).setVisible(recipients.length > 0);
|
||||
popupMenu.getMenu().findItem(R.id.menu_reply_list).setVisible(message.list_post != null);
|
||||
popupMenu.getMenu().findItem(R.id.menu_reply_receipt).setVisible(message.receipt_to != null);
|
||||
popupMenu.getMenu().findItem(R.id.menu_reply_hard_bounce)
|
||||
.setVisible(experiments && (BuildConfig.DEBUG ||
|
||||
(message.return_path != null && message.return_path.length > 0)));
|
||||
popupMenu.getMenu().findItem(R.id.menu_reply_hard_bounce).setVisible(experiments && canBounce);
|
||||
popupMenu.getMenu().findItem(R.id.menu_new_message).setVisible(to != null && to.length > 0);
|
||||
popupMenu.getMenu().findItem(R.id.menu_reply_answer).setVisible(answers != 0 || !ActivityBilling.isPro(context));
|
||||
|
||||
|
|
Loading…
Reference in a new issue