draft-ietf-sieve-imapflags-03.txt   draft-ietf-sieve-imapflags-04.txt 
Network Working Group Network Working Group
Internet Draft: Sieve -- IMAP flag Extension A. Melnikov Internet Draft: Sieve -- IMAP flag Extension A. Melnikov
Document: draft-ietf-sieve-imapflags-03.txt Isode Limited Document: draft-ietf-sieve-imapflags-04.txt Isode Limited
Expires: July 2006 January 2006 Expires: August 2006 February 2006
SIEVE Email Filtering: IMAP flag Extension SIEVE Email Filtering: IMAP flag Extension
Status of this memo Status of this memo
By submitting this Internet-Draft, each author represents that any By submitting this Internet-Draft, each author represents that any
applicable patent or other IPR claims of which he or she is aware 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 becomes have been or will be disclosed, and any of which he or she becomes
aware will be disclosed, in accordance with Section 6 of BCP 79. aware will be disclosed, in accordance with Section 6 of BCP 79.
skipping to change at line 188 skipping to change at line 188
0.12. Changes from draft-ietf-sieve-imapflags-02.txt 0.12. Changes from draft-ietf-sieve-imapflags-02.txt
1. Changed "Syntax:" label to "Usage:". 1. Changed "Syntax:" label to "Usage:".
2. Updated the Introduction section to mention that hasflag also has 2. Updated the Introduction section to mention that hasflag also has
an optional parameter. an optional parameter.
3. Clarified that a failure to store flags for a message is not 3. Clarified that a failure to store flags for a message is not
a runtime error. a runtime error.
4. Minor editorial nits from Philip 4. Minor editorial nits from Philip.
5. Addressed ID nits.
0.13. Changes from draft-ietf-sieve-imapflags-03.txt
1. Minor editorial changes from Ken.
2. Added IANA Considerations section.
3. Clarified "hasflag" behaviour with :matches, :contains, etc.
4. Added optional comparator field to "hasflag" test, for
consistency with other extensions.
5. Clarified interaction of hasflag with the relational extension.
1. Introduction 1. Introduction
This is an extension to the Sieve language defined by [SIEVE] for This is an extension to the Sieve language defined by [SIEVE] for
setting [IMAP] flags. It adds a new tagged argument to "keep" and setting [IMAP] flags. It adds a new tagged argument to "keep" and
"fileinto" that describes the list of flags that have to be set "fileinto" that describes the list of flags that have to be set
when the message is delivered to the specified mailbox. It also when the message is delivered to the specified mailbox. It also
adds several actions to help manipulate list of flags and a test adds several actions to help manipulate list of flags and a test
to check if a flag belongs to a list. to check if a flag belongs to a list.
skipping to change at line 260 skipping to change at line 275
unaltered. For example, it may reorder the flags, alter the case of unaltered. For example, it may reorder the flags, alter the case of
the letters in them, or add or remove duplicates or extraneous the letters in them, or add or remove duplicates or extraneous
spaces. Scripts MUST NOT make assumptions about the ordering of spaces. Scripts MUST NOT make assumptions about the ordering of
flags in lists or the preservation of their case. flags in lists or the preservation of their case.
Note that the parameter specifying a variable name to setflag/ Note that the parameter specifying a variable name to setflag/
addflag/removeflag actions and the hasflag test is optional. If the addflag/removeflag actions and the hasflag test is optional. If the
parameter is not specified the actions operate on the internal parameter is not specified the actions operate on the internal
variable, which has the empty value when the script starts execution. variable, which has the empty value when the script starts execution.
If the SIEVE interpreter doesn't support the "variables" extension If the SIEVE interpreter doesn't support the "variables" extension
[VARIABLES], the present variable name parameter MUST cause runtime [VARIABLES], the presence of the variable name parameter MUST cause
error. runtime error.
The "addflag" action adds flags to an existing set. The "removeflag" The "addflag" action adds flags to an existing set. The "removeflag"
action removes flags from an existing set. The "setflag" action action removes flags from an existing set. The "setflag" action
replaces an existing set of flags with a new set. The "set" action replaces an existing set of flags with a new set. The "set" action
defined in [VARIABLES] can be used to replace an existing set of defined in [VARIABLES] can be used to replace an existing set of
flags with a new set as well. However it should be noted that the flags with a new set as well. However it should be noted that the
"set" action can't perform any flag reordering, duplicate "set" action can't perform any flag reordering, duplicate
elimination, etc. elimination, etc.
The :flags tagged argument to "keep" and "fileinto" The :flags tagged argument to "keep" and "fileinto"
actions is used to associate a set of flags actions is used to associate a set of flags
with the current message. If the :flags tagged argument is not with the current message. If the :flags tagged argument is not
specified with those 2 actions, the current value of the internal specified with those 2 actions, the current value of the internal
variable is used instead. The value also applies to the implicit variable is used instead. The value of the internal variable
keep. also applies to the implicit keep.
Note that when keep/fileinto is used multiple times in a script and Note that when keep/fileinto is used multiple times in a script and
duplicate message elimination is performed, the last flag list value duplicate message elimination is performed, the last flag list value
MUST win. MUST win.
3.1. Setflag Action 3.1. Setflag Action
Usage: setflag [<variablename: string>] Usage: setflag [<variablename: string>]
<list-of-flags: string-list> <list-of-flags: string-list>
skipping to change at line 356 skipping to change at line 371
"mel@example.com" { "mel@example.com" {
addflag "flagvar" "$MDNRequired"; addflag "flagvar" "$MDNRequired";
} }
if header :contains "from" "imap@cac.washington.example.edu" { if header :contains "from" "imap@cac.washington.example.edu" {
removeflag "flagvar" "$MDNRequired"; removeflag "flagvar" "$MDNRequired";
fileinto :flags "${flagvar}" "INBOX.imap-list"; fileinto :flags "${flagvar}" "INBOX.imap-list";
} }
4. Test hasflag 4. Test hasflag
Usage: hasflag [MATCH-TYPE] [<variable-list: string-list>] Usage: hasflag [MATCH-TYPE] [COMPARATOR]
[<variable-list: string-list>]
<list-of-flags: string-list> <list-of-flags: string-list>
The "hasflag" test evaluates to true if any of the variables matches The "hasflag" test evaluates to true if any of the variables matches
any flag name. The type of match defaults to ":is". any flag name. The type of match defaults to ":is".
If the list of variables is omitted, value of the internal variable If the list of variables is omitted, value of the internal variable
is used instead. is used instead.
Flagname comparisons is always done with the "i;ascii-casemap" The default comparator is "i;ascii-casemap", which is the same
operator, i.e., case-insensitive comparisons, as defined in [IMAP]. case-insensitive comparison as defined for IMAP flags by [IMAP].
The "relational" extension [RELATIONAL] adds a match type called
":count". The :count of a variable returns the number of distinct
flags in it. The count of a list of variables is the sum of the
counts of the member variables.
Example: Example:
If the variable "MyFlags" has the value "A B", the following test If the variable "MyFlags" has the value "A B", the following test
hasflag :is "MyFlags" "b A" hasflag :is "MyFlags" "b A"
evaluates to true. The above test can be also written as evaluates to true. The above test can be also written as
hasflag "MyFlags" ["b","A"] hasflag "MyFlags" ["b","A"]
Example:
If the variable "MyVar" has value "NonJunk Junk gnus-forward
$Forwarded NotJunk JunkRecorded $Junk $NotJunk", the following
tests evaluate to true:
hasflag :contains "MyVar" "Junk"
hasflag :contains "MyVar" "forward"
hasflag :contains "MyVar" ["label", "forward"]
hasflag :contains "MyVar" ["junk", "forward"]
Note that the last of these tests can be rewritten
as
hasflag :contains "MyVar" "junk forward"
or
hasflag :contains "MyVar" "forward junk"
However the last two forms are not recommended.
And the following test will evaluate to false:
hasflag :contains "MyVar" "label"
hasflag :contains "MyVar" "label"
Example:
If the variable "MyFlags" has the value "A B", the following test
hasflag :count "ge" :comparator "i;ascii-numeric"
"MyFlags" "2"
evaluates to true, as the variable contains 2 distinct flags.
5. Tagged argument :flags 5. Tagged argument :flags
This specification adds a new optional tagged argument ":flags" that This specification adds a new optional tagged argument ":flags" that
alter the behavior of actions "keep" and "fileinto". alter the behavior of actions "keep" and "fileinto".
The :flags tagged argument specifies that the flags provided in the The :flags tagged argument specifies that the flags provided in the
subsequent argument should be set when fileinto/keep delivers the subsequent argument should be set when fileinto/keep delivers the
message to the target mailbox/user's main mailbox. If the :flags message to the target mailbox/user's main mailbox. If the :flags
tagged argument is not specified, "keep" or "fileinto" will use tagged argument is not specified, "keep" or "fileinto" will use
the current value of the internal variable when delivering message the current value of the internal variable when delivering message
skipping to change at line 413 skipping to change at line 469
fileinto "INBOX.From Boss"; fileinto "INBOX.From Boss";
are equivalent. are equivalent.
This document doesn't dictate how the Sieve interpreter will set This document doesn't dictate how the Sieve interpreter will set
the [IMAP] flags. In particular, the Sieve interpreter may work as the [IMAP] flags. In particular, the Sieve interpreter may work as
an IMAP client, or may have direct access to the mailstore. an IMAP client, or may have direct access to the mailstore.
6. Interaction with Other Sieve Actions 6. Interaction with Other Sieve Actions
This extension work only on the message that is currently being This extension works only on the message that is currently being
processed by Sieve, it doesn't affect another message generated processed by Sieve, it doesn't affect another message generated
as a side affect of any action. as a side affect of any action.
The extension decribed in this document doesn't change the implicit The extension decribed in this document doesn't change the implicit
keep (see section 2.10.2 of [SIEVE]). keep (see section 2.10.2 of [SIEVE]).
7. Other Considerations 7. Other Considerations
This extension intentionally doesn't allow setting [IMAP] flags on This extension intentionally doesn't allow setting [IMAP] flags on
an arbitrary message in the [IMAP] message store. an arbitrary message in the [IMAP] message store.
8. Security Considerations 8. Security Considerations
Security considerations are discussed in the [IMAP], [SIEVE] and Security considerations are discussed in the [IMAP], [SIEVE] and
[VARIABLES]. [VARIABLES].
It is believed that this extension doesn't introduce any additional It is believed that this extension doesn't introduce any additional
security concerns. security concerns.
9. Extended example 9. IANA Considerations
The following template specifies the IANA registration of the
variables Sieve extension specified in this document:
To: iana@iana.org
Subject: Registration of new Sieve extension
Capability name: imap4flags
Capability keyword: imap4flags
Capability arguments: N/A
Standards Track/IESG-approved experimental RFC number:
this RFC
Person and email address to contact for further information:
Alexey Melnikov
<alexey.melnikov@isode.com>
This information should be added to the list of sieve extensions
given on http://www.iana.org/assignments/sieve-extensions.
10. Extended example
# #
# Example Sieve Filter # Example Sieve Filter
# Declare any optional features or extension used by the script # Declare any optional features or extension used by the script
# #
require ["fileinto", "imap4flags", "variables"]; require ["fileinto", "imap4flags", "variables"];
# #
# Move large messages to a special mailbox # Move large messages to a special mailbox
# #
skipping to change at line 502 skipping to change at line 578
remove "MyFlags" "\\Flagged"; remove "MyFlags" "\\Flagged";
fileinto :flags "${MyFlags}" "spam"; fileinto :flags "${MyFlags}" "spam";
} }
else else
{ {
# Move all other external mail to "personal" # Move all other external mail to "personal"
# folder. # folder.
fileinto :flags "${MyFlags}" "personal"; fileinto :flags "${MyFlags}" "personal";
} }
10. Acknowledgments 11. Acknowledgments
This document has been revised in part based on comments and This document has been revised in part based on comments and
discussions which took place on and off the Sieve mailing list. discussions which took place on and off the Sieve mailing list.
The help of those who took the time to review the draft and make The help of those who took the time to review the draft and make
suggestions is appreciated, especially that of Tim Showalter, suggestions is appreciated, especially that of Tim Showalter,
Barry Leiba, Randall Gellens, Ken Murchison, Cyrus Daboo, Barry Leiba, Randall Gellens, Ken Murchison, Cyrus Daboo,
Matthew Elvey, Jutta Degener, Ned Freed, Marc Mutz, Nigel Swinson, Matthew Elvey, Jutta Degener, Ned Freed, Marc Mutz, Nigel Swinson,
Kjetil Torgrim Homme, Mark E. Mallett, Dave Cridland, Kjetil Torgrim Homme, Mark E. Mallett, Dave Cridland,
Arnt Gulbrandsen and Philip Guenther. Arnt Gulbrandsen and Philip Guenther.
Special thanks to Tony Hansen and David Lamb for helping me Special thanks to Tony Hansen and David Lamb for helping me
better explain the concept. better explain the concept.
11. Author's Address 12. Author's Address
Alexey Melnikov Alexey Melnikov
Isode Limited Isode Limited
5 Castle Business Village 5 Castle Business Village
Hampton, Middlesex Hampton, Middlesex
United Kingdom, TW12 2BX United Kingdom, TW12 2BX
Email: alexey.melnikov@isode.com Email: alexey.melnikov@isode.com
12. Normative References 13. Normative References
[SIEVE] Guenther, P. and T. Showalter, "Sieve: An Email Filtering [SIEVE] Guenther, P. and T. Showalter, "Sieve: An Email Filtering
Language", work in progress, I-D draft-ietf-sieve-3028bis. Language", work in progress, I-D draft-ietf-sieve-3028bis.
[KEYWORDS] Bradner, S., "Keywords for use in RFCs to Indicate [KEYWORDS] Bradner, S., "Keywords for use in RFCs to Indicate
Requirement Levels", Harvard University, RFC 2119, March 1997. Requirement Levels", Harvard University, RFC 2119, March 1997.
[IMAP] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION [IMAP] Crispin, M., "INTERNET MESSAGE ACCESS PROTOCOL - VERSION
4rev1", University of Washington, RFC 3501, March 2003. 4rev1", University of Washington, RFC 3501, March 2003.
[VARIABLES] Homme, K. T., "Sieve -- Variables Extension", University [VARIABLES] Homme, K. T., "Sieve -- Variables Extension", University
of Oslo, work in progress, draft-ietf-sieve-variables-XX.txt of Oslo, work in progress, draft-ietf-sieve-variables-XX.txt
13. Intellectual Property Statement [RELATIONAL] Leiba, B. and Segmuller, W., "Sieve Extension:
Relational Tests", Work in Progress, draft-ietf-sieve-3431bis-XX.txt
14. Intellectual Property 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 Rights or other rights that might be claimed Intellectual Property Rights or other rights that might be claimed
to pertain to the implementation or use of the technology to pertain to the implementation or use of the technology
described in this document or the extent to which any license described in this document or the extent to which any license
under such rights might or might not be available; nor does it under such rights might or might not be available; nor does it
represent that it has made any independent effort to identify any represent that it has made any independent effort to identify any
such rights. Information on the procedures with respect to rights such rights. Information on the procedures with respect to rights
in RFC documents can be found in BCP 78 and BCP 79. in RFC documents can be found in BCP 78 and BCP 79.
skipping to change at line 566 skipping to change at line 645
of such proprietary rights by implementers or users of this of such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository specification can be obtained from the IETF on-line IPR repository
at http://www.ietf.org/ipr. at http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention The IETF invites any interested party to bring to its attention
any copyrights, patents or patent applications, or other any copyrights, patents or patent applications, or other
proprietary rights that may cover technology that may be required proprietary rights that may cover technology that may be required
to implement this standard. Please address the information to the to implement this standard. Please address the information to the
IETF at ietf-ipr@ietf.org. IETF at ietf-ipr@ietf.org.
14. Full Copyright Statement 15. Full Copyright Statement
Copyright (C) The Internet Society (2006). Copyright (C) The Internet Society (2006).
This document is subject to the rights, licenses and restrictions This document is subject to the rights, licenses and restrictions
contained in BCP 78, and except as set forth therein, the authors contained in BCP 78, and except as set forth therein, the authors
retain all their rights. retain all their rights.
This document and the information contained herein are provided on This document and the information contained herein are provided on
an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE
REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND
 End of changes. 14 change blocks. 
17 lines changed or deleted 96 lines changed or added

This html diff was produced by rfcdiff 1.28, available from http://www.levkowetz.com/ietf/tools/rfcdiff/