| < draft-ietf-sieve-variables-07.txt | draft-ietf-sieve-variables-08.txt > | |||
|---|---|---|---|---|
| Network Working Group K. T. Homme | Network Working Group K. T. Homme | |||
| Updates: 3028 | Updates: 3028 | |||
| Document: draft-ietf-sieve-variables-07.txt University of Oslo | Document: draft-ietf-sieve-variables-08.txt University of Oslo | |||
| Expires Apr 14, 2006 14 Oct 2005 | Expires Jun 18, 2006 18 Dec 2005 | |||
| Sieve Extension: Variables | Sieve Extension: Variables | |||
| Status of this Memo | Status of this Memo | |||
| This document is an Internet-Draft and is subject to all provisions | This document is an Internet-Draft and is subject to all provisions | |||
| of section 3 of RFC 3978. By submitting this Internet-Draft, each | of section 3 of RFC 3978. By submitting this Internet-Draft, each | |||
| author represents that any applicable patent or other IPR claims of | author represents that any applicable patent or other IPR claims of | |||
| which he or she is aware have been or will be disclosed, and any of | which he or she is aware have been or will be disclosed, and any of | |||
| which he or she becomes aware will be disclosed, in accordance with | which he or she becomes aware will be disclosed, in accordance with | |||
| skipping to change at page 1, line 40 ¶ | skipping to change at page 1, line 40 ¶ | |||
| http://www.ietf.org/ietf/1id-abstracts.txt. | http://www.ietf.org/ietf/1id-abstracts.txt. | |||
| The list of Internet-Draft Shadow Directories can be accessed at | The list of Internet-Draft Shadow Directories can be accessed at | |||
| http://www.ietf.org/shadow.html. | http://www.ietf.org/shadow.html. | |||
| Distribution of this memo is unlimited. | Distribution of this memo is unlimited. | |||
| Abstract | Abstract | |||
| In advanced mail filtering rule sets, it is useful to keep state or | In advanced mail filtering rule sets, it is useful to keep state or | |||
| configuration details across rules. This extension to the filtering | configuration details across rules. This document updates the Sieve | |||
| language Sieve changes the interpretation of strings, adds an action | filtering language (RFC 3028) with an extension to support variables. | |||
| The extension changes the interpretation of strings, adds an action | ||||
| to store data in variables, and supplies a new test so that the value | to store data in variables, and supplies a new test so that the value | |||
| of a string can be examined. | of a string can be examined. | |||
| 0. Meta-information on this draft | 0. Meta-information on this draft | |||
| This information is intended to facilitate discussion. It will be | This information is intended to facilitate discussion. It will be | |||
| removed when this document leaves the Internet-Draft stage. | removed when this document leaves the Internet-Draft stage. | |||
| 0.1. Discussion | 0.1. Discussion | |||
| skipping to change at page 6, line 9 ¶ | skipping to change at page 6, line 9 ¶ | |||
| a) updated abstract to mention what this document extends. | a) updated abstract to mention what this document extends. | |||
| b) changed default scoping behaviour in anticipation of "include" | b) changed default scoping behaviour in anticipation of "include" | |||
| extension. | extension. | |||
| c) updated reference to RFC 2234. | c) updated reference to RFC 2234. | |||
| d) clarified whitespace stripping behaviour for "string" test. | d) clarified whitespace stripping behaviour for "string" test. | |||
| 0.2.13. Changes since -07 | ||||
| a) Replaced reference to Unicode with reference to ISO 10646 and made | ||||
| it informational rather than normative. | ||||
| b) Updated [ABNF] since it has been published. | ||||
| c) Removed the use of comparator with SET to affect case folding. | ||||
| Restrict case modifiers to US ASCII. | ||||
| d) Mention in abstract that this draft updates RFC 3028. | ||||
| e) Clarify that match variables contain unmodified extracts from the | ||||
| source value. | ||||
| f) Include "INBOX" in all mailbox names for consistency. | ||||
| 1. Introduction | 1. Introduction | |||
| This is an extension to the Sieve language defined by [SIEVE]. It | This is an extension to the Sieve language defined by [SIEVE]. It | |||
| adds support for storing and referencing named data. The mechanisms | adds support for storing and referencing named data. The mechanisms | |||
| detailed in this document will only apply to Sieve scripts that | detailed in this document will only apply to Sieve scripts that | |||
| include a require clause for the "variables" extension. The require | include a require clause for the "variables" extension. The require | |||
| clauses themselves are not affected by this extension. | clauses themselves are not affected by this extension. | |||
| Conventions for notations are as in [SIEVE] section 1.1, including | Conventions for notations are as in [SIEVE] section 1.1, including | |||
| use of [KEYWORDS] and [ABNF]. The grammar builds on the grammar of | use of [KEYWORDS] and [ABNF]. The grammar builds on the grammar of | |||
| [SIEVE]. In this document, "character" means a [UNICODE] character, | [SIEVE]. In this document, "character" means a character from the | |||
| which may consist of multiple octets coded in [UTF-8], and "variable" | ISO 10646 coded character set [ISO10646], which may consist of | |||
| is a named reference to data stored or read back using the mechanisms | multiple octets coded in [UTF-8], and "variable" is a named reference | |||
| of this extension. | to data stored or read back using the mechanisms of this extension. | |||
| 2. Capability Identifier | 2. Capability Identifier | |||
| The capability string associated with the extension defined in this | The capability string associated with the extension defined in this | |||
| document is "variables". | document is "variables". | |||
| 3. Interpretation of strings | 3. Interpretation of strings | |||
| This extension changes the semantics of quoted-string, multi-line- | This extension changes the semantics of quoted-string, multi-line- | |||
| literal and multi-line-dotstuff found in [SIEVE] to enable the | literal and multi-line-dotstuff found in [SIEVE] to enable the | |||
| skipping to change at page 8, line 23 ¶ | skipping to change at page 8, line 37 ¶ | |||
| A "match variable" has a name consisting only of decimal digits and | A "match variable" has a name consisting only of decimal digits and | |||
| has no namespace component. | has no namespace component. | |||
| The decimal value of the match variable name will index the list of | The decimal value of the match variable name will index the list of | |||
| matching strings from the most recently evaluated successful match of | matching strings from the most recently evaluated successful match of | |||
| type ":matches". The list is empty if no match has been successful. | type ":matches". The list is empty if no match has been successful. | |||
| Note: Extra leading zeroes are allowed and ignored. | Note: Extra leading zeroes are allowed and ignored. | |||
| The list will contain one string for each wildcard ("?" and "*") in | The list will contain one string for each wildcard ("?" and "*") in | |||
| the match pattern. Each string holds what the corresponding wildcard | the match pattern. Each string holds the substring from the source | |||
| expands to, possibly the empty string. The wildcards match as little | value that the corresponding wildcard expands to, possibly the empty | |||
| as possible (non-greedy matching). | string. The wildcards match as little as possible (non-greedy | |||
| matching). | ||||
| The first string in the list has index 1. If the index is out of | The first string in the list has index 1. If the index is out of | |||
| range, the empty string will be substituted. Index 0 contains the | range, the empty string will be substituted. Index 0 contains the | |||
| matched part of the source value. | matched part of the source value. | |||
| The interpreter MUST short-circuit tests, ie. not perform more tests | The interpreter MUST short-circuit tests, ie. not perform more tests | |||
| than necessary to find the result. Evaluation order MUST be left to | than necessary to find the result. Evaluation order MUST be left to | |||
| right. If a test has two or more list arguments, the implementation | right. If a test has two or more list arguments, the implementation | |||
| is free to choose which to iterate over first. | is free to choose which to iterate over first. | |||
| An extension describing a new match type (e.g., [REGEX]) MAY specify | An extension describing a new match type (e.g., [REGEX]) MAY specify | |||
| that match variables are set as a side effect when the match type is | that match variables are set as a side effect when the match type is | |||
| used in a script which has enabled the "variables" extension. | used in a script which has enabled the "variables" extension. | |||
| Example: | Example: | |||
| require ["fileinto", "variables"]; | require ["fileinto", "variables"]; | |||
| if header :matches "List-ID" "*<*@*" { | if header :matches "List-ID" "*<*@*" { | |||
| fileinto "lists.${2}"; stop; | fileinto "INBOX.lists.${2}"; stop; | |||
| } | } | |||
| # Imagine the header | # Imagine the header | |||
| # Subject: [acme-users] [fwd] version 1.0 is out | # Subject: [acme-users] [fwd] version 1.0 is out | |||
| if header :matches "Subject" "[*] *" { | if header :matches "Subject" "[*] *" { | |||
| # ${1} will hold "acme-users", | # ${1} will hold "acme-users", | |||
| # ${2} will hold "[fwd] version 1.0 is out" | # ${2} will hold "[fwd] version 1.0 is out" | |||
| fileinfo "lists.${1}"; stop; | fileinfo "INBOX.lists.${1}"; stop; | |||
| } | } | |||
| # Imagine the header | ||||
| # To: coyote@ACME.Example.COM | ||||
| if address :matches ["To", "Cc"] ["coyote@**.com", | if address :matches ["To", "Cc"] ["coyote@**.com", | |||
| "wile@**.com"] { | "wile@**.com"] { | |||
| # ${0} is the matching address. | # ${0} is the matching address | |||
| # ${1} is always the empty string. | # ${1} is always the empty string | |||
| fileinto "business.${2}"; stop; | # ${2} is part of the domain name ("ACME.Example") | |||
| fileinto "INBOX.business.${2}"; stop; | ||||
| } else { | } else { | |||
| # Control wouldn't reach this block if any match was | # Control wouldn't reach this block if any match was | |||
| # successful, so no match variables are set at this | # successful, so no match variables are set at this | |||
| # point. | # point. | |||
| } | } | |||
| if anyof (true, address :domain :matches "To" "*.com") { | if anyof (true, address :domain :matches "To" "*.com") { | |||
| # The second test is never evaluated, so there are | # The second test is never evaluated, so there are | |||
| # still no match variables set. | # still no match variables set. | |||
| stop; | stop; | |||
| } | } | |||
| 4. Action set | 4. Action set | |||
| Usage: set [MODIFIER] [COMPARATOR] <name: string> <value: string> | Usage: set [MODIFIER] <name: string> <value: string> | |||
| The "set" action stores the specified value in the variable | The "set" action stores the specified value in the variable | |||
| identified by name. The name MUST be a constant string and conform | identified by name. The name MUST be a constant string and conform | |||
| to the syntax of variable-name. Match variables can not be set. A | to the syntax of variable-name. Match variables can not be set. A | |||
| namespace can not be used unless an extension explicitly allows its | namespace can not be used unless an extension explicitly allows its | |||
| use in "set". An invalid name MUST be detected as a syntax error. | use in "set". An invalid name MUST be detected as a syntax error. | |||
| Modifiers are applied on a value before it is stored in the variable. | Modifiers are applied on a value before it is stored in the variable. | |||
| See next section for details. | See next section for details. | |||
| The default comparator is "i;ascii-casemap". The comparator only | ||||
| affects the result when certain modifiers are used. | ||||
| Variables are only visible to the currently running script. Note: | Variables are only visible to the currently running script. Note: | |||
| Future extensions may provide different scoping rules for variables. | Future extensions may provide different scoping rules for variables. | |||
| Variable names are case insensitive. | Variable names are case insensitive. | |||
| Example: | Example: | |||
| set "honorific" "Mr"; | set "honorific" "Mr"; | |||
| set "first_name" "Wile"; | set "first_name" "Wile"; | |||
| set "last_name" "Coyote"; | set "last_name" "Coyote"; | |||
| set "vacation" text: | set "vacation" text: | |||
| skipping to change at page 10, line 45 ¶ | skipping to change at page 11, line 27 ¶ | |||
| +--------------------------------+ | +--------------------------------+ | |||
| It is an error to use two or more modifiers of the same precedence in | It is an error to use two or more modifiers of the same precedence in | |||
| a single "set" action. | a single "set" action. | |||
| Examples: | Examples: | |||
| # The value assigned to the variable is printed after the arrow | # The value assigned to the variable is printed after the arrow | |||
| set "a" "juMBlEd lETteRS"; => "juMBlEd lETteRS" | set "a" "juMBlEd lETteRS"; => "juMBlEd lETteRS" | |||
| set :length "b" "${a}"; => "15" | set :length "b" "${a}"; => "15" | |||
| set :lower "b" "${a}"; => "jumbled letters" | set :lower "b" "${a}"; => "jumbled letters" | |||
| set :lower :comparator "i;octet" | ||||
| "b" "${a}"; => "juMBlEd lETteRS" | ||||
| set :upperfirst "b" "${a}"; => "JuMBlEd lETteRS" | set :upperfirst "b" "${a}"; => "JuMBlEd lETteRS" | |||
| set :upperfirst :lower "b" "${a}"; => "Jumbled letters" | set :upperfirst :lower "b" "${a}"; => "Jumbled letters" | |||
| set :quotewildcard "b" "Rock*"; => "Rock\*" | set :quotewildcard "b" "Rock*"; => "Rock\*" | |||
| 4.1.1. Modifier ":length" | 4.1.1. Modifier ":length" | |||
| The value is the decimal number of characters in the expansion, | The value is the decimal number of characters in the expansion, | |||
| converted to a string. | converted to a string. | |||
| 4.1.2. Modifier ":quotewildcard" | 4.1.2. Modifier ":quotewildcard" | |||
| This modifier adds the necessary quoting to ensure that the expanded | This modifier adds the necessary quoting to ensure that the expanded | |||
| text will only match a literal occurence if used as a parameter to | text will only match a literal occurence if used as a parameter to | |||
| :matches. Every character with special meaning ("*", "?" and "\") | :matches. Every character with special meaning ("*", "?" and "\") | |||
| is prefixed with "\" in the expansion. | is prefixed with "\" in the expansion. | |||
| 4.1.3. Case modifiers | 4.1.3. Case modifiers | |||
| These modifiers change the letters of the text from upper to lower | These modifiers change the letters of the text from upper to lower | |||
| case or vice versa. The implementation MUST support US-ASCII, but is | case or vice versa. Characters other than "A"-"Z", "a"-"z" from US- | |||
| not required to handle the entire Unicode repertoire. The comparator | ASCII are left unchanged. | |||
| specified SHOULD be consulted to establish which locale to use. | ||||
| 4.1.3.1. Modifier ":upper" | 4.1.3.1. Modifier ":upper" | |||
| All lower case letters are converted to their upper case counterpart. | All lower case letters are converted to their upper case counterpart. | |||
| 4.1.3.2. Modifier ":lower" | 4.1.3.2. Modifier ":lower" | |||
| All upper case letters are converted to their lower case counterpart. | All upper case letters are converted to their lower case counterpart. | |||
| 4.1.3.3. Modifier ":upperfirst" | 4.1.3.3. Modifier ":upperfirst" | |||
| skipping to change at page 14, line 4 ¶ | skipping to change at page 14, line 25 ¶ | |||
| Thanks to Cyrus Daboo, Jutta Degener, Ned Freed, Lawrence Greenfield, | Thanks to Cyrus Daboo, Jutta Degener, Ned Freed, Lawrence Greenfield, | |||
| Jeffrey Hutzelman, Mark E. Mallett, Alexey Melnikov, Peder Stray and | Jeffrey Hutzelman, Mark E. Mallett, Alexey Melnikov, Peder Stray and | |||
| Nigel Swinson for valuable feedback. | Nigel Swinson for valuable feedback. | |||
| 10. Author's Address | 10. Author's Address | |||
| Kjetil T. Homme | Kjetil T. Homme | |||
| University of Oslo | University of Oslo | |||
| PO Box 1080 | PO Box 1080 | |||
| 0316 Oslo, Norway | 0316 Oslo, Norway | |||
| Phone: +47 9366 0091 | Phone: +47 9366 0091 | |||
| E-mail: kjetilho@ifi.uio.no | E-mail: kjetilho@ifi.uio.no | |||
| 11. References | 11. References | |||
| 11.1. Normative references | 11.1. Normative references | |||
| [ABNF] Crocker, D. and Overell, P., "Augmented BNF for Syntax | [ABNF] Crocker, D. and Overell, P., "Augmented BNF for Syntax | |||
| Specifications: ABNF", Work in Progress, draft- | Specifications: ABNF", RFC 4234, October 2005. | |||
| crocker-abnf-rfc2234bis-XX.txt | ||||
| [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate | [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate | |||
| Requirement Levels", RFC 2119, March 1997. | Requirement Levels", RFC 2119, March 1997. | |||
| [RELATIONAL] Leiba, B. and Segmuller, W., "Sieve Extension: | [RELATIONAL] Leiba, B. and Segmuller, W., "Sieve Extension: | |||
| Relational Tests", Work in Progress, draft-ietf- | Relational Tests", Work in Progress, draft-ietf- | |||
| sieve-3431bis-XX.txt | sieve-3431bis-XX.txt | |||
| [SIEVE] Guenther, P. and Showalter, T., "Sieve: An Email | [SIEVE] Guenther, P. and Showalter, T., "Sieve: An Email | |||
| Filtering Language", Work in Progress, draft-ietf- | Filtering Language", Work in Progress, draft-ietf- | |||
| sieve-3028bis-XX.txt | sieve-3028bis-XX.txt | |||
| [UNICODE] The Unicode Consortium, "The Unicode Standard -- | ||||
| Worldwide Character Encoding -- Version 1.0", Addison- | ||||
| Wesley, Volume 1, 1991, Volume 2, 1992. | ||||
| [UTF-8] Yergeau, F., "UTF-8, a transformation format of | [UTF-8] Yergeau, F., "UTF-8, a transformation format of | |||
| Unicode and ISO 10646", RFC 3629, November 2003. | Unicode and ISO 10646", RFC 3629, November 2003. | |||
| 11.2. Informative References | 11.2. Informative References | |||
| [ISO10646] ISO/IEC, "Information Technology - Universal Multiple- | ||||
| Octet Coded Character Set (UCS) - Part 1: Architecture | ||||
| and Basic Multilingual Plane", May 1993, with | ||||
| amendments. | ||||
| [REGEX] Murchison, K., "Sieve Email Filtering -- Regular | [REGEX] Murchison, K., "Sieve Email Filtering -- Regular | |||
| Expression Extension", Work in Progress. | Expression Extension", Work in Progress. | |||
| [SPAMTEST] Daboo, C., "SIEVE Email Filtering: Spamtest and | [SPAMTEST] Daboo, C., "SIEVE Email Filtering: Spamtest and | |||
| VirusTest Extensions", RFC 3685, February 2004 | VirusTest Extensions", RFC 3685, February 2004 | |||
| Appendix B. Intellectual Property Rights Statement | Appendix B. Intellectual Property Rights Statement | |||
| The IETF takes no position regarding the validity or scope of any | The IETF takes no position regarding the validity or scope of any | |||
| intellectual property or other rights that might be claimed to | intellectual property or other rights that might be claimed to | |||
| End of changes. 17 change blocks. | ||||
| 31 lines changed or deleted | 48 lines changed or added | |||
This html diff was produced by rfcdiff 1.48. The latest version is available from http://tools.ietf.org/tools/rfcdiff/ | ||||