No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0201.xml 11KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Best Practices for Message Threads</title>
  10. <abstract>This specification defines recommended handling of XMPP message threads.</abstract>
  11. &LEGALNOTICE;
  12. <number>0201</number>
  13. <status>Active</status>
  14. <type>Informational</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. </dependencies>
  20. <supersedes/>
  21. <supersededby/>
  22. <shortname>N/A</shortname>
  23. &stpeter;
  24. &ianpaterson;
  25. &ksmith;
  26. <revision>
  27. <version>1.0</version>
  28. <date>2010-11-29</date>
  29. <initials>psa</initials>
  30. <remark><p>Per a vote of the XMPP Council, advanced specification to Active.</p></remark>
  31. </revision>
  32. <revision>
  33. <version>0.8</version>
  34. <date>2010-09-28</date>
  35. <initials>psa</initials>
  36. <remark><p>Expanded upon use with normal messages; cleaned up several matters in the text; added informational pointers to RFC 5322 (email) and RFC 5536 (netnews).</p></remark>
  37. </revision>
  38. <revision>
  39. <version>0.7</version>
  40. <date>2010-07-12</date>
  41. <initials>psa</initials>
  42. <remark><p>Removed definition of ThreadID syntax, semantics, and uniqueness because the revisions to RFC 3921 covers those topics.</p></remark>
  43. </revision>
  44. <revision>
  45. <version>0.6</version>
  46. <date>2010-05-21</date>
  47. <initials>psa</initials>
  48. <remark><p>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 the revisions to RFC 3921 in coordination with editor's review.</p></remark>
  49. </revision>
  50. <revision>
  51. <version>0.5</version>
  52. <date>2008-02-06</date>
  53. <initials>psa</initials>
  54. <remark><p>Defined parent attribute and provided recommendations regarding creation of new threads and child threads.</p></remark>
  55. </revision>
  56. <revision>
  57. <version>0.4</version>
  58. <date>2007-08-30</date>
  59. <initials>psa</initials>
  60. <remark><p>Specified handling of thread IDs on groupchat messages.</p></remark>
  61. </revision>
  62. <revision>
  63. <version>0.3</version>
  64. <date>2007-01-29</date>
  65. <initials>ip</initials>
  66. <remark><p>Described handling of unavailable presence and chat messages without thread IDs; minor changes.</p></remark>
  67. </revision>
  68. <revision>
  69. <version>0.2</version>
  70. <date>2007-01-23</date>
  71. <initials>psa/ks</initials>
  72. <remark><p>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.</p></remark>
  73. </revision>
  74. <revision>
  75. <version>0.1</version>
  76. <date>2006-12-20</date>
  77. <initials>psa</initials>
  78. <remark><p>Initial version.</p></remark>
  79. </revision>
  80. <revision>
  81. <version>0.0.2</version>
  82. <date>2006-12-14</date>
  83. <initials>psa</initials>
  84. <remark>Corrected SHIM example; added XMPP Registrar considerations.</remark>
  85. </revision>
  86. <revision>
  87. <version>0.0.1</version>
  88. <date>2006-12-13</date>
  89. <initials>psa/ip</initials>
  90. <remark>First draft.</remark>
  91. </revision>
  92. </header>
  93. <section1 topic='Introduction' anchor='intro'>
  94. <p>Although message threads are re-used in XMPP extension protocols such as &xep0085;, best practices for generating and handling message threads have never been well specified (e.g., in &rfc3921; or &rfc6121;). This document attempts to clearly specify those matters for implementation by XMPP clients.</p>
  95. </section1>
  96. <section1 topic='Motivation' anchor='motivation'>
  97. <p>Threads matter because they enable XMPP clients to:</p>
  98. <ul>
  99. <li>Track conversation topics within the context of a one-to-one chat session, a &xep0045; room, or exchange of normal messages.</li>
  100. <li>Restart a conversation from message history.</li>
  101. <li>Enable clients to distinguish between different conversation threads when presenting a user's message, chat, and groupchat histories, thus providing a more coherent user interface (e.g. by collapsing threads to a single history entry).</li>
  102. <li>Separate logical sessions from physical interface objects such as windows.</li>
  103. <li>Route XMPP stanzas within a client (e.g., dispatching different content types to different windows), thus facilitating the creation of more robust plugin architectures.</li>
  104. </ul>
  105. </section1>
  106. <section1 topic='Generation' anchor='generation'>
  107. <section2 topic='Inclusion' anchor='inclusion'>
  108. <p>Depending on the type of the message (i.e., the value of the 'type' attribute), the &lt;thread/&gt; should be included as follows:</p>
  109. <table caption='When to Include Threads'>
  110. <tr>
  111. <th>Message Type</th>
  112. <th>Inclusion</th>
  113. </tr>
  114. <tr>
  115. <td>chat</td>
  116. <td>RECOMMENDED</td>
  117. </tr>
  118. <tr>
  119. <td>groupchat</td>
  120. <td>RECOMMENDED</td>
  121. </tr>
  122. <tr>
  123. <td>headline</td>
  124. <td>OPTIONAL</td>
  125. </tr>
  126. <tr>
  127. <td>normal</td>
  128. <td>OPTIONAL</td>
  129. </tr>
  130. </table>
  131. </section2>
  132. <section2 topic='New Threads' anchor='new'>
  133. <p>Unless a &lt;message/&gt; stanza is written in direct reply to another &lt;message/&gt; 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 &lt;message/&gt; stanza of type 'chat'), starts a new conversation in the context of a multi-user chat environment (i.e., a &lt;message/&gt; stanza of type 'groupchat'), or sends a normal message.</p>
  134. <p>If the &lt;message/&gt; stanza is written in direct reply to another &lt;message/&gt; stanza, then the ThreadID SHOULD be the value from the the original &lt;message/&gt; stanza. (Determining what constitutes a &lt;message/&gt; 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.)</p>
  135. </section2>
  136. <section2 topic='Child Threads' anchor='child'>
  137. <p>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.</p>
  138. <example caption='Thread with parent'><![CDATA[
  139. <message
  140. to='romeo@example.net/orchard'
  141. from='juliet@example.com/balcony'
  142. id='asiwe8289ljfdalk'
  143. type='chat'
  144. xml:lang='en'>
  145. <body>Art thou not Romeo, and a Montague?</body>
  146. <thread parent='7edac73ab41e45c4aafa7b2d7b749080'>
  147. e0ffe42b28561960c6b12b944a092794b9683a38
  148. </thread>
  149. </message>
  150. ]]></example>
  151. </section2>
  152. </section1>
  153. <section1 topic='Handling' anchor='handling'>
  154. <p>In general, the XMPP &lt;thread/&gt; element is handled in a manner similar to the "References:" header field from email (see &rfc5322;) and netnews (see &rfc5536;), as well as the THREAD extension to IMAP (see &rfc5256;). Detailed guidelines for particular XMPP message types are provided in the following sections.</p>
  155. <section2 topic='Chat Messages' anchor='chat'>
  156. <p>For &lt;message/&gt; stanzas of type "chat" exchanged between two entities, the value of the &lt;thread/&gt; 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).</p>
  157. <p>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).</p>
  158. <p>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).</p>
  159. </section2>
  160. <section2 topic='Groupchat Messages' anchor='groupchat'>
  161. <p>For &lt;message/&gt; stanzas of type "groupchat" exchanged between multiple entities in a &xep0045; room or similar environment, the value of the &lt;thread/&gt; element shall be considered equivalent to a unique identifier for a conversation thread in the multi-user environment.</p>
  162. <p>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.</p>
  163. </section2>
  164. <section2 topic='Normal Messages' anchor='normal'>
  165. <p>For &lt;message/&gt; stanzas of type "normal", the value of the &lt;thread/&gt; 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.</p>
  166. <p>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.</p>
  167. </section2>
  168. <section2 topic='Headline Messages' anchor='headline'>
  169. <p>There are no special handling requirements related to threads for &lt;message/&gt; stanzas of type "headline", because it is not expected that a client will allow the recipient to reply to such messages.</p>
  170. </section2>
  171. <section2 topic='Messages That Have Been Archived' anchor='archived'>
  172. <p>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.</p>
  173. </section2>
  174. </section1>
  175. <section1 topic='Security Considerations' anchor='security'>
  176. <p>Several security considerations related to XMPP threads are described in <cite>RFC 6121</cite>.</p>
  177. </section1>
  178. <section1 topic='IANA Considerations' anchor='iana'>
  179. <p>This document requires no interaction with &IANA;.</p>
  180. </section1>
  181. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  182. <p>This document requires no interaction with the &REGISTRAR;.</p>
  183. </section1>
  184. </xep>