diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java b/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java index a9375fe84e..7a97756ef2 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogOpenLink.java @@ -59,6 +59,7 @@ import androidx.core.util.PatternsCompat; import androidx.preference.PreferenceManager; import java.net.IDN; +import java.net.InetAddress; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -296,7 +297,7 @@ public class FragmentDialogOpenLink extends FragmentDialogBase { Bundle args = new Bundle(); args.putParcelable("uri", uri); - new SimpleTask>() { + new SimpleTask>() { @Override protected void onPreExecute(Bundle args) { btnOwner.setEnabled(false); @@ -312,14 +313,14 @@ public class FragmentDialogOpenLink extends FragmentDialogBase { } @Override - protected Pair onExecute(Context context, Bundle args) throws Throwable { + protected Pair onExecute(Context context, Bundle args) throws Throwable { Uri uri = args.getParcelable("uri"); return IPInfo.getOrganization(uri, context); } @Override - protected void onExecuted(Bundle args, Pair data) { - tvHost.setText(data.first); + protected void onExecuted(Bundle args, Pair data) { + tvHost.setText(data.first.toString()); tvOwner.setText(data.second.name == null ? "?" : data.second.name); ApplicationEx.getMainHandler().post(new Runnable() { @Override diff --git a/app/src/main/java/eu/faircode/email/IPInfo.java b/app/src/main/java/eu/faircode/email/IPInfo.java index 7ea9bbc26c..ac0b1bb620 100644 --- a/app/src/main/java/eu/faircode/email/IPInfo.java +++ b/app/src/main/java/eu/faircode/email/IPInfo.java @@ -42,22 +42,23 @@ public class IPInfo { private final static int FETCH_TIMEOUT = 15 * 1000; // milliseconds - static Pair getOrganization(@NonNull Uri uri, Context context) throws IOException, ParseException { + static Pair getOrganization(@NonNull Uri uri, Context context) throws IOException, ParseException { if ("mailto".equalsIgnoreCase(uri.getScheme())) { MailTo email = MailTo.parse(uri.toString()); String domain = UriHelper.getEmailDomain(email.getTo()); if (domain == null) throw new UnknownHostException(); - InetAddress address = DnsHelper.lookupMx(context, domain); - if (address == null) - throw new UnknownHostException(); - return new Pair<>(domain, getOrganization(address, context)); + //InetAddress address = DnsHelper.lookupMx(context, domain); + //if (address == null) + // throw new UnknownHostException(); + InetAddress address = InetAddress.getByName(domain); + return new Pair<>(address, getOrganization(address, context)); } else { String host = uri.getHost(); if (host == null) throw new UnknownHostException(); InetAddress address = InetAddress.getByName(host); - return new Pair<>(host, getOrganization(address, context)); + return new Pair<>(address, getOrganization(address, context)); } }