draft-ietf-imapext-sort-14.txt   draft-ietf-imapext-sort-15.txt 
IMAP Extensions Working Group M. Crispin IMAP Extensions Working Group M. Crispin
INTERNET-DRAFT: IMAP SORT K. Murchison INTERNET-DRAFT: IMAP SORT K. Murchison
Document: internet-drafts/draft-ietf-imapext-sort-14.txt December 2003 Document: internet-drafts/draft-ietf-imapext-sort-15.txt April 2004
INTERNET MESSAGE ACCESS PROTOCOL - SORT AND THREAD EXTENSIONS INTERNET MESSAGE ACCESS PROTOCOL - SORT AND THREAD EXTENSIONS
Status of this Memo Status of this Memo
This document is an Internet-Draft and is in full conformance with This document is an Internet-Draft and is in full conformance with
all provisions of Section 10 of RFC 2026. all provisions of Section 10 of RFC 2026.
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF), its areas, and its working groups. Note that Task Force (IETF), its areas, and its working groups. Note that
skipping to change at line 35 skipping to change at line 35
To view the list Internet-Draft Shadow Directories, see To view the list Internet-Draft Shadow Directories, see
http://www.ietf.org/shadow.html. http://www.ietf.org/shadow.html.
A revised version of this document will be submitted to the RFC A revised version of this document will be submitted to the RFC
editor as an Informational Document for the Internet Community. editor as an Informational Document for the Internet Community.
A revised version of this draft document will be submitted to the RFC A revised version of this draft document will be submitted to the RFC
editor as a Proposed Standard for the Internet Community. Discussion editor as a Proposed Standard for the Internet Community. Discussion
and suggestions for improvement are requested, and should be sent to and suggestions for improvement are requested, and should be sent to
ietf-imapext@IMC.ORG. This document will expire before 1 June 2004. ietf-imapext@IMC.ORG. This document will expire before 7 October 2004.
Distribution of this memo is unlimited. Distribution of this memo is unlimited.
Abstract Abstract
This document describes the base-level server-based sorting and This document describes the base-level server-based sorting and
threading extensions to the [IMAP] protocol. These extensions threading extensions to the [IMAP] protocol. These extensions
provide substantial performance improvements for IMAP clients which provide substantial performance improvements for IMAP clients which
offer sorted and threaded views. offer sorted and threaded views.
1. Introduction 1. Introduction
skipping to change at line 81 skipping to change at line 81
"User" is used to refer to a human user, whereas "client" refers to "User" is used to refer to a human user, whereas "client" refers to
the software being run by the user. the software being run by the user.
In examples, "C:" and "S:" indicate lines sent by the client and In examples, "C:" and "S:" indicate lines sent by the client and
server respectively. server respectively.
2.1 Base Subject 2.1 Base Subject
Subject sorting and threading use the "base subject," which has Subject sorting and threading use the "base subject," which has
specific subject artifacts of deployed Internet mail software specific subject artifacts removed. Due to the complexity of these
removed. Due to the complexity of these artifacts, the formal syntax artifacts, the formal syntax for the subject extraction rules is
for the subject extraction rules is ambiguous. The following ambiguous. The following procedure is followed to determine the
procedure is followed to determine the actual "base subject" which is actual "base subject" which is used to sort by subject, using the
used to sort by subject: [ABNF] formal syntax rules described in section 5:
(1) Convert any RFC 2047 encoded-words in the subject to (1) Convert any RFC 2047 encoded-words in the subject to
UTF-8 as described in "internationalization UTF-8 as described in "internationalization
considerations." Convert all tabs and continuations to considerations." Convert all tabs and continuations to
space. Convert all multiple spaces to a single space. space. Convert all multiple spaces to a single space.
(2) Remove all trailing text of the subject that matches (2) Remove all trailing text of the subject that matches
the subj-trailer ABNF, repeat until no more matches are the subj-trailer ABNF, repeat until no more matches are
possible. possible.
skipping to change at line 115 skipping to change at line 115
Note: it is possible to defer step (2) until step (6), but this Note: it is possible to defer step (2) until step (6), but this
requires checking for subj-trailer in step (4). requires checking for subj-trailer in step (4).
(6) If the resulting text begins with the subj-fwd-hdr ABNF (6) If the resulting text begins with the subj-fwd-hdr ABNF
and ends with the subj-fwd-trl ABNF, remove the and ends with the subj-fwd-trl ABNF, remove the
subj-fwd-hdr and subj-fwd-trl and repeat from step (2). subj-fwd-hdr and subj-fwd-trl and repeat from step (2).
(7) The resulting text is the "base subject" used in the (7) The resulting text is the "base subject" used in the
SORT. SORT.
All servers and disconnected (as described in [IMAP-MODEL] clients All servers and disconnected (as described in [IMAP-MODEL]) clients
MUST use exactly this algorithm when sorting by subject. Otherwise MUST use exactly this algorithm when sorting by subject. Otherwise
there is potential for a user to get inconsistent results based on there is potential for a user to get inconsistent results based on
whether they are running in connected or disconnected IMAP mode. whether they are running in connected or disconnected mode.
2.2 Sent Date 2.2 Sent Date
As used in this document, the term "sent date" refers to the date and As used in this document, the term "sent date" refers to the date and
time from the Date: header, adjusted by time zone to normalize to UTC. time from the Date: header, adjusted by time zone to normalize to UTC.
For example, "31 Dec 2000 16:01:33 -0800" is equivalent to the UTC For example, "31 Dec 2000 16:01:33 -0800" is equivalent to the UTC
date and time of "1 Jan 2001 00:01:33 +0000". date and time of "1 Jan 2001 00:01:33 +0000".
If the time zone is invalid, the date and time SHOULD be treated as UTC. If the time zone is invalid, the date and time SHOULD be treated as UTC.
If the time is also invalid, the time SHOULD be treated as 00:00:00. If If the time is also invalid, the time SHOULD be treated as 00:00:00. If
there is no valid date or time, the date and time SHOULD be treated as there is no valid date or time, the date and time SHOULD be treated as
00:00:00 on the earliest possible date. 00:00:00 on the earliest possible date.
This differs from the date-related criteria in SEARCH, which use just This differs from the date-related criteria in the SEARCH command
the date and not the time, and are not adjusted by time zone. (described in [IMAP] section 6.4.4), which use just the date and not
the time, and are not adjusted by time zone.
3. Additional Commands 3. Additional Commands
These commands are extension to the [IMAP] base protocol. These commands are extension to the [IMAP] base protocol.
The section headings are intended to correspond with where they would The section headings are intended to correspond with where they would
be located in the main document if they were part of the base be located in the main document if they were part of the base
specification. specification.
BASE.6.4.SORT. SORT Command BASE.6.4.SORT. SORT Command
skipping to change at line 166 skipping to change at line 167
The SORT command is a variant of SEARCH with sorting semantics for The SORT command is a variant of SEARCH with sorting semantics for
the results. Sort has two arguments before the searching criteria the results. Sort has two arguments before the searching criteria
argument; a parenthesized list of sort criteria, and the searching argument; a parenthesized list of sort criteria, and the searching
charset. charset.
The charset argument is mandatory (unlike SEARCH) and indicates The charset argument is mandatory (unlike SEARCH) and indicates
the [CHARSET] of the strings that appear in the searching criteria. the [CHARSET] of the strings that appear in the searching criteria.
The US-ASCII and UTF-8 charsets MUST be implemented. All other The US-ASCII and UTF-8 charsets MUST be implemented. All other
charsets are optional. charsets are optional.
There is also a UID SORT command which corresponds to SORT the way There is also a UID SORT command which returns unique identifiers
that UID SEARCH corresponds to SEARCH. instead of message sequence numbers. Note that there are separate
searching criteria for message sequence numbers and UIDs; thus the
arguments to UID SORT are interpreted the same as in SORT. This is
analogous to the behavior of UID SEARCH, as opposed to UID COPY, UID
FETCH, or UID STORE.
The SORT command first searches the mailbox for messages that The SORT command first searches the mailbox for messages that
match the given searching criteria using the charset argument for match the given searching criteria using the charset argument for
the interpretation of strings in the searching criteria. It then the interpretation of strings in the searching criteria. It then
returns the matching messages in an untagged SORT response, sorted returns the matching messages in an untagged SORT response, sorted
according to one or more sort criteria. according to one or more sort criteria.
Sorting is in ascending order. Earlier dates sort before later Sorting is in ascending order. Earlier dates sort before later
dates; smaller sizes sort before larger sizes; and strings are dates; smaller sizes sort before larger sizes; and strings are
sorted according to ascending values established by their sorted according to ascending values established by their
skipping to change at line 272 skipping to change at line 277
The THREAD command is a variant of SEARCH with threading semantics The THREAD command is a variant of SEARCH with threading semantics
for the results. Thread has two arguments before the searching for the results. Thread has two arguments before the searching
criteria argument; a threading algorithm, and the searching criteria argument; a threading algorithm, and the searching
charset. charset.
The charset argument is mandatory (unlike SEARCH) and indicates The charset argument is mandatory (unlike SEARCH) and indicates
the [CHARSET] of the strings that appear in the searching criteria. the [CHARSET] of the strings that appear in the searching criteria.
The US-ASCII and UTF-8 charsets MUST be implemented. All other The US-ASCII and UTF-8 charsets MUST be implemented. All other
charsets are optional. charsets are optional.
There is also a UID THREAD command which corresponds to THREAD the There is also a UID THREAD command which returns unique identifiers
way that UID SEARCH corresponds to SEARCH. instead of message sequence numbers. Note that there are separate
searching criteria for message sequence numbers and UIDs; thus the
arguments to UID THREAD are interpreted the same as in THREAD. This is
analogous to the behavior of UID SEARCH, as opposed to UID COPY, UID
FETCH, or UID STORE.
The THREAD command first searches the mailbox for messages that The THREAD command first searches the mailbox for messages that
match the given searching criteria using the charset argument for match the given searching criteria using the charset argument for
the interpretation of strings in the searching criteria. It then the interpretation of strings in the searching criteria. It then
returns the matching messages in an untagged THREAD response, returns the matching messages in an untagged THREAD response,
threaded according to the specified threading algorithm. threaded according to the specified threading algorithm.
All collation is in ascending order. Earlier dates collate before All collation is in ascending order. Earlier dates collate before
later dates and strings are collated according to ascending values later dates and strings are collated according to ascending values
established by their collation algorithm (see under established by their collation algorithm (see under
skipping to change at line 361 skipping to change at line 370
If a message does not contain a References header line, or If a message does not contain a References header line, or
the References header line does not contain any valid the References header line does not contain any valid
Message IDs, then use the first (if any) valid Message ID Message IDs, then use the first (if any) valid Message ID
found in the In-Reply-To header line as the only reference found in the In-Reply-To header line as the only reference
(parent) for this message. (parent) for this message.
Note: Although [RFC 2822] permits multiple Message IDs in Note: Although [RFC 2822] permits multiple Message IDs in
the In-Reply-To header, in actual practice this the In-Reply-To header, in actual practice this
discipline has not been followed. For example, discipline has not been followed. For example,
In-Reply-To headers have been observed with email In-Reply-To headers have been observed with message
addresses after the Message ID, and there are no good addresses after the Message ID, and there are no good
heuristics for software to determine the difference. heuristics for software to determine the difference.
This is not a problem with the References header however. This is not a problem with the References header however.
If a message does not contain an In-Reply-To header line, or If a message does not contain an In-Reply-To header line, or
the In-Reply-To header line does not contain a valid Message the In-Reply-To header line does not contain a valid Message
ID, then the message does not have any references (NIL). ID, then the message does not have any references (NIL).
A message is considered to be a reply or forward if the base A message is considered to be a reply or forward if the base
subject extraction rules, applied to the original subject, subject extraction rules, applied to the original subject,
skipping to change at line 653 skipping to change at line 662
sort-key = "ARRIVAL" / "CC" / "DATE" / "FROM" / "SIZE" / sort-key = "ARRIVAL" / "CC" / "DATE" / "FROM" / "SIZE" /
"SUBJECT" / "TO" "SUBJECT" / "TO"
thread = ["UID" SP] "THREAD" SP thread-alg SP search-criteria thread = ["UID" SP] "THREAD" SP thread-alg SP search-criteria
thread-alg = "ORDEREDSUBJECT" / "REFERENCES" / thread-alg-ext thread-alg = "ORDEREDSUBJECT" / "REFERENCES" / thread-alg-ext
thread-alg-ext = atom thread-alg-ext = atom
; New algorithms MUST be registered with IANA ; New algorithms MUST be registered with IANA
; as standard or standards-track
search-criteria = charset 1*(SP search-key) search-criteria = charset 1*(SP search-key)
charset = astring charset = astring
; CHARSET values MUST be registered with IANA ; CHARSET values MUST be registered with IANA
sort-data = "SORT" *(SP nz-number) sort-data = "SORT" *(SP nz-number)
thread-data = "THREAD" [SP 1*thread-list] thread-data = "THREAD" [SP 1*thread-list]
thread-list = "(" thread-members / thread-nested ")" thread-list = "(" (thread-members / thread-nested) ")"
thread-members = nz-number *(SP nz-number) [SP thread-nested] thread-members = nz-number *(SP nz-number) [SP thread-nested]
thread-nested = 2*thread-list thread-nested = 2*thread-list
The following syntax describes base subject extraction rules (2)-(6): The following syntax describes base subject extraction rules (2)-(6):
subject = *subj-leader [subj-middle] *subj-trailer subject = *subj-leader [subj-middle] *subj-trailer
subj-refwd = ("re" / ("fw" ["d"])) *WSP [subj-blob] ":" subj-refwd = ("re" / ("fw" ["d"])) *WSP [subj-blob] ":"
skipping to change at line 692 skipping to change at line 700
subj-fwd-trl = "]" subj-fwd-trl = "]"
subj-leader = (*subj-blob subj-refwd) / WSP subj-leader = (*subj-blob subj-refwd) / WSP
subj-middle = *subj-blob (subj-base / subj-fwd) subj-middle = *subj-blob (subj-base / subj-fwd)
; last subj-blob is subj-base if subj-base would ; last subj-blob is subj-base if subj-base would
; otherwise be empty ; otherwise be empty
subj-trailer = "(fwd)" / WSP subj-trailer = "(fwd)" / WSP
subj-base = NONWSP *([*WSP] NONWSP) subj-base = NONWSP *(*WSP NONWSP)
; can be a subj-blob ; can be a subj-blob
BLOBCHAR = %x01-5a / %x5c / %x5e-7f BLOBCHAR = %x01-5a / %x5c / %x5e-7f
; any CHAR except '[' and ']' ; any CHAR except '[' and ']'
NONWSP = %x01-08 / %x0a-1f / %x21-7f NONWSP = %x01-08 / %x0a-1f / %x21-7f
; any CHAR other than WSP ; any CHAR other than WSP
6. Security Considerations 6. Security Considerations
The SORT and THREAD extensions do not raise any security The SORT and THREAD extensions do not raise any security
considerations that are not present in the base [IMAP] protocol, and considerations that are not present in the base [IMAP] protocol, and
these issues are discussed in [IMAP]. Nevertheless, it is important these issues are discussed in [IMAP]. Nevertheless, it is important
to remember that [IMAP] protocol transactions, including to remember that [IMAP] protocol transactions, including message
electronic mail data, are sent in the clear over the network unless data, are sent in the clear over the network unless protection from
protection from snooping is negotiated, either by the use of snooping is negotiated, either by the use of STARTTLS, privacy
STARTTLS, privacy protection is negotiated in the AUTHENTICATE protection is negotiated in the AUTHENTICATE command, or some other
command, or some other protection mechanism is in effect. protection mechanism is in effect.
7. Internationalization Considerations 7. Internationalization Considerations
Strings in charsets other than US-ASCII and UTF-8 must be converted Strings in charsets other than US-ASCII and UTF-8 must be converted
to UTF-8 prior to any comparisons. String comparisons used in SORT to UTF-8 prior to any comparisons. String comparisons used in SORT
and THREAD collations are performed as described in [IMAP-I18N]. and THREAD collations are performed as described in [IMAP-I18N].
Non-English translations of "Re" or "Fw"/"Fwd" are not specified for Translations of the "re" or "fw"/"fwd" tokens are not specified for
removal in the base subject extraction process. By specifying that removal in the base subject extraction process. An attempt to add such
only the English forms of the prefixes are used, it becomes a simple translated tokens would result in a geometrically complex, and
display time task to localize the prefix language for the user. If, ultimately unimplementable, task.
on the other hand, prefixes in multiple languages are permitted, the
result is a geometrically complex, and ultimately unimplementable, Instead, note that [RFC-2822] section 3.6.5 recommends that "re:" (from
task. In order to improve the ability to support non-English display the Latin "res", in the matter of) be used to identify a reply.
in Internet mail clients, only the English form of these prefixes Although it is evident that, from the multiple forms of token to
should be transmitted in Internet mail messages. identify a forwarded message, there is considerable variation found in
the wild, the variations are (still) manageable. Consequently, it is
suggested that "re:" and one of the variations of the tokens for forward
supported by the base subject extraction rules be adopted for Internet
mail messages, since doing so makes it a simple display time task to
localize the token language for the user.
8. IANA Considerations 8. IANA Considerations
[IMAP] capabilities are registered by publishing a standards track or [IMAP] capabilities are registered by publishing a standards track or
IESG approved experimental RFC. The registry is currently located IESG approved experimental RFC. This document constitutes registration
at: of the SORT and THREAD capabilities in the [IMAP] capabilities registry.
http://www.iana.org/assignments/imap4-capabilities
Threading algorithms are registered by publishing a standards track or
IESG approved experimental RFC. The registry is currently located at:
[to be defined by IANA]
This document consitutes registration of the SORT and THREAD This document creates a new [IMAP] threading algorithms registry, which
capabilities in the [IMAP] capabilities registry, as well as the registers threading algorithms by publishing a standards track or IESG
ORDEREDSUBJECT and REFERENCES algorithms in the [IMAP] threading approved experimental RFC. This document constitutes registration of
algorithms registry. the ORDEREDSUBJECT and REFERENCES algorithms in that registry.
Appendices Appendices
A. Normative References A. Normative References
The following documents are normative to this document: The following documents are normative to this document:
[ABNF] Crocker, D., and Overell, P. "Augmented BNF [ABNF] Crocker, D., and Overell, P. "Augmented BNF
for Syntax Specifications: ABNF", RFC 2234, for Syntax Specifications: ABNF", RFC 2234,
November 1997. November 1997.
skipping to change at line 804 skipping to change at line 810
Kenneth Murchison Kenneth Murchison
Oceana Matrix Ltd. Oceana Matrix Ltd.
21 Princeton Place 21 Princeton Place
Orchard Park, NY 14127 Orchard Park, NY 14127
Phone: (716) 662-8973 x26 Phone: (716) 662-8973 x26
EMail: ken@oceana.com EMail: ken@oceana.com
IPR Disclosure Acknowledgement
By submitting this Internet-Draft, I certify that any applicable
patent or other IPR claims of which I am aware have been disclosed,
and any of which I become aware will be disclosed, in accordance with
RFC 3668.
Intellectual Property Statement
The IETF takes no position regarding the validity or scope of any
intellectual property or other rights that might be claimed to
pertain to the implementation or use of the technology described in
this document or the extent to which any license under such rights
might or might not be available; neither does it represent that it
has made any effort to identify any such rights. Information on the
IETF's procedures with respect to rights in standards-track and
standards-related documentation can be found in BCP-11. Copies of
claims of rights made available for publication and any assurances of
licenses to be made available, or the result of an attempt made to
obtain a general license or permission for the use of such
proprietary rights by implementors or users of this specification can
be obtained from the IETF Secretariat.
The IETF invites any interested party to bring to its attention any
copyrights, patents or patent applications, or other proprietary
rights which may cover technology that may be required to practice
this standard. Please address the information to the IETF Executive
Director.
Full Copyright Statement Full Copyright Statement
Copyright (C) The Internet Society (2003). All Rights Reserved. Copyright (C) The Internet Society (2004). This document is subject
to the rights, licenses and restrictions contained in BCP 78 and
except as set forth therein, the authors retain all their rights.
This document and translations of it may be copied and furnished to This document and the information contained herein are provided on an
others, and derivative works that comment on or otherwise explain it "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE
or assist in its implementation may be prepared, copied, published REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE
and distributed, in whole or in part, without restriction of any INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR
kind, provided that the above copyright notice and this paragraph are IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
included on all such copies and derivative works. However, this THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
document itself may not be modified in any way, such as by removing WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
the copyright notice or references to the Internet Society or other
Internet organizations, except as needed for the purpose of
developing Internet standards in which case the procedures for
copyrights defined in the Internet Standards process must be
followed, or as required to translate it into languages other than
English.
The limited permissions granted above are perpetual and will not be Intellectual Property
revoked by the Internet Society or its successors or assigns.
This document and the information contained herein is provided on an The IETF takes no position regarding the validity or scope of any
"AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING Intellectual Property Rights or other rights that might be claimed
TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING to pertain to the implementation or use of the technology
BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION described in this document or the extent to which any license
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF under such rights might or might not be available; nor does it
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. represent that it has made any independent effort to identify any
such rights. Information on the procedures with respect to
rights in RFC documents can be found in BCP 78 and BCP 79.
Copies of IPR disclosures made to the IETF Secretariat and any
assurances of licenses to be made available, or the result of an
attempt made to obtain a general license or permission for the use
of such proprietary rights by implementers or users of this
specification can be obtained from the IETF on-line IPR repository
at http://www.ietf.org/ipr.
The IETF invites any interested party to bring to its attention
any copyrights, patents or patent applications, or other
proprietary rights that may cover technology that may be required
to implement this standard. Please address the information to the
IETF at ietf-ipr@ietf.org.
Acknowledgement Acknowledgement
Funding for the RFC Editor function is currently provided by the Funding for the RFC Editor function is currently provided by the
Internet Society. Internet Society.
 End of changes. 

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