Search in sources :

Example 1 with ActionExplicitKeep

use of com.zimbra.cs.filter.jsieve.ActionExplicitKeep in project zm-mailbox by Zimbra.

the class ZimbraMailAdapter method executeAllActions.

/**
 * Execute the list of actions which have been stacked during the evaluation
 * of the each sieve script.
 * @throws SieveException
 */
public void executeAllActions() throws SieveException {
    try {
        handler.beforeFiltering();
        String messageId = Mime.getMessageID(handler.getMimeMessage());
        // the script contains a single discard action, JSieve returns an empty list.
        if (this.discardActionPresent) {
            ZimbraLog.filter.info("Discarding message with Message-ID %s from %s", messageId, Mime.getSender(handler.getMimeMessage()));
        }
        if (getActions().size() == 0) {
            handler.discard();
            return;
        }
        detectExplicitKeep();
        for (Action action : actions) {
            if (action instanceof ActionKeep) {
                executeActionKeepInternal();
            } else if (action instanceof ActionExplicitKeep) {
                keep(KeepType.EXPLICIT_KEEP);
            } else if (action instanceof ActionFileInto) {
                executeActionFileIntoInternal(action);
            } else if (action instanceof ActionRedirect) {
                executeActionRedirectInternal(action);
            } else if (action instanceof ActionReply) {
                executeActionReplyInternal(action);
            } else if (action instanceof ActionNotify) {
                executeActionNotifyInternal(action);
            } else if (action instanceof ActionReject) {
                executeActionRejectInternal(action);
            } else if (action instanceof ActionEreject) {
                executeActionErejectInternal(action);
            } else if (action instanceof ActionNotifyMailto) {
                executeActionNotifyMailto(action);
            }
        }
        handler.afterFiltering();
    } catch (ServiceException e) {
        throw new ZimbraSieveException(e);
    }
}
Also used : Action(org.apache.jsieve.mail.Action) ActionReply(com.zimbra.cs.filter.jsieve.ActionReply) ActionRedirect(com.zimbra.cs.filter.jsieve.ActionRedirect) ActionEreject(com.zimbra.cs.filter.jsieve.ActionEreject) ActionNotifyMailto(com.zimbra.cs.filter.jsieve.ActionNotifyMailto) ServiceException(com.zimbra.common.service.ServiceException) ActionKeep(org.apache.jsieve.mail.ActionKeep) ActionReject(org.apache.jsieve.mail.ActionReject) ActionFileInto(com.zimbra.cs.filter.jsieve.ActionFileInto) ActionExplicitKeep(com.zimbra.cs.filter.jsieve.ActionExplicitKeep) ActionNotify(com.zimbra.cs.filter.jsieve.ActionNotify)

Aggregations

ServiceException (com.zimbra.common.service.ServiceException)1 ActionEreject (com.zimbra.cs.filter.jsieve.ActionEreject)1 ActionExplicitKeep (com.zimbra.cs.filter.jsieve.ActionExplicitKeep)1 ActionFileInto (com.zimbra.cs.filter.jsieve.ActionFileInto)1 ActionNotify (com.zimbra.cs.filter.jsieve.ActionNotify)1 ActionNotifyMailto (com.zimbra.cs.filter.jsieve.ActionNotifyMailto)1 ActionRedirect (com.zimbra.cs.filter.jsieve.ActionRedirect)1 ActionReply (com.zimbra.cs.filter.jsieve.ActionReply)1 Action (org.apache.jsieve.mail.Action)1 ActionKeep (org.apache.jsieve.mail.ActionKeep)1 ActionReject (org.apache.jsieve.mail.ActionReject)1