mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-07 17:43:18 +02:00
Show extra in outbox
This commit is contained in:
@@ -6590,6 +6590,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
if (message != null) {
|
||||
keyPosition.put(message.id, i);
|
||||
positionKey.put(i, message.id);
|
||||
addExtra(message.from, message.extra);
|
||||
addExtra(message.senders, message.extra);
|
||||
message.resolveLabelColors(context);
|
||||
message.resolveKeywordColors(context);
|
||||
}
|
||||
@@ -6611,6 +6613,20 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
|
||||
});
|
||||
}
|
||||
|
||||
static void addExtra(Address[] addresses, String extra) {
|
||||
if (addresses == null || addresses.length == 0)
|
||||
return;
|
||||
if (extra == null)
|
||||
return;
|
||||
|
||||
String email = ((InternetAddress) addresses[0]).getAddress();
|
||||
if (email == null)
|
||||
return;
|
||||
|
||||
email = MessageHelper.addExtra(email, extra);
|
||||
((InternetAddress) addresses[0]).setAddress(email);
|
||||
}
|
||||
|
||||
PagedList<TupleMessageEx> getCurrentList() {
|
||||
return differ.getCurrentList();
|
||||
}
|
||||
|
||||
@@ -566,15 +566,9 @@ public class MessageHelper {
|
||||
|
||||
if (identity != null && identity.sender_extra &&
|
||||
email != null && message.extra != null) {
|
||||
int at = email.indexOf('@');
|
||||
String username = UriHelper.getEmailUser(identity.email);
|
||||
if (at > 0 && !message.extra.equals(username)) {
|
||||
if (message.extra.length() > 1 && message.extra.startsWith("+"))
|
||||
email = email.substring(0, at) + message.extra + email.substring(at);
|
||||
else if (message.extra.length() > 1 && message.extra.startsWith("@"))
|
||||
email = email.substring(0, at) + message.extra + '.' + email.substring(at + 1);
|
||||
else
|
||||
email = message.extra + email.substring(at);
|
||||
if (!message.extra.equals(username)) {
|
||||
email = addExtra(email, message.extra);
|
||||
|
||||
if (!identity.sender_extra_name)
|
||||
name = null;
|
||||
@@ -589,6 +583,21 @@ public class MessageHelper {
|
||||
return new InternetAddress(email, name, StandardCharsets.UTF_8.name());
|
||||
}
|
||||
|
||||
static String addExtra(String email, String extra) {
|
||||
int at = email.indexOf('@');
|
||||
if (at < 0)
|
||||
return email;
|
||||
|
||||
if (extra.length() > 1 && extra.startsWith("+"))
|
||||
email = email.substring(0, at) + extra + email.substring(at);
|
||||
else if (extra.length() > 1 && extra.startsWith("@"))
|
||||
email = email.substring(0, at) + extra + '.' + email.substring(at + 1);
|
||||
else
|
||||
email = extra + email.substring(at);
|
||||
|
||||
return email;
|
||||
}
|
||||
|
||||
private static void addAddress(String email, Message.RecipientType type, MimeMessage imessage, EntityIdentity identity) throws MessagingException {
|
||||
List<Address> result = new ArrayList<>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user