Added protocol hint

pull/182/head
M66B 5 years ago
parent 7097debe93
commit f07374fa08

@ -73,6 +73,8 @@ import javax.mail.event.StoreListener;
import javax.net.ssl.KeyManager;
import javax.net.ssl.KeyManagerFactory;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLSocket;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
@ -369,6 +371,15 @@ public class EmailService implements AutoCloseable {
} catch (MessagingException ex) {
if (port == 995 && !("pop3".equals(protocol) || "pop3s".equals(protocol)))
throw new MessagingException(context.getString(R.string.title_service_port), ex);
else if (ex.getMessage() != null &&
ex.getMessage().contains("Got bad greeting"))
throw new MessagingException(context.getString(R.string.title_service_protocol), ex);
else if (ex.getCause() instanceof SSLException &&
ex.getCause().getMessage() != null &&
ex.getCause().getMessage().contains("Unable to parse TLS packet header"))
throw new MessagingException(context.getString(R.string.title_service_protocol), ex);
else if (ex.getCause() instanceof SSLHandshakeException)
throw new MessagingException(context.getString(R.string.title_service_protocol), ex);
else
throw ex;
}

@ -643,6 +643,7 @@
<string name="title_hint_alias">Long press an identity to display options, like copy to create alias identities</string>
<string name="title_service_vpn">This might be caused by the VPN that is being used</string>
<string name="title_service_port">Please double check the port number</string>
<string name="title_service_protocol">Please double check the protocol (SSL/TLS or STARTTLS)</string>
<string name="title_advanced_browse">Browse messages on the server</string>
<string name="title_advanced_expand_read">Mark messages read on expanding</string>

Loading…
Cancel
Save