/** * Consumes the next character in the request, checking that it matches the * expected one. This method should be used when the */ protected void consumeChar(ImapRequestLineReader request, char expected) throws ProtocolException { char consumed = request.consume(); if (consumed != expected) { throw new ProtocolException("Expected:'" + expected + "' found:'" + consumed + '\''); } }
/** * @see ImapHostManager#unsubscribe */ @Override public void unsubscribe(GreenMailUser user, String mailboxName) throws FolderException { MailFolder folder = getFolder(user, mailboxName, true); subscriptions.unsubscribe(user, folder); }
@Override protected void doProcess(ImapRequestLineReader request, ImapResponse response, ImapSession session) throws ProtocolException, FolderException { String mailboxName = parser.mailbox(request); parser.endLine(request); session.getHost().subscribe(session.getUser(), mailboxName); session.unsolicitedResponses(response); response.commandComplete(this); } }
@Override protected void doProcess(ImapRequestLineReader request, ImapResponse response, ImapSession session) throws ProtocolException, FolderException { String mailboxName = parser.mailbox(request); parser.endLine(request); session.getHost().unsubscribe(session.getUser(), mailboxName); session.unsolicitedResponses(response); response.commandComplete(this); } }
@Override protected void doProcess(ImapRequestLineReader request, ImapResponse response, ImapSession session) throws ProtocolException, FolderException, AuthorizationException { String existingName = parser.mailbox(request); String newName = parser.mailbox(request); parser.endLine(request); session.getHost().renameMailbox(session.getUser(), existingName, newName); session.unsolicitedResponses(response); response.commandComplete(this); } }
public void commandResponse(ImapCommand command, String message) { untagged(); commandName(command); message(message); end(); }
@Override protected Collection<MailFolder> doList(ImapSession session, String searchPattern) throws FolderException { return session.getHost().listSubscribedMailboxes(session.getUser(), searchPattern); } }
protected Collection<MailFolder> doList(ImapSession session, String searchPattern) throws FolderException { return session.getHost().listMailboxes(session.getUser(), searchPattern); }
public void forceConnectionClose(final String message) { response.byeResponse(message); close(); }
@Override public void deselect() { this.state = ImapSessionState.AUTHENTICATED; if (selectedMailbox != null) { // TODO is there more to do here, to cleanup the mailbox. selectedMailbox.removeListener(selectedMailbox); this.selectedMailbox = null; } }
@Override public void setSelected(MailFolder folder, boolean readOnly) { ImapSessionFolder sessionMailbox = new ImapSessionFolder(folder, this, readOnly); this.state = ImapSessionState.SELECTED; this.selectedMailbox = sessionMailbox; }
/** * @see ImapHostManager#getInbox */ @Override public MailFolder getInbox(GreenMailUser user) throws FolderException { return getFolder(user, INBOX_NAME); }
/** * @see ImapHostManager#listSubscribedMailboxes */ @Override public Collection<MailFolder> listSubscribedMailboxes(GreenMailUser user, String mailboxPattern) throws FolderException { return listMailboxes(user, mailboxPattern, true); }