Simplification

This commit is contained in:
M66B 2019-10-19 12:15:30 +02:00
parent 996ae80876
commit c0d49d6f47
1 changed files with 8 additions and 4 deletions

View File

@ -24,7 +24,6 @@ import java.net.UnknownHostException;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import javax.mail.Address;
import javax.mail.internet.InternetAddress;
@ -299,9 +298,14 @@ public class ConnectionHelper {
for (Address address : addresses)
try {
String email = ((InternetAddress) address).getAddress();
if (email == null || !email.contains("@"))
if (email == null)
continue;
String domain = email.split("@")[1];
int d = email.lastIndexOf("@");
if (d < 0)
continue;
String domain = email.substring(d + 1);
Lookup lookup = new Lookup(domain, Type.MX);
SimpleResolver resolver = new SimpleResolver(ConnectionHelper.getDnsServer(context));
lookup.setResolver(resolver);
@ -346,7 +350,7 @@ public class ConnectionHelper {
return null;
}
static String getDomain(String host) {
static String getDomain(String host) {
if (host != null) {
String[] h = host.split("\\.");
if (h.length >= 2)