From 1dbb37dbc17f4b30090205565d5cda1d3428ed2a Mon Sep 17 00:00:00 2001 From: mguessan Date: Thu, 14 Jan 2010 13:54:39 +0000 Subject: [PATCH] SMTP: implement RSET (reset) command to avoid connection timeout with Evolution git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@911 3d1905a2-6b24-0410-a738-b14d5a86fcbd --- src/java/davmail/smtp/SmtpConnection.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/java/davmail/smtp/SmtpConnection.java b/src/java/davmail/smtp/SmtpConnection.java index f3680634..ddab9fc6 100644 --- a/src/java/davmail/smtp/SmtpConnection.java +++ b/src/java/davmail/smtp/SmtpConnection.java @@ -150,8 +150,20 @@ public class SmtpConnection extends AbstractConnection { state = State.AUTHENTICATED; sendClient("503 Bad sequence of commands"); } - } + } else if ("RSET".equalsIgnoreCase(command)) { + recipients.clear(); + if (state == State.STARTMAIL || + state == State.RECIPIENT || + state == State.MAILDATA) { + state = State.AUTHENTICATED; + } else { + state = State.INITIAL; + } + sendClient("250 OK Reset"); + } else { + sendClient("500 Unrecognized command"); + } } else { sendClient("500 Unrecognized command"); } @@ -164,7 +176,7 @@ public class SmtpConnection extends AbstractConnection { } catch (Exception e) { DavGatewayTray.log(e); try { - sendClient("500 " + ((e.getMessage()==null)?e:e.getMessage())); + sendClient("500 " + ((e.getMessage() == null) ? e : e.getMessage())); } catch (IOException e2) { DavGatewayTray.debug(new BundleMessage("LOG_EXCEPTION_SENDING_ERROR_TO_CLIENT"), e2); }