mirror of https://github.com/M66B/FairEmail.git
Added sign-off to quick setup
This commit is contained in:
parent
03dd806c8d
commit
a7e508482f
|
@ -1049,8 +1049,10 @@ public class EmailProvider implements Parcelable {
|
|||
EntityLog.log(context, "Handshake " + address + ": " + Log.formatThrowable(ex));
|
||||
} finally {
|
||||
try {
|
||||
if (sslSocket != null)
|
||||
if (sslSocket != null) {
|
||||
signOff(sslSocket, context);
|
||||
sslSocket.close();
|
||||
}
|
||||
} catch (Throwable ex) {
|
||||
Log.e(ex);
|
||||
}
|
||||
|
@ -1157,6 +1159,30 @@ public class EmailProvider implements Parcelable {
|
|||
throw new SocketException("No STARTTLS");
|
||||
}
|
||||
|
||||
private void signOff(Socket socket, Context context) {
|
||||
try {
|
||||
String command = (port == 465 || port == 587 ? "QUIT" : "A002 LOGOUT");
|
||||
|
||||
EntityLog.log(context, EntityLog.Type.Protocol,
|
||||
socket.getRemoteSocketAddress() + " >" + command);
|
||||
socket.getOutputStream().write((command + "\n").getBytes());
|
||||
|
||||
LineInputStream lis =
|
||||
new LineInputStream(
|
||||
new BufferedInputStream(
|
||||
socket.getInputStream()));
|
||||
String response;
|
||||
do {
|
||||
response = lis.readLine();
|
||||
if (response != null)
|
||||
EntityLog.log(context, EntityLog.Type.Protocol,
|
||||
socket.getRemoteSocketAddress() + " <" + response);
|
||||
} while (response != null);
|
||||
} catch (IOException ex) {
|
||||
Log.w(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Server) {
|
||||
|
|
Loading…
Reference in New Issue