Extra sub domain

pull/199/head
M66B 4 years ago
parent 7366b6067a
commit 0f9522c62b

@ -249,22 +249,29 @@ public class MessageHelper {
// Addresses // Addresses
if (message.from != null && message.from.length > 0) { if (message.from != null && message.from.length > 0) {
String email = ((InternetAddress) message.from[0]).getAddress(); InternetAddress from = ((InternetAddress) message.from[0]);
String name = ((InternetAddress) message.from[0]).getPersonal(); String email = from.getAddress();
String name = from.getPersonal();
if (identity != null && identity.sender_extra && if (identity != null && identity.sender_extra &&
email != null && message.extra != null) { email != null && message.extra != null) {
int at = email.indexOf('@'); int at = email.indexOf('@');
String username = identity.email.split("@")[0]; String username = UriHelper.getEmailUser(identity.email);
if (at > 0 && !message.extra.equals(username)) { if (at > 0 && !message.extra.equals(username)) {
if (message.extra.length() > 1 && message.extra.startsWith("+")) if (message.extra.length() > 1 && message.extra.startsWith("+"))
email = email.substring(0, at) + message.extra + email.substring(at); 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 else
email = message.extra + email.substring(at); email = message.extra + email.substring(at);
if (!identity.sender_extra_name) if (!identity.sender_extra_name)
name = null; name = null;
Log.i("extra=" + email);
Log.i("extra=\"" + name + "\" <" + email + ">");
} }
} }
imessage.setFrom(new InternetAddress(email, name, StandardCharsets.UTF_8.name())); imessage.setFrom(new InternetAddress(email, name, StandardCharsets.UTF_8.name()));
} }

Loading…
Cancel
Save