draft-ietf-imapext-thread-02.txt   draft-ietf-imapext-thread-03.txt 
IMAP Extensions Working Group M. Crispin IMAP Extensions Working Group M. Crispin
Internet Draft: IMAP THREAD K. Murchison Internet Draft: IMAP THREAD K. Murchison
Document: internet-drafts/draft-ietf-imapext-thread-02.txt August 2000 September 2000
Document: internet-drafts/draft-ietf-imapext-thread-03.txt
INTERNET MESSAGE ACCESS PROTOCOL - THREAD EXTENSION INTERNET MESSAGE ACCESS PROTOCOL - THREAD EXTENSION
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 page 1, line 34 skipping to change at page 1, line 35
The list of current Internet-Drafts can be accessed at The list of current Internet-Drafts can be accessed at
http://www.ietf.org/ietf/1id-abstracts.txt http://www.ietf.org/ietf/1id-abstracts.txt
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 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. editor as a Proposed Standard for the Internet Community.
Discussion and suggestions for improvement are requested, and should Discussion and suggestions for improvement are requested, and should
be sent to ietf-imapext@IMC.ORG. This document will expire before 1 be sent to ietf-imapext@IMC.ORG. This document will expire before 20
March 2001. Distribution of this memo is unlimited. March 2001. Distribution of this memo is unlimited.
Abstract Abstract
This document describes the server-based threading extension to the This document describes the server-based threading extension to the
IMAP4rev1 protocol. This extension provides substantial performance IMAP4rev1 protocol. This extension provides substantial performance
improvements for IMAP clients which offer threaded views. improvements for IMAP clients which offer threaded views.
A server which supports this extension indicates this with more or A server which supports this extension indicates this with one or
more capability names consisting of "THREAD=" followed by a supported more capability names consisting of "THREAD=" followed by a supported
threading algorithm name as described in this document. This threading algorithm name as described in this document. This
provides for future upwards-compatible extensions. provides for future upwards-compatible extensions.
Extracted Subject Text Extracted Subject Text
Threading uses a version of the subject which has specific subject Threading uses a version of the subject which has specific subject
artifacts of deployed Internet mail software removed. Due to the artifacts of deployed Internet mail software removed. Due to the
complexity of these artifacts, the formal syntax for the subject complexity of these artifacts, the formal syntax for the subject
extraction rules is ambiguous. The following procedure is followed extraction rules is ambiguous. The following procedure is followed
to determining the actual "base subject" which is used to thread: to determine the actual "base subject" which is used to thread:
(1) Convert any RFC 2047 encoded-words in the subject to (1) Convert any RFC 2047 encoded-words in the subject to
UTF-8. Convert all tabs and continuations to space. UTF-8. Convert all tabs and continuations to space.
Convert all multiple spaces to a single 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.
(3) Remove all prefix text of the subject that matches the (3) Remove all prefix text of the subject that matches the
skipping to change at page 2, line 42 skipping to change at page 2, line 42
(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 (7) The resulting text is the "base subject" used in
threading. threading.
All servers and disconnected clients MUST use exactly this algorithm All servers and disconnected clients MUST use exactly this algorithm
when threading. Otherwise there is potential for a user to get when threading. Otherwise there is potential for a user to get
inconsistant results based on whether they are running in connected inconsistent results based on whether they are running in connected
or disconnected IMAP mode. or disconnected IMAP mode.
Additional Commands Additional Commands
This command is an extension to the IMAP4rev1 base protocol. This command is an extension to the IMAP4rev1 base protocol.
The section header is intended to correspond with where it would be The section header is intended to correspond with where it would be
located in the main document if it was part of the base located in the main document if it was part of the base
specification. specification.
skipping to change at page 4, line 25 skipping to change at page 4, line 25
together in parent/child relationships based on which messages together in parent/child relationships based on which messages
are replies to others. The parent/child relationships are are replies to others. The parent/child relationships are
built using two methods: reconstructing a message's ancestry built using two methods: reconstructing a message's ancestry
using the references contained within it; and checking the using the references contained within it; and checking the
subject of a message to see if it is a reply to (or forward of) subject of a message to see if it is a reply to (or forward of)
another. another.
The references used for reconstructing a message's ancestry are The references used for reconstructing a message's ancestry are
found using the following rules: found using the following rules:
If a message contains a [NEWS]-style References header, then If a message contains a [NEWS]-style References header line,
use the Message-IDs in this header as the references. then use the Message IDs in the References header line as
the references.
If a message does not contain a References header, or the If a message does not contain a References header line, or
header does not contain any Message-IDs, then use the first the References header line does not contain any valid
(if any) Message-ID found in the In-Reply-To header as the Message IDs, then use the first (if any) valid Message ID
only reference (parent) for this message. found in the In-Reply-To header line as the only reference
(parent) for this message.
If a message does not contain an In-Reply-To header, or the NOTE: Although RFC 822 permits multiple Message IDs in
header does not contain a Message-ID, then the message does the In-Reply-To header, in actual practice this
not have any references (NIL). discipline has not been followed. For example, In-
Reply-To headers have been observed with email addresses
after the Message ID, and there are no good heuristics
for software to determine the difference. This is not a
problem with the References header however.
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
ID, then the message does not have any references (NIL).
The REFERENCES algorithm is significantly more complex than The REFERENCES algorithm is significantly more complex than
ORDEREDSUBJECT and consists of five main steps. These steps ORDEREDSUBJECT and consists of five main steps. These steps
are outlined in detail below. are outlined in detail below.
(1) For each searched message: (1) For each searched message:
(A) Using the Message-IDs in the message's references, link (A) Using the Message IDs in the message's references, link
the corresponding messages together as parent/child. Make the corresponding messages (those whose Message-ID header
the first reference the parent of the second (and the second line contains the given reference Message ID) together as
a child of the first), the second the parent of the third parent/child. Make the first reference the parent of the
(and the third a child of the second), etc. The following second (and the second a child of the first), the second the
rules govern the creation of these links: parent of the third (and the third a child of the second),
etc. The following rules govern the creation of these
links:
If no reference message can be found with a given If a message does not contain a Message-ID header line,
Message-ID, create a dummy message with this ID. Use or the Message-ID header line does not contain a valid
this dummy message for all subsequent references to this Message ID, then assign a unique Message ID to this
ID. message.
If a reference message already has a parent, don't change If two or more messages have the same Message ID, assign
the existing link. a unique Message ID to each of the duplicates.
If no message can be found with a given Message ID,
create a dummy message with this ID. Use this dummy
message for all subsequent references to this ID.
If a message already has a parent, don't change the
existing link. This is done because the References
header line may have been truncated by a MUA. As a
result, there is no guarantee that the messages
corresponding to adjacent Message IDs in the References
header line are parent and child.
Do not create a parent/child link if creating that link Do not create a parent/child link if creating that link
would introduce a loop. For example, before making would introduce a loop. For example, before making
message A the parent of B, make sure that A is not a message A the parent of B, make sure that A is not a
descendent of B. descendent of B.
(B) Create a parent/child link between the last reference (B) Create a parent/child link between the last reference
(or NIL if there are no references) and the current message. (or NIL if there are no references) and the current message.
If the current message has a parent already, break the If the current message already has a parent, it is probably
current parent/child link before creating the new one. Note the result of a truncated References header line, so break
the current parent/child link before creating the new
correct one. As in step 1.A, do not create the parent/child
link if creating that link would introduce a loop. Note
that if this message has no references, that it will now that if this message has no references, that it will now
have no parent. have no parent.
NOTE: The parent/child links MUST be kept consistent with NOTE: The parent/child links created in steps 1.A and 1.B
one another at ALL times. MUST be kept consistent with one another at ALL times.
(2) Gather together all of the messages that have no parents (2) Gather together all of the messages that have no parents
and make them all children (siblings of one another) of a dummy and make them all children (siblings of one another) of a dummy
parent (the "root"). These messages constitute first messages parent (the "root"). These messages constitute the first
of the threads created thus far. (head) message of the threads created thus far.
(3) Prune dummy messages from the thread tree. Traverse each (3) Prune dummy messages from the thread tree. Traverse each
thread under the root, and for each message: thread under the root, and for each message:
If it is a dummy message with NO children, delete it. If it is a dummy message with NO children, delete it.
If it is a dummy message with children, delete it, but If it is a dummy message with children, delete it, but
promote its children to the current level. In other words, promote its children to the current level. In other words,
splice them in with the dummy's siblings. splice them in with the dummy's siblings.
Do not promote the children if doing so would make them Do not promote the children if doing so would make them
children of the root, unless there is only one child. children of the root, unless there is only one child.
(4) Gather together messages under the root that have the same (4) Gather together messages under the root that have the same
extracted subject text. extracted subject text.
(A) Create a table for associating extracted subjects with (A) Create a table for associating extracted subjects with
messages. messages.
(B) Populate the subject table with one message per (B) Populate the subject table with one message per
extracted subject. For each message under the root: extracted subject. For each child of the root:
(i) Find the subject of this thread by extracting the (i) Find the subject of this thread by extracting the
base subject from the current message, or its first child base subject from the current message, or its first child
if the current message is a dummy. if the current message is a dummy.
(ii) Lookup the message associated with this extracted (ii) If the extracted subject is empty, skip this
message.
(iii) Lookup the message associated with this extracted
subject in the table. subject in the table.
(iii) If there is no message in the table with this (iv) If there is no message in the table with this
subject, add the current message and the extracted subject, add the current message and the extracted
subject to the subject table. subject to the subject table.
Otherwise, replace the message in the table with the Otherwise, replace the message in the table with the
current message if either of the following criteria are current message if the message in the table is not a
true: dummy AND either of the following criteria are true:
The current message is a dummy and the one in the The current message is a dummy, OR
table is not, OR
The message in the table is a reply or forward (its The message in the table is a reply or forward (its
original subject contains a subj-refwd part and/or a original subject contains a subj-refwd part and/or a
"(fwd)" subj-trailer) and the current message is not. "(fwd)" subj-trailer) and the current message is not.
(C) Merge threads with the same subject. For each message (C) Merge threads with the same subject. For each child of
under the root: the root:
(i) Find the subject of this thread as in step 4.B.i (i) Find the subject of this thread as in step 4.B.i
above. above.
(ii) Lookup the message associated with this extracted (ii) If the extracted subject is empty, skip this
message.
(iii) Lookup the message associated with this extracted
subject in the table. subject in the table.
(iii) If the message in the table is the current message, (iv) If the message in the table is the current message,
skip it. skip this message.
Otherwise, merge the current message with the one in the Otherwise, merge the current message with the one in the
table using the following rules: table using the following rules:
If both messages are dummies, append the current If both messages are dummies, append the current
message's children to the children of the message in message's children to the children of the message in
the table (the children of both messages become the table (the children of both messages become
siblings), and then delete the current message. siblings), and then delete the current message.
If the message in the table is a dummy and the current If the message in the table is a dummy and the current
message is not, make the current message a child of message is not, make the current message a child of
the message in the table (a sibling of it's children). the message in the table (a sibling of it's children).
If the current message is a reply or forward and the If the current message is a reply or forward and the
message in the table is not, make the current message message in the table is not, make the current message
a child of the message in the table (a sibling of it's a child of the message in the table (a sibling of it's
children). children).
Otherwise, create a new dummy container and make both Otherwise, create a new dummy message and make both
messages children of the dummy, and replace the the current message and the message in the table
message in the table with the dummy message. children of the dummy. Then replace the message in
the table with the dummy message.
(5) Traverse the messages under the root and sort each set of (5) Traverse the messages under the root and sort each set of
siblings by date. In the case of an exact match on date, use siblings by date. Traverse the messages in such a way that the
the order in which they appear in the mailbox (that is, by "youngest" set of siblings are sorted first, and the "oldest"
sequence number) to determine the order. In the case of a set of siblings are sorted last (grandchildren are sorted
dummy message (which can occur with top-level siblings), use before children, etc). In the case of an exact match on date,
the first child for sorting. use the order in which the messages appear in the mailbox (that
is, by sequence number) to determine the order. In the case of
a dummy message (which can only occur with top-level siblings),
use its first child for sorting.
Example: C: A283 THREAD ORDEREDSUBJECT UTF-8 SINCE 5-MAR-2000 Example: C: A283 THREAD ORDEREDSUBJECT UTF-8 SINCE 5-MAR-2000
S: * THREAD (166)(167)(168)(169)(172)(170)(171) S: * THREAD (166)(167)(168)(169)(172)(170)(171)
(173)(174 175 176 178 181 180)(179)(177 183 (173)(174 175 176 178 181 180)(179)(177 183
182 188 184 185 186 187 189)(190)(191)(192) 182 188 184 185 186 187 189)(190)(191)(192)
(193)(194 195)(196 197 198)(199)(200 202)(201) (193)(194 195)(196 197 198)(199)(200 202)(201)
(203)(204)(205)(206 207)(208) (203)(204)(205)(206 207)(208)
S: A283 OK THREAD completed S: A283 OK THREAD completed
C: A284 THREAD ORDEREDSUBJECT US-ASCII TEXT "gewp" C: A284 THREAD ORDEREDSUBJECT US-ASCII TEXT "gewp"
S: * THREAD S: * THREAD
skipping to change at page 9, line 7 skipping to change at page 10, line 7
\-- 6 \-- 6
|-- 4 |-- 4
| \-- 23 | \-- 23
| |
\-- 44 \-- 44
\-- 7 \-- 7
\-- 96 \-- 96
Example: S: * THREAD ((3)(5)) Example: S: * THREAD ((3)(5))
In this example, 3 and 5 are siblings of a parent which does not In this example, 3 and 5 are siblings of a parent which does not
exist in the mailbox; however they are members of the same thread. match the search critieria (and/or does not exist in the mailbox);
however they are members of the same thread.
Formal Syntax of THREAD commands and Responses Formal Syntax of THREAD commands and Responses
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
skipping to change at page 11, line 15 skipping to change at page 12, line 15
Security Considerations Security Considerations
Security issues are not discussed in this memo. Security issues are not discussed in this memo.
Internationalization Considerations Internationalization Considerations
By default, strings are threaded according to the "minimum sorting By default, strings are threaded according to the "minimum sorting
collation algorithm". All implementations of THREAD MUST implement collation algorithm". All implementations of THREAD MUST implement
the minimum sorting collation algorithm. the minimum sorting collation algorithm.
In the minimum sorting collation algorithm, the 26 Latin alphabetics In the minimum sorting collation algorithm, the Basic Latin
are sorted in a case-insensitive fashion; that is, "A" and "a" are alphabetics (U+0041 to U+005A uppercase, U+0061 to U+007A lowercase)
treated as exact equals. All other characters are sorted according are sorted in a case-insensitive fashion; that is, "A" (U+0041) and
to their octet values, as expressed in UTF-8. No attempt is made to "a" (U+0061) are treated as exact equals. The characters U+005B to
treat composed characters specially. U+0060 are sorted after the Basic Latin alphabetics; for example,
U+005E is sorted after U+005A and U+007A. All other characters are
sorted according to their octet values, as expressed in UTF-8. No
attempt is made to treat composed characters specially, or to do
case-insensitive comparisons of composed characters.
Note: this means, among other things, that the composed
characters in the Latin-1 Supplement are not compared in
what would be considered an ISO 8859-1 "case-insensitive"
fashion. Case comparison rules for characters with
diacriticals differ between languages; the minimum sorting
collation does not attempt to deal with this at all. This
is reserved for other sorting collations, which may be
language-specific.
Other sorting collations, and the ability to change the sorting Other sorting collations, and the ability to change the sorting
collation, will be defined in a separate document dealing with IMAP collation, will be defined in a separate document dealing with IMAP
internationalization. internationalization.
It is anticipated that there will be a generic Unicode sorting It is anticipated that there will be a generic Unicode sorting
collation, which will provide generic case-insensitivity for collation, which will provide generic case-insensitivity for
alphabetic scripts, specification of composed character handling, and alphabetic scripts, specification of composed character handling, and
language-specific sorting collations. A server which implements language-specific sorting collations. A server which implements
non-default sorting collations will modify its sorting behavior non-default sorting collations will modify its sorting behavior
 End of changes. 

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