/** * Implements a "stat". If the handler is currently in a transaction state, * this amounts to a rollback of the mailbox contents to the beginning of * the transaction. This method is also called when first entering the * transaction state to initialize the handler copies of the user inbox. */ protected void stat(POP3Session session) { try { List<MessageMetaData> messages = session.getUserMailbox().getMessages(); session.setAttachment(POP3Session.UID_LIST, messages, State.Transaction); session.setAttachment(POP3Session.DELETED_UID_LIST, new ArrayList<String>(), State.Transaction); } catch (IOException e) { // In the event of an exception being thrown there may or may not be // anything in userMailbox LOGGER.error("Unable to STAT mail box ", e); } }
@Override public Response onConnect(POP3Session session) { StringBuilder responseBuffer = new StringBuilder(); // Generate the timestamp which can be also used with APOP. See RFC1939 APOP responseBuffer.append("<").append(session.getSessionID()).append(".").append(System.currentTimeMillis()).append("@").append(session.getConfiguration().getHelloName()).append("> "); // store the timestamp for later usage session.setAttachment(POP3Session.APOP_TIMESTAMP, responseBuffer.toString(), State.Connection); // complete the response banner and send it back to the client responseBuffer.append("POP3 server (").append(session.getConfiguration().getSoftwareName()).append(") ready "); return new POP3Response(POP3Response.OK_RESPONSE, responseBuffer.toString()); }