Added Gravatar support

This commit is contained in:
M66B
2020-01-17 16:59:29 +01:00
parent 0b16601726
commit 3b192301a3
11 changed files with 81 additions and 12 deletions

View File

@@ -38,6 +38,8 @@ import javax.net.ssl.HttpsURLConnection;
public class IPInfo {
private static Map<InetAddress, String> hostOrganization = new HashMap<>();
private final static int FETCH_TIMEOUT = 15 * 1000; // milliseconds
static String[] getOrganization(Uri uri, Context context) throws IOException, ParseException {
if ("mailto".equals(uri.getScheme())) {
MailTo email = MailTo.parse(uri.toString());
@@ -67,7 +69,7 @@ public class IPInfo {
Log.i("GET " + url);
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setRequestMethod("GET");
connection.setReadTimeout(15 * 1000);
connection.setReadTimeout(FETCH_TIMEOUT);
connection.connect();
try (BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()))) {
String organization = reader.readLine();