Search in sources :

Example 1 with ASTstring

use of org.apache.jsieve.parser.generated.ASTstring in project zm-mailbox by Zimbra.

the class RuleRewriter method action.

private void action(Element elem, Node node) {
    int numChildren = node.jjtGetNumChildren();
    for (int i = 0; i < numChildren; i++) {
        Node childNode = node.jjtGetChild(i);
        if (childNode instanceof ASTstring) {
            String val = ((SieveNode) childNode).getValue().toString();
            if (val.startsWith("text:")) {
                elem.addText(val.substring(5));
            } else {
                // Put quotes around value to maintain backward compatibility
                // with ZCS 5.x.  See bug 39911.
                StringBuilder buf = new StringBuilder();
                if (!val.startsWith("\"")) {
                    buf.append('"');
                }
                buf.append(val);
                if (!val.endsWith("\"")) {
                    buf.append('"');
                }
                elem.addElement(MailConstants.E_FILTER_ARG).setText(buf.toString());
            }
        } else {
            action(elem, childNode);
        }
    }
}
Also used : ASTstring(org.apache.jsieve.parser.generated.ASTstring) Node(org.apache.jsieve.parser.generated.Node) SieveNode(org.apache.jsieve.parser.SieveNode) Mountpoint(com.zimbra.cs.mailbox.Mountpoint)

Aggregations

Mountpoint (com.zimbra.cs.mailbox.Mountpoint)1 SieveNode (org.apache.jsieve.parser.SieveNode)1 ASTstring (org.apache.jsieve.parser.generated.ASTstring)1 Node (org.apache.jsieve.parser.generated.Node)1