@Override public String getFullName() { return folder.getFullName(); }
/** * Subscribes the user to the store. * TODO should this fail if already subscribed? * * @param user The user making the subscription * @param folder The store to subscribe * @throws FolderException ??? doesn't yet. */ void subscribe(GreenMailUser user, MailFolder folder) throws FolderException { getUserSubs(user).add(folder.getFullName()); }
/** * Unsubscribes the user from this store. * TODO should this fail if not already subscribed? * * @param user The user making the request. * @param folder The store to unsubscribe * @throws FolderException ?? doesn't yet */ void unsubscribe(GreenMailUser user, MailFolder folder) throws FolderException { getUserSubs(user).remove(folder.getFullName()); }
/** * Returns whether the user is subscribed to the specified store. * * @param user The user to test. * @param folder The store to test. * @return <code>true</code> if the user is subscribed. */ boolean isSubscribed(GreenMailUser user, MailFolder folder) { return getUserSubs(user).contains(folder.getFullName()); }
message.append("\" "); String mailboxName = folder.getFullName(); if (removeUserPrefix) { if (mailboxName.length() <= prefixLength) {
/** * @see ImapHostManager#renameMailbox */ @Override public void renameMailbox(GreenMailUser user, String oldMailboxName, String newMailboxName) throws FolderException, AuthorizationException { MailFolder existingFolder = getFolder(user, oldMailboxName, true); // TODO: check permissions. // Handle case where existing is INBOX // - just create new folder, move all messages, // and leave INBOX (with children) intact. String userInboxName = getQualifiedMailboxName(user, INBOX_NAME); if (userInboxName.equals(existingFolder.getFullName())) { MailFolder newBox = createMailbox(user, newMailboxName); long[] uids = existingFolder.getMessageUids(); for (long uid : uids) { existingFolder.copyMessage(uid, newBox); } existingFolder.deleteAllMessages(); return; } store.renameMailbox(existingFolder, newMailboxName); }
log.debug("Expunging messages matching uids {} from {}", IdRange.idRangesToString(idSet) ,folder.getFullName());
/** * @see CommandTemplate#doProcess */ @Override protected void doProcess(ImapRequestLineReader request, ImapResponse response, ImapSession session) throws ProtocolException, FolderException, AuthorizationException { String mailboxName = parser.mailbox(request); parser.endLine(request); MailFolder folder = getMailbox(mailboxName, session, true); if (session.getSelected() != null && folder.getFullName().equals(session.getSelected().getFullName())) { session.deselect(); } session.getHost().deleteMailbox(session.getUser(), mailboxName); session.unsolicitedResponses(response); response.commandComplete(this); } }