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-0226.xml 14KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288
  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>Message Stanza Profiles</title>
  10. <abstract>This document specifies best practices for generating and handling extended content in XMPP message stanzas.</abstract>
  11. &LEGALNOTICE;
  12. <number>0226</number>
  13. <status>Deferred</status>
  14. <type>Informational</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies/>
  18. <supersedes/>
  19. <supersededby/>
  20. <shortname>profiles</shortname>
  21. &infiniti;
  22. &stpeter;
  23. <revision>
  24. <version>0.3</version>
  25. <date>2008-11-05</date>
  26. <initials>psa</initials>
  27. <remark><p>For consistency, defined Metadata Profile; specified that the registrar shall create a registry for message stanza profiles.</p></remark>
  28. </revision>
  29. <revision>
  30. <version>0.2</version>
  31. <date>2008-10-01</date>
  32. <initials>jk</initials>
  33. <remark><p>Revised/reordered text.</p></remark>
  34. </revision>
  35. <revision>
  36. <version>0.1</version>
  37. <date>2007-08-08</date>
  38. <initials>psa</initials>
  39. <remark><p>Initial published version; specified more granular profiles; renamed transmission elements to metadata elements.</p></remark>
  40. </revision>
  41. <revision>
  42. <version>0.0.2</version>
  43. <date>2007-08-01</date>
  44. <initials>psa</initials>
  45. <remark><p>Clarified that message profiles apply to sending entities as well as receiving entities.</p></remark>
  46. </revision>
  47. <revision>
  48. <version>0.0.1</version>
  49. <date>2007-08-01</date>
  50. <initials>jk/psa</initials>
  51. <remark><p>First draft.</p></remark>
  52. </revision>
  53. </header>
  54. <section1 topic='Introduction' anchor='intro'>
  55. <p>The definition of XMPP stanzas in &xmppcore; and &xmppim; allows a &MESSAGE; stanza to include any number of child elements that define extended content. The fact that a message stanza may contain multiple instances of extended content can make it difficult for sending entities to know what is appropriate for inclusion in a message stanza and for receiving entities to know exactly how to process a message stanza.</p>
  56. <p>Consider the following hypothetical example:</p>
  57. <example caption='A confusing message'><![CDATA[
  58. <message from='romeo@montague.lit' to='juliet@capulet.com' id='msg_1'>
  59. <body>Shall we meet?</body
  60. <html xmlns='http://jabber.org/protocol/xhtml-im'>
  61. <body xmlns='http://www.w3.org/1999/xhtml'>
  62. <p style='font-weight:bold'>Shall we meet?</p>
  63. </body>
  64. </html>
  65. <feature xmlns='http://jabber.org/protocol/feature-neg'>
  66. <x xmlns='jabber:x:data' type='form'>
  67. <field var='FORM_TYPE' type='hidden'>
  68. <value>romantic_meetings</value>
  69. </field>
  70. <field type='list-single' var='places-to-meet'>
  71. <option><value>Secret Grotto</value></option>
  72. <option><value>Verona Park</value></option>
  73. </field>
  74. <field type='list-single' var='times-to-meet'>
  75. <option><value>22:00</value></option>
  76. <option><value>22:30</value></option>
  77. <option><value>23:00</value></option>
  78. </field>
  79. </x>
  80. </feature>
  81. <headers xmlns='http://jabber.org/protocol/shim'>
  82. <header name='Urgency'>high</header>
  83. </headers>
  84. <amp xmlns='http://jabber.org/protocol/amp' per-hop='true'>
  85. <rule condition='expire-at'
  86. action='drop'
  87. value='2007-08-01T23:30:00Z'/>
  88. </amp>
  89. <geoloc xmlns='http://jabber.org/protocol/geoloc' xml:lang='en'>
  90. <country>Italy</country>
  91. <lat>45.44</lat>
  92. <locality>Venice</locality>
  93. <lon>12.33</lon>
  94. </geoloc>
  95. <mood xmlns='http://jabber.org/protocol/mood'>
  96. <flirtatious/>
  97. </mood>
  98. <data xmlns='http://jabber.org/protocol/ibb' sid='ft_session_2' seq='84'>
  99. qANQR1DBwU4DX7jmYZnncmUQB/9KuKBddzQH+tZ1ZywKK0yHKnq57kWq+RFtQdCJ
  100. WpdWpR0uQsuJe7+vh3NWn59/gTc5MDlX8dS9p0ovStmNcyLhxVgmqS8ZKhsblVeu
  101. IpQ0JgavABqibJolc3BKrVtVV1igKiX/N7Pi8RtY1K18toaMDhdEfhBRzO/XB0+P
  102. AQhYlRjNacGcslkhXqNjK5Va4tuOAPy2n1Q8UUrHbUd0g+xJ9Bm0G0LZXyvCWyKH
  103. kuNEHFQiLuCY6Iv0myq6iX6tjuHehZlFSh80b5BVV9tNLwNR5Eqz1klxMhoghJOA
  104. </data>
  105. </message>
  106. ]]></example>
  107. <p>What to make of a message like this? The import seems to be that Romeo, being in a flirtatious mood (&xep0107;) and currently located near Juliet's abode (&xep0080;), would urgently (&xep0131;) like to meet with Juliet (message body) and proposes two convenient places (&xep0020;) for an evening tryst, but no later than midnight (&xep0079;), and for good measure would like to transport the 85th packet of a file transfer. But how is Juliet's client supposed to figure that out? That is, what should her client present to the user? And should Romeo's client even send a monstrosity such as this?</p>
  108. <p>To clarify such matters, this document introduces the concept of "message stanza profiles". Each profile defines a set of elements that are allowed for use, and each message stanza must only be processed under the rules of a single profile. Therefore, at best, Juliet's client in the above example would process the message for just one of its many intended purposes. At worst, the message would be rejected by Juliet's client as invalid. Romeo's client should not be sending such a monstrosity.</p>
  109. </section1>
  110. <section1 topic='Elements' anchor='elements'>
  111. <p>Elements used in a message stanza are either part of a standard profile (for example, &lt;body&gt; or &lt;data xmlns='http://jabber.org/protocol/ibb'&gt;) or the metadata profile (for example, &lt;error&gt; or &lt;amp xmlns='http://jabber.org/protocol/amp'&gt;). A message stanza SHOULD only contain profile elements that are part of the same profile. A message stanza MAY contain as many elements as necessary from the metadata profile.</p>
  112. <p>A sender MAY mix elements of different profiles only for the purposes of fallback. For example, it may be useful to include a &lt;body&gt; element in a message that is not intended to be displayed as a text message, in case the recipient does not support the primary profile of the message.</p>
  113. <example caption='Mixing profile elements'><![CDATA[
  114. <message from='romeo@montague.lit' to='juliet@capulet.com' id='msg_1'>
  115. <body>If you read this message then you don't support IBB.</body
  116. <data xmlns='http://jabber.org/protocol/ibb' sid='ft_session_2' seq='84'>
  117. qANQR1DBwU4DX7jmYZnncmUQB/9KuKBddzQH+tZ1ZywKK0yHKnq57kWq+RFtQdCJ
  118. WpdWpR0uQsuJe7+vh3NWn59/gTc5MDlX8dS9p0ovStmNcyLhxVgmqS8ZKhsblVeu
  119. IpQ0JgavABqibJolc3BKrVtVV1igKiX/N7Pi8RtY1K18toaMDhdEfhBRzO/XB0+P
  120. AQhYlRjNacGcslkhXqNjK5Va4tuOAPy2n1Q8UUrHbUd0g+xJ9Bm0G0LZXyvCWyKH
  121. kuNEHFQiLuCY6Iv0myq6iX6tjuHehZlFSh80b5BVV9tNLwNR5Eqz1klxMhoghJOA
  122. </data>
  123. </message>
  124. ]]></example>
  125. <p>A receiver MUST only process the message for a single profile. The above example message would be processed either as an IBB data packet or as an instant message, but never both.</p>
  126. </section1>
  127. <section1 topic='Rules' anchor='rules'>
  128. <p>We stipulate the following rules:</p>
  129. <ol>
  130. <li>A single profile applies to each message stanza (i.e., a message is not in two or more profiles).</li>
  131. <li>Each element is part of a defined profile.</li>
  132. <li>Metadata elements have no effect on the profile-based handling of messages.</li>
  133. <li>Unknown elements have no effect on determining the profile.</li>
  134. <li>If a received message appears to conform to multiple profiles, the profile selected by the receiver is implementation-specific with one exception: the receiver MUST NOT select the IM profile unless that is the only profile it understands in the message.</li>
  135. </ol>
  136. <p>If a client receives a message stanza that combines multiple profiles, or the profile cannot be determined, the client MAY return a stanza error, which SHOULD be &notacceptable;.</p>
  137. <example caption='Message not acceptable'><![CDATA[
  138. <message from='juliet@capulet.com'
  139. id='msg_1'
  140. to='romeo@montague.lit'
  141. type='error'>
  142. <error type='cancel'>
  143. <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  144. </error>
  145. </message>
  146. ]]></example>
  147. <p>A client might determine that a message cannot be assigned to any profile (e.g., a message stanza that is empty or that contains only whitespace <note>A message stanza SHOULD NOT be empty or contain only whitespace, but some clients are known to generate such stanzas.</note>, or that contains only unknown elements).</p>
  148. </section1>
  149. <section1 topic='Profiles' anchor='profiles'>
  150. <p>Profiles can be defined in whichever specifications define elements or processing behavior related to message stanzas. All such profiles SHOULD be registered in the Message Profiles Registry as described in the <link url='#registrar'>XMPP Registrar Considerations</link>. However, a few profiles are defined here, and this specification might be kept up to date as further registrations are created.</p>
  151. <section2 topic='IM' anchor='profiles-im'>
  152. <p>The instant messaging (IM) profile is the "default" profile for message stanzas. For example, if a message stanza includes only elements that are defined for the 'jabber:client' namespace then it is in the IM profile. If a message stanza includes both IM profile elements and other elements, the IM elements should be considered a fallback and the profile should be determined based on the other elements if supported (e.g., a data form). A sending entity should limit the elements it includes to IM profile elements, unless the IM elements are a fallback.</p>
  153. <p>The extended content defined in the following specifications is considered to be in the IM profile:</p>
  154. <ul>
  155. <li>&xmppim;</li>
  156. <li>&xep0045; (e.g., invitations)</li>
  157. <li>&xep0066;</li>
  158. <li>&xep0071;</li>
  159. <li>&xep0085;</li>
  160. <li>&xep0144;</li>
  161. <li>&xep0172;</li>
  162. </ul>
  163. </section2>
  164. <section2 topic='Data Forms' anchor='profiles-dataforms'>
  165. <p>Extended content elements defined in &xep0004; are considered to be in the Data Forms profile.</p>
  166. </section2>
  167. <section2 topic='RPC' anchor='profiles-rpc'>
  168. <p>Extended content elements defined in &xep0009; are considered to be in the RPC profile.</p>
  169. </section2>
  170. <section2 topic='Feature Negotiation' anchor='profiles-featureneg'>
  171. <p>Extended content elements defined in &xep0020; are considered to be in the Feature Negotiation profile.</p>
  172. </section2>
  173. <section2 topic='HTTP Authentication' anchor='profiles-httpauth'>
  174. <p>Extended content elements defined in &xep0070; are considered to be in the HTTP Authentication profile.</p>
  175. </section2>
  176. <section2 topic='SOAP' anchor='profiles-soap'>
  177. <p>Extended content elements defined in &xep0072; are considered to be in the SOAP profile.</p>
  178. </section2>
  179. <section2 topic='Stanza Session Negotiation' anchor='profiles-ssn'>
  180. <p>Extended content elements defined in &xep0155; are considered to be in the Stanza Session Negotiation profile.</p>
  181. </section2>
  182. <section2 topic='Metadata' anchor='profiles-meta'>
  183. <p>The metadata profile is handled differently than the other, "standard" profiles, but is defined as a profile for the purpose of consistency. Metadata elements are included to define how the message stanza shall be routed, delivered, or processed in transit or by the end recipient. Metadata elements shall not be used to determine which standard profile applies. If a message stanza includes only metadata elements, it can be considered to have no standard profile.</p>
  184. <p>The extended content elements defined in the following specifications are considered to be metadata elements:</p>
  185. <ul>
  186. <li>&xep0033;</li>
  187. <li>&xep0079;</li>
  188. <li>&xep0131;</li>
  189. <li>&xep0203;</li>
  190. </ul>
  191. </section2>
  192. </section1>
  193. <section1 topic='Implementation Notes' anchor='impl'>
  194. <p>Since each message is unambiguously determined to be of a specific profile, implementations that use filtering to pass message stanzas to an appropriate handler (a very common XMPP implementation approach) need not be concerned with the filtering order. This is because only one handler should ever match on the filter expression.</p>
  195. </section1>
  196. <section1 topic='Security Considerations' anchor='security'>
  197. <p>This document adds no security concerns or consideration above and beyond those specified in the specifications to which it refers.</p>
  198. </section1>
  199. <section1 topic='IANA Considerations' anchor='iana'>
  200. <p>This document requires no interaction with &IANA;.</p>
  201. </section1>
  202. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  203. <p>A future version of this specification may call for the &REGISTRAR; to establish a registry of message stanza profiles, so that each relevant specification shall define which profile applies to extended content qualified by the relevant namespace.</p>
  204. <section2 topic='Message Profiles Registry' anchor='registrar-profiles'>
  205. <p>The XMPP Registrar shall maintain a registry of message profiles.</p>
  206. <section3 topic='Process' anchor='registrar-profiles-process'>
  207. &REGPROCESS;
  208. <code><![CDATA[
  209. <profile>
  210. <name>the XML character data of the profile element</name>
  211. <desc>a natural-language description of the message profile</desc>
  212. <specs>
  213. <spec>one "spec" element for each document that applies</spec>
  214. </specs>
  215. </profile>
  216. ]]></code>
  217. </section3>
  218. <section3 topic='Registration' anchor='registrar-methods-init'>
  219. <code><![CDATA[
  220. <profile>
  221. <name>Data Forms</name>
  222. <specs>
  223. <spec>XEP-0004</spec>
  224. </specs>
  225. </profile>
  226. <profile>
  227. <name>Feature Negotiation</name>
  228. <specs>
  229. <spec>XEP-0020</spec>
  230. </specs>
  231. </profile>
  232. <profile>
  233. <name>HTTP Authentication</name>
  234. <specs>
  235. <spec>XEP-0070</spec>
  236. </specs>
  237. </profile>
  238. <profile>
  239. <name>IM</name>
  240. <specs>
  241. <spec>XMPP core</spec>
  242. <spec>XEP-0045</spec>
  243. <spec>XEP-0066</spec>
  244. <spec>XEP-0071</spec>
  245. <spec>XEP-0085</spec>
  246. <spec>XEP-0144</spec>
  247. <spec>XEP-0172</spec>
  248. </specs>
  249. </profile>
  250. <profile>
  251. <name>Metadata</name>
  252. <specs>
  253. <spec>XEP-0033</spec>
  254. <spec>XEP-0079</spec>
  255. <spec>XEP-0131</spec>
  256. <spec>XEP-0203</spec>
  257. </specs>
  258. </profile>
  259. <profile>
  260. <name>RPC</name>
  261. <specs>
  262. <spec>XEP-0009</spec>
  263. </specs>
  264. </profile>
  265. <profile>
  266. <name>SOAP</name>
  267. <specs>
  268. <spec>XEP-0072</spec>
  269. </specs>
  270. </profile>
  271. <profile>
  272. <name>Stanza Session Negotiation</name>
  273. <specs>
  274. <spec>XEP-0155</spec>
  275. </specs>
  276. </profile>
  277. ]]></code>
  278. </section3>
  279. </section2>
  280. </section1>
  281. </xep>