mirror of
https://github.com/M66B/FairEmail.git
synced 2026-01-02 19:10:11 +01:00
Check for VPN
This commit is contained in:
@@ -14,6 +14,8 @@ import androidx.preference.PreferenceManager;
|
||||
import com.sun.mail.imap.IMAPFolder;
|
||||
import com.sun.mail.imap.IMAPStore;
|
||||
import com.sun.mail.smtp.SMTPTransport;
|
||||
import com.sun.mail.util.MailConnectException;
|
||||
import com.sun.mail.util.SocketConnectException;
|
||||
|
||||
import net.openid.appauth.AuthState;
|
||||
import net.openid.appauth.AuthorizationException;
|
||||
@@ -329,6 +331,18 @@ public class EmailService implements AutoCloseable {
|
||||
return authState.jsonSerializeString();
|
||||
} else
|
||||
throw ex;
|
||||
} catch (MailConnectException ex) {
|
||||
if (ConnectionHelper.vpnActive(context)) {
|
||||
MailConnectException mex = new MailConnectException(new SocketConnectException(
|
||||
"The might be caused by the VPN in use",
|
||||
new Exception(),
|
||||
ex.getHost(),
|
||||
ex.getPort(),
|
||||
ex.getConnectionTimeout()));
|
||||
mex.setNextException(ex.getNextException());
|
||||
throw mex;
|
||||
} else
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user