1
0
mirror of https://github.com/moparisthebest/xeps synced 2024-12-21 23:28:51 -05:00

update xep-226

git-svn-id: file:///home/ksmith/gitmigration/svn/xmpp/trunk@2302 4b5297f7-1745-476d-ba37-a9c6900126ab
This commit is contained in:
Justin Karneges 2008-10-01 22:37:41 +00:00
parent 2ac2e5c7ef
commit 652356f775

View File

@ -20,6 +20,12 @@
<shortname>N/A</shortname>
&infiniti;
&stpeter;
<revision>
<version>0.2</version>
<date>2008-10-01</date>
<initials>jk</initials>
<remark><p>Revised/reordered text.</p></remark>
</revision>
<revision>
<version>0.1</version>
<date>2007-08-08</date>
@ -41,7 +47,7 @@
</header>
<section1 topic='Introduction' anchor='intro'>
<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>
<p>Consider the following hypothetical example, which as we shall see is invalid.</p>
<p>Consider the following hypothetical example:</p>
<example caption='A confusing message'><![CDATA[
<message from='romeo@montague.lit' to='juliet@capulet.com'>
<body>Shall we meet?</body
@ -83,13 +89,55 @@
<mood xmlns='http://jabber.org/protocol/mood'>
<flirtatious/>
</mood>
<data xmlns='http://jabber.org/protocol/ibb' sid='ft_session_2' seq='84'>
qANQR1DBwU4DX7jmYZnncmUQB/9KuKBddzQH+tZ1ZywKK0yHKnq57kWq+RFtQdCJ
WpdWpR0uQsuJe7+vh3NWn59/gTc5MDlX8dS9p0ovStmNcyLhxVgmqS8ZKhsblVeu
IpQ0JgavABqibJolc3BKrVtVV1igKiX/N7Pi8RtY1K18toaMDhdEfhBRzO/XB0+P
AQhYlRjNacGcslkhXqNjK5Va4tuOAPy2n1Q8UUrHbUd0g+xJ9Bm0G0LZXyvCWyKH
kuNEHFQiLuCY6Iv0myq6iX6tjuHehZlFSh80b5BVV9tNLwNR5Eqz1klxMhoghJOA
</data>
</message>
]]></example>
<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>
<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>
</section1>
<section1 topic='Elements' anchor='elements'>
<p>Elements used in a message stanza are either profile elements (for example, &lt;body&gt; or &lt;data xmlns='http://jabber.org/protocol/ibb'&gt;) or metadata elements (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 metadata elements as desired.</p>
<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>
<example caption='Mixing profile elements'><![CDATA[
<message from='romeo@montague.lit' to='juliet@capulet.com'>
<body>If you read this message then you don't support IBB.</body
<data xmlns='http://jabber.org/protocol/ibb' sid='ft_session_2' seq='84'>
qANQR1DBwU4DX7jmYZnncmUQB/9KuKBddzQH+tZ1ZywKK0yHKnq57kWq+RFtQdCJ
WpdWpR0uQsuJe7+vh3NWn59/gTc5MDlX8dS9p0ovStmNcyLhxVgmqS8ZKhsblVeu
IpQ0JgavABqibJolc3BKrVtVV1igKiX/N7Pi8RtY1K18toaMDhdEfhBRzO/XB0+P
AQhYlRjNacGcslkhXqNjK5Va4tuOAPy2n1Q8UUrHbUd0g+xJ9Bm0G0LZXyvCWyKH
kuNEHFQiLuCY6Iv0myq6iX6tjuHehZlFSh80b5BVV9tNLwNR5Eqz1klxMhoghJOA
</data>
</message>
]]></example>
<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>
</section1>
<section1 topic='Rules' anchor='rules'>
<p>We stipulate the following rules:</p>
<ol>
<li>A single profile applies to each message stanza (i.e., a message is not in two or more profiles).</li>
<li>Metadata elements do not affect the profile.</li>
<li>Each element is part of a defined profile.</li>
<li>Unknown elements have no affect on determining the profile.</li>
<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>
</ol>
<p>If a message stanza is received that combines multiple profiles, or the profile cannot be determined, the receiving client MAY return a stanza error, which SHOULD be &notacceptable;.</p>
<example caption='Message not acceptable'><![CDATA[
<message from='juliet@capulet.com' to='romeo@montague.lit'>
<error code='406' type='cancel'>
<not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</message>
]]></example>
<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;). 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? (No.)</p>
<p>To clarify such matters, in this document we introduce the concept of "message stanza profiles".</p>
</section1>
<section1 topic='Profiles' anchor='profiles'>
<p>We propose the following profiles.</p>
<p>Profiles should be defined in whichever specifications define elements or processing behavior of message stanzas. However, a few profiles are defined here.</p>
<section2 topic='IM' anchor='profiles-im'>
<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>
<p>The extended content defined in the following specifications is considered to be in the IM profile:</p>
@ -124,6 +172,7 @@
</section1>
<section1 topic='Metadata Elements' anchor='metadata'>
<p>Metadata elements are included to define how the message stanza shall be routed, delivered, or processed in transit. Metadata elements shall not be used to determine which profile applies. If a message stanza includes only metadata elements, it can be considered to have no profile.</p>
<p>Metadata elements should be defined in whichever specifications define elements or processing behavior of message stanzas. However, a few metadata elements are defined here.</p>
<p>The extended content elements defined in the following specifications are considered to be metadata elements:</p>
<ul>
<li>&xep0033;</li>
@ -132,24 +181,8 @@
<li>&xep0203;</li>
</ul>
</section1>
<section1 topic='Rules' anchor='rules'>
<p>We stipulate the following rules:</p>
<ol>
<li>A single profile applies to each message stanza (i.e., a message is not in two or more profiles).</li>
<li>Transmission elements do not affect the profile.</li>
<li>Each element is part of some profile. Unless otherwise stated, the same profile applies to every element of a given namespace.</li>
<li>Unknown elements have no affect on determining the profile.</li>
<li>When determining which profile applies to a stanza, consider the IM profile as a last resort.</li>
<li>A sending entity must not mix profiles, except IM profile elements may included with with any other profile as a fallback (e.g., a message body along with a data form).</li>
</ol>
<p>Therefore, the example provided in the introduction should never be generated by a sending client because the message combines multiple profiles. If it receives a message stanza that combines multiple profiles, the receiving client MAY return a stanza error, which SHOULD be &notacceptable;.</p>
<example caption='Message not acceptable'><![CDATA[
<message from='juliet@capulet.com' to='romeo@montague.lit'>
<error code='406' type='cancel'>
<not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
</message>
]]></example>
<section1 topic='Implementation Notes' anchor='impl'>
<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>
</section1>
<section1 topic='Security Considerations' anchor='security'>
<p>This document adds no security concerns or consideration above and beyond those specified in the specifications to which it refers.</p>