Examples of MailFolder


Examples of com.icegreen.greenmail.store.MailFolder

        return (checkViewable(folder));
    }

    public MailFolder getFolder(GreenMailUser user, String mailboxName, boolean mustExist)
            throws FolderException {
        MailFolder folder = getFolder(user, mailboxName);
        if (mustExist && (folder == null)) {
            throw new FolderException("No such store.");
        }
        return folder;
    }
View Full Code Here

Examples of com.icegreen.greenmail.store.MailFolder

    /**
     * @see ImapHostManager#createPrivateMailAccount
     */
    public void createPrivateMailAccount(GreenMailUser user) throws FolderException {
        MailFolder root = store.getMailbox(USER_NAMESPACE);
        MailFolder userRoot = store.createMailbox(root, user.getQualifiedMailboxName(), false);
        store.createMailbox(userRoot, INBOX_NAME, true);
    }
View Full Code Here

Examples of com.icegreen.greenmail.store.MailFolder

        if (tokens.countTokens() < 2) {
            throw new FolderException("Cannot create store at namespace level.");
        }

        String namespaceRoot = tokens.nextToken();
        MailFolder folder = store.getMailbox(namespaceRoot);
        if (folder == null) {
            throw new FolderException("Invalid namespace.");
        }

        while (tokens.hasMoreTokens()) {
            // Get the next name from the list, and find the child
            String childName = tokens.nextToken();
            MailFolder child = store.getMailbox(folder, childName);
            // Create if neccessary
            if (child == null) {
                // TODO check permissions.
                boolean makeSelectable = (!tokens.hasMoreTokens());
                child = store.createMailbox(folder, childName, makeSelectable);
View Full Code Here

Examples of com.icegreen.greenmail.store.MailFolder

    /**
     * @see ImapHostManager#deleteMailbox
     */
    public void deleteMailbox(GreenMailUser user, String mailboxName)
            throws FolderException, AuthorizationException {
        MailFolder toDelete = getFolder(user, mailboxName, true);
        if (store.getChildren(toDelete).isEmpty()) {
            toDelete.deleteAllMessages();
            toDelete.signalDeletion();
            store.deleteMailbox(toDelete);
        } else {
            if (toDelete.isSelectable()) {
                toDelete.deleteAllMessages();
                store.setSelectable(toDelete, false);
            } else {
                throw new FolderException("Can't delete a non-selectable store with children.");
            }
        }
View Full Code Here

Examples of com.icegreen.greenmail.store.MailFolder

    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 inbox = existingFolder;
            MailFolder newBox = createMailbox(user, newMailboxName);
            long[] uids = inbox.getMessageUids();
            for (int i = 0; i < uids.length; i++) {
                long uid = uids[i];
                inbox.copyMessage(uid, newBox);
            }
View Full Code Here

Examples of com.icegreen.greenmail.store.MailFolder

        ArrayList mailboxes = new ArrayList();
        String qualifiedPattern = getQualifiedMailboxName(user, mailboxPattern);

        Iterator iter = store.listMailboxes(qualifiedPattern).iterator();
        while (iter.hasNext()) {
            MailFolder folder = (MailFolder) iter.next();

            // TODO check subscriptions.
            if (subscribedOnly) {
                if (!subscriptions.isSubscribed(user, folder)) {
                    // if not subscribed
View Full Code Here

Examples of com.icegreen.greenmail.store.MailFolder

    /**
     * @see ImapHostManager#subscribe
     */
    public void subscribe(GreenMailUser user, String mailboxName)
            throws FolderException {
        MailFolder folder = getFolder(user, mailboxName, true);
        subscriptions.subscribe(user, folder);
    }
View Full Code Here

Examples of com.icegreen.greenmail.store.MailFolder

    /**
     * @see ImapHostManager#unsubscribe
     */
    public void unsubscribe(GreenMailUser user, String mailboxName)
            throws FolderException {
        MailFolder folder = getFolder(user, mailboxName, true);
        subscriptions.unsubscribe(user, folder);
    }
View Full Code Here

Examples of com.icegreen.greenmail.store.MailFolder

            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);
View Full Code Here

Examples of com.icegreen.greenmail.store.MailFolder

            datetime = new Date();
        }
        MimeMessage message = parser.mimeMessage(request);
        parser.endLine(request);

        MailFolder folder = null;
        try {
            folder = getMailbox(mailboxName, session, true);
        } catch (FolderException e) {
            e.setResponseCode("TRYCREATE");
            throw e;
        }

        folder.appendMessage(message, flags, datetime);

        session.unsolicitedResponses(response);
        response.commandComplete(this);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.