mirror of
https://github.com/moparisthebest/k-9
synced 2025-01-11 13:49:15 -05:00
Fix problems connecting to POP3 servers which lack the CAPA command.
This commit is contained in:
parent
7db506e2d0
commit
4ad4216de5
@ -11,6 +11,8 @@ import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Process;
|
||||
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.Button;
|
||||
@ -18,6 +20,7 @@ import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.android.email.Account;
|
||||
import com.android.email.Email;
|
||||
import com.android.email.R;
|
||||
import com.android.email.mail.AuthenticationFailedException;
|
||||
import com.android.email.mail.MessagingException;
|
||||
@ -124,14 +127,17 @@ public class AccountSetupCheckSettings extends Activity implements OnClickListen
|
||||
setResult(RESULT_OK);
|
||||
finish();
|
||||
} catch (final AuthenticationFailedException afe) {
|
||||
Log.e(Email.LOG_TAG, "Error while testing settings", afe);
|
||||
showErrorDialog(
|
||||
R.string.account_setup_failed_dlg_auth_message_fmt,
|
||||
afe.getMessage() == null ? "" : afe.getMessage());
|
||||
} catch (final CertificateValidationException cve) {
|
||||
Log.e(Email.LOG_TAG, "Error while testing settings", cve);
|
||||
acceptKeyDialog(
|
||||
R.string.account_setup_failed_dlg_certificate_message_fmt,
|
||||
cve);
|
||||
} catch (final Throwable t) {
|
||||
Log.e(Email.LOG_TAG, "Error while testing settings", t);
|
||||
showErrorDialog(
|
||||
R.string.account_setup_failed_dlg_server_message_fmt,
|
||||
(t.getMessage() == null ? "" : t.getMessage()));
|
||||
|
@ -217,7 +217,10 @@ public class Pop3Store extends Store {
|
||||
}
|
||||
|
||||
mSocket.setSoTimeout(Store.SOCKET_READ_TIMEOUT);
|
||||
|
||||
if (!isOpen())
|
||||
{
|
||||
throw new MessagingException("Unable to connect socket");
|
||||
}
|
||||
|
||||
// Eat the banner
|
||||
executeSimpleCommand(null);
|
||||
@ -239,6 +242,10 @@ public class Pop3Store extends Store {
|
||||
mSocket.setSoTimeout(Store.SOCKET_READ_TIMEOUT);
|
||||
mIn = new BufferedInputStream(mSocket.getInputStream(), 1024);
|
||||
mOut = new BufferedOutputStream(mSocket.getOutputStream(), 512);
|
||||
if (!isOpen())
|
||||
{
|
||||
throw new MessagingException("Unable to connect socket");
|
||||
}
|
||||
} else if (mConnectionSecurity == CONNECTION_SECURITY_TLS_REQUIRED) {
|
||||
throw new MessagingException("TLS not supported but required");
|
||||
}
|
||||
@ -269,8 +276,8 @@ public class Pop3Store extends Store {
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
return (mIn != null && mOut != null && mSocket != null && mSocket.isConnected() && !mSocket
|
||||
.isClosed());
|
||||
return (mIn != null && mOut != null && mSocket != null
|
||||
&& mSocket.isConnected() && !mSocket.isClosed());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -838,6 +845,10 @@ public class Pop3Store extends Store {
|
||||
|
||||
return response;
|
||||
}
|
||||
catch (MessagingException me)
|
||||
{
|
||||
throw me;
|
||||
}
|
||||
catch (Exception e) {
|
||||
closeIO();
|
||||
throw new MessagingException("Unable to execute POP3 command", e);
|
||||
|
Loading…
Reference in New Issue
Block a user