Abstract: | This specification defines recommended handling of XMPP message threads. |
Authors: | Peter Saint-Andre, Ian Paterson, Kevin Smith |
Copyright: | © 1999 - 2010 XMPP Standards Foundation. SEE LEGAL NOTICES. |
Status: | Proposed |
Type: | Informational |
Version: | 0.8 |
Last Updated: | 2010-09-28 |
NOTICE: This document is currently within Last Call or under consideration by the XMPP Council for advancement to the next stage in the XSF standards process. The Last Call ends on 2010-07-30. Please send your feedback to the standards@xmpp.org discussion list.
1. Introduction
2. Motivation
3. Generation
3.1. Inclusion
3.2. New Threads
3.3. Child Threads
4. Handling
4.1. Chat Messages
4.2. Groupchat Messages
4.3. Normal Messages
4.4. Headline Messages
4.5. Messages That Have Been Archived
5. Security Considerations
6. IANA Considerations
7. XMPP Registrar Considerations
Appendices
A: Document Information
B: Author Information
C: Legal Notices
D: Relation to XMPP
E: Discussion Venue
F: Requirements Conformance
G: Notes
H: Revision History
Although message threads are re-used in XMPP extension protocols such as Chat State Notifications [1], best practices for generating and handling message threads have never been well specified (e.g., in RFC 3921 [2] or rfc3921bis [3]). This document attempts to clearly specify those matters for implementation by XMPP clients.
Threads matter because they enable XMPP clients to:
Depending on the type of the message (i.e., the value of the 'type' attribute), the <thread/> should be included as follows:
Message Type | Inclusion |
---|---|
chat | RECOMMENDED |
groupchat | RECOMMENDED |
headline | OPTIONAL |
normal | OPTIONAL |
Unless a <message/> stanza is written in direct reply to another <message/> stanza, if a ThreadID is included then its value SHOULD be newly generated when a human user initiates a chat conversation with another user (i.e., a <message/> stanza of type 'chat'), starts a new conversation in the context of a multi-user chat environment (i.e., a <message/> stanza of type 'groupchat'), or sends a normal message.
If the <message/> stanza is written in direct reply to another <message/> stanza, then the ThreadID SHOULD be the value from the the original <message/> stanza. (Determining what constitutes a <message/> stanza written in reply to another is a matter left to individual implementation, but it is envisaged that in most cases it would be the result of, e.g., the user clicking a 'reply' button when reading the contents of the previous stanza.)
In some situations, the conversation veers from the original topic. In this situation, it can be sensible to generate a new thread that is an offshoot or child of the original thread. The connection of the child thread to the parent thread is indicated by including the original ThreadID as the value of the 'parent' attribute.
<message to='romeo@example.net/orchard' from='juliet@example.com/balcony' id='asiwe8289ljfdalk' type='chat' xml:lang='en'> <body>Art thou not Romeo, and a Montague?</body> <thread parent='7edac73ab41e45c4aafa7b2d7b749080'> e0ffe42b28561960c6b12b944a092794b9683a38 </thread> </message>
In general, the XMPP <thread/> element is handled in a manner similar to the "References:" header field from email (see RFC 5322 [5]) and netnews (see RFC 5536 [6]), as well as the THREAD extension to IMAP (see RFC 5256 [7]). Detailed guidelines for particular XMPP message types are provided in the following sections.
For <message/> stanzas of type "chat" exchanged between two entities, the value of the <thread/> element shall be considered equivalent to a unique identifier for the chat session or conversation thread. If an entity receives such a message with a new or unknown ThreadID, it SHOULD treat the message as part of a new chat session. A client MAY destroy the thread when it goes offline, but SHOULD NOT destroy the thread if a human user merely disengages from the chat session (e.g., by closing a window in a client interface).
If an entity receives an XMPP presence stanza of type "unavailable" from the other entity during a chat session, it SHOULD NOT destroy the thread; instead, it SHOULD assume that the other entity will still be able to continue the session (perhaps the other entity was temporarily disconnected by a network error or is persisting the state of the session until it reconnects and receives "offline" messages).
If an entity receives a message of type "chat" without a thread ID, then it SHOULD create a new session with a new thread ID (and include that thread ID in all the messages it sends within the new session).
For <message/> stanzas of type "groupchat" exchanged between multiple entities in a Multi-User Chat [8] room or similar environment, the value of the <thread/> element shall be considered equivalent to a unique identifier for a conversation thread in the multi-user environment.
When displaying a threaded groupchat conversation within a user interface, a client SHOULD provide a visual indication of the thread to which a message belongs. Methods for such indications include (non-exhaustively) the grouping together of all messages from the same thread, providing an index of threads, or formatting all messages within a thread in a cohesive manner, e.g. with uniform coloring.
For <message/> stanzas of type "normal", the value of the <thread/> element shall be considered equivalent to a unique identifier for a conversation thread that proceeds outside the context of a "real-time" chat session or groupchat session.
When displaying threaded messages of type "normal" within a user interface, a client SHOULD provide a visual indication of the thread to which a message belongs. Methods for such indications include (non-exhaustively) the grouping together of all messages from the same thread, providing an index of threads, or formatting all messages within a thread in a cohesive manner, e.g. with uniform coloring.
There are no special handling requirements related to threads for <message/> stanzas of type "headline", because it is not expected that a client will allow the recipient to reply to such messages.
When displaying historical conversations within a user interface, a client SHOULD provide a visual indication of the thread to which a message belongs. Methods for such indications include (non-exhaustively) the grouping together of all messages from the same thread, providing an index of threads, or formatting all messages within a thread in a cohesive manner, e.g. with uniform coloring.
Several security considerations related to XMPP threads are described in rfc3921bis [9].
This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [10].
This document requires no interaction with the XMPP Registrar [11].
Series: XEP
Number: 0201
Publisher: XMPP Standards Foundation
Status:
Proposed
Type:
Informational
Version: 0.8
Last Updated: 2010-09-28
Approving Body: XMPP Council
Dependencies: XMPP Core
Supersedes: None
Superseded By: None
Short Name: N/A
Source Control:
HTML
RSS
This document in other formats:
XML
PDF
Email:
stpeter@jabber.org
JabberID:
stpeter@jabber.org
URI:
https://stpeter.im/
Email:
ian.paterson@clientside.co.uk
JabberID:
ian@zoofy.com
Email:
kevin@kismith.co.uk
JabberID:
kevin@doomsong.co.uk
The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.
The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.
Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.
Errata can be sent to <editor@xmpp.org>.
The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".
1. XEP-0085: Chat State Notifications <http://xmpp.org/extensions/xep-0085.html>.
2. RFC 3921: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://tools.ietf.org/html/rfc3921>.
3. rfc3921bis: proposed revisions to Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://tools.ietf.org/html/draft-ietf-xmpp-3921bis>. (work in progress)
4. XEP-0045: Multi-User Chat <http://xmpp.org/extensions/xep-0045.html>.
5. RFC 5322: Internet Message Format <http://tools.ietf.org/html/rfc5322>.
6. RFC 5536: Netnews Article Format <http://tools.ietf.org/html/rfc5536>.
7. RFC 5256: Internet Message Access Protocol - SORT and THREAD Extensions <http://tools.ietf.org/html/rfc5256>.
8. XEP-0045: Multi-User Chat <http://xmpp.org/extensions/xep-0045.html>.
9. rfc3921bis: proposed revisions to Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://tools.ietf.org/html/draft-ietf-xmpp-3921bis>. (work in progress)
10. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.
11. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <http://xmpp.org/registrar/>.
Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/
Expanded upon use with normal messages; cleaned up several matters in the text; added informational pointers to RFC 5322 (email) and RFC 5536 (netnews).
(psa)Removed definition of ThreadID syntax, semantics, and uniqueness because rfc3921bis covers those topics.
(psa)Simplified several handling rules; removed ThreadID SHIM header for IQ stanzas; removed implementation note about In-Reply-To SHIM header; removed references to XEP-0155; corrected some errors; harmonized text with rfc3921bis in coordination with editor's review.
(psa)Defined parent attribute and provided recommendations regarding creation of new threads and child threads.
(psa)Specified handling of thread IDs on groupchat messages.
(psa)Described handling of unavailable presence and chat messages without thread IDs; minor changes.
(ip)Equalized treatment of different message types (chat and groupchat not preferred over normal); required the use of UUIDs; specified use of In-Reply-To header; added Kevin Smith as co-author.
(psa/ks)Initial version.
(psa)END