|
|
|
@ -80,9 +80,6 @@ import java.io.IOException;
|
|
|
|
|
import java.io.InputStream;
|
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
|
import java.net.Inet4Address;
|
|
|
|
|
import java.net.Inet6Address;
|
|
|
|
|
import java.net.InetAddress;
|
|
|
|
|
import java.net.SocketException;
|
|
|
|
|
import java.net.UnknownHostException;
|
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
@ -3349,49 +3346,6 @@ class Core {
|
|
|
|
|
message.warning = Log.formatThrowable(ex, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
boolean check_spam = prefs.getBoolean("check_spam", false);
|
|
|
|
|
if (check_spam) {
|
|
|
|
|
String host = helper.getReceivedFromHost();
|
|
|
|
|
if (host != null) {
|
|
|
|
|
try {
|
|
|
|
|
InetAddress addr = InetAddress.getByName(host);
|
|
|
|
|
Log.i("Received from " + host + "=" + addr);
|
|
|
|
|
|
|
|
|
|
StringBuilder lookup = new StringBuilder();
|
|
|
|
|
if (addr instanceof Inet4Address) {
|
|
|
|
|
List<String> a = Arrays.asList(addr.getHostAddress().split("\\."));
|
|
|
|
|
Collections.reverse(a);
|
|
|
|
|
lookup.append(TextUtils.join(".", a)).append('.');
|
|
|
|
|
} else if (addr instanceof Inet6Address) {
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
byte[] a = addr.getAddress();
|
|
|
|
|
for (int i = 0; i < 8; i++)
|
|
|
|
|
sb.append(String.format("%02x",
|
|
|
|
|
((a[i << 1] << 8) & 0xff00) | (a[(i << 1) + 1] & 0xff)));
|
|
|
|
|
sb.reverse();
|
|
|
|
|
for (char kar : sb.toString().toCharArray())
|
|
|
|
|
lookup.append(kar).append('.');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
lookup.append("zen.spamhaus.org");
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
InetAddress.getByName(lookup.toString());
|
|
|
|
|
if (message.warning == null)
|
|
|
|
|
message.warning = lookup.toString();
|
|
|
|
|
else
|
|
|
|
|
message.warning += ", " + lookup;
|
|
|
|
|
} catch (UnknownHostException ignore) {
|
|
|
|
|
// Not blocked
|
|
|
|
|
}
|
|
|
|
|
} catch (UnknownHostException ex) {
|
|
|
|
|
Log.w(ex);
|
|
|
|
|
} catch (Throwable ex) {
|
|
|
|
|
Log.w(folder.name, ex);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
db.beginTransaction();
|
|
|
|
|
|
|
|
|
|