XEP-0226: Message Stanza Profiles

Abstract
This document specifies best practices for generating and handling extended content in XMPP message stanzas.
Authors
  • Justin Karneges
  • Peter Saint-Andre
Copyright
© 2007 – 2008 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

Deferred

WARNING: This document has been automatically Deferred after 12 months of inactivity in its previous Experimental state. Implementation of the protocol described herein is not recommended for production systems. However, exploratory implementations are encouraged to resume the standards process.
Type
Informational
Version
0.3 (2008-11-05)
Document Lifecycle
  1. Experimental
  2. Deferred
  3. Proposed
  4. Active

1. Introduction

The definition of XMPP stanzas in XMPP Core [1] and XMPP IM [2] 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.

Consider the following hypothetical example:

Example 1. A confusing message
<message from='romeo@montague.lit' to='juliet@capulet.com' id='msg_1'>
  <body>Shall we meet?</body
  <html xmlns='http://jabber.org/protocol/xhtml-im'>
    <body xmlns='http://www.w3.org/1999/xhtml'>
      <p style='font-weight:bold'>Shall we meet?</p>
    </body>
  </html>
  <feature xmlns='http://jabber.org/protocol/feature-neg'>
    <x xmlns='jabber:x:data' type='form'>
      <field var='FORM_TYPE' type='hidden'>
        <value>romantic_meetings</value>
      </field>
      <field type='list-single' var='places-to-meet'>
         <option><value>Secret Grotto</value></option>
         <option><value>Verona Park</value></option>
      </field>
      <field type='list-single' var='times-to-meet'>
         <option><value>22:00</value></option>
         <option><value>22:30</value></option>
         <option><value>23:00</value></option>
      </field>
    </x>
  </feature>
  <headers xmlns='http://jabber.org/protocol/shim'>
    <header name='Urgency'>high</header>
  </headers>
  <amp xmlns='http://jabber.org/protocol/amp' per-hop='true'>
    <rule condition='expire-at'
          action='drop'
          value='2007-08-01T23:30:00Z'/>
  </amp>
  <geoloc xmlns='http://jabber.org/protocol/geoloc' xml:lang='en'>
    <country>Italy</country>
    <lat>45.44</lat>
    <locality>Venice</locality>
    <lon>12.33</lon>
  </geoloc>
  <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>

What to make of a message like this? The import seems to be that Romeo, being in a flirtatious mood (User Mood (XEP-0107) [3]) and currently located near Juliet's abode (User Geolocation (XEP-0080) [4]), would urgently (Stanza Headers and Internet Metadata (XEP-0131) [5]) like to meet with Juliet (message body) and proposes two convenient places (Feature Negotiation (XEP-0020) [6]) for an evening tryst, but no later than midnight (Advanced Message Processing (XEP-0079) [7]), 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?

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.

2. Elements

Elements used in a message stanza are either part of a standard profile (for example, <body> or <data xmlns='http://jabber.org/protocol/ibb'>) or the metadata profile (for example, <error> or <amp xmlns='http://jabber.org/protocol/amp'>). 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.

A sender MAY mix elements of different profiles only for the purposes of fallback. For example, it may be useful to include a <body> 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.

Example 2. Mixing profile elements
<message from='romeo@montague.lit' to='juliet@capulet.com' id='msg_1'>
  <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>

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.

3. Rules

We stipulate the following rules:

  1. A single profile applies to each message stanza (i.e., a message is not in two or more profiles).
  2. Each element is part of a defined profile.
  3. Metadata elements have no effect on the profile-based handling of messages.
  4. Unknown elements have no effect on determining the profile.
  5. 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.

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 <not-acceptable/>.

Example 3. Message not acceptable
<message from='juliet@capulet.com'
         id='msg_1'
         to='romeo@montague.lit'
         type='error'>
  <error type='cancel'>
    <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
  </error>
</message>

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 [8], or that contains only unknown elements).

4. Profiles

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 XMPP Registrar Considerations. However, a few profiles are defined here, and this specification might be kept up to date as further registrations are created.

4.1 IM

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.

The extended content defined in the following specifications is considered to be in the IM profile:

4.2 Data Forms

Extended content elements defined in Data Forms (XEP-0004) [15] are considered to be in the Data Forms profile.

4.3 RPC

Extended content elements defined in Jabber-RPC (XEP-0009) [16] are considered to be in the RPC profile.

4.4 Feature Negotiation

Extended content elements defined in Feature Negotiation (XEP-0020) [6] are considered to be in the Feature Negotiation profile.

4.5 HTTP Authentication

Extended content elements defined in Verifying HTTP Requests via XMPP (XEP-0070) [17] are considered to be in the HTTP Authentication profile.

4.6 SOAP

Extended content elements defined in SOAP over XMPP (XEP-0072) [18] are considered to be in the SOAP profile.

4.7 Stanza Session Negotiation

Extended content elements defined in Stanza Session Negotiation (XEP-0155) [19] are considered to be in the Stanza Session Negotiation profile.

4.8 Metadata

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.

The extended content elements defined in the following specifications are considered to be metadata elements:

5. Implementation Notes

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.

6. Security Considerations

This document adds no security concerns or consideration above and beyond those specified in the specifications to which it refers.

7. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [22].

8. XMPP Registrar Considerations

A future version of this specification may call for the XMPP Registrar [23] 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.

8.1 Message Profiles Registry

The XMPP Registrar shall maintain a registry of message profiles.

8.1.1 Process

In order to submit new values to this registry, the registrant shall define an XML fragment of the following form and either include it in the relevant XMPP Extension Protocol or send it to the email address <registrar@xmpp.org>:

<profile>
  <name>the XML character data of the profile element</name>
  <desc>a natural-language description of the message profile</desc>
  <specs>
    <spec>one "spec" element for each document that applies</spec>
  </specs>
</profile>

8.1.2 Registration

<profile>
  <name>Data Forms</name>
  <specs>
    <spec>XEP-0004</spec>
  </specs>
</profile>

<profile>
  <name>Feature Negotiation</name>
  <specs>
    <spec>XEP-0020</spec>
  </specs>
</profile>

<profile>
  <name>HTTP Authentication</name>
  <specs>
    <spec>XEP-0070</spec>
  </specs>
</profile>

<profile>
  <name>IM</name>
  <specs>
    <spec>XMPP core</spec>
    <spec>XEP-0045</spec>
    <spec>XEP-0066</spec>
    <spec>XEP-0071</spec>
    <spec>XEP-0085</spec>
    <spec>XEP-0144</spec>
    <spec>XEP-0172</spec>
  </specs>
</profile>

<profile>
  <name>Metadata</name>
  <specs>
    <spec>XEP-0033</spec>
    <spec>XEP-0079</spec>
    <spec>XEP-0131</spec>
    <spec>XEP-0203</spec>
  </specs>
</profile>

<profile>
  <name>RPC</name>
  <specs>
    <spec>XEP-0009</spec>
  </specs>
</profile>

<profile>
  <name>SOAP</name>
  <specs>
    <spec>XEP-0072</spec>
  </specs>
</profile>

<profile>
  <name>Stanza Session Negotiation</name>
  <specs>
    <spec>XEP-0155</spec>
  </specs>
</profile>

Appendices

Appendix A: Document Information

Series
XEP
Number
0226
Publisher
XMPP Standards Foundation
Status
Deferred
Type
Informational
Version
0.3
Last Updated
2008-11-05
Approving Body
XMPP Council
Dependencies
None
Supersedes
None
Superseded By
None
Short Name
profiles
Source Control
HTML

This document in other formats: XML  PDF

Appendix B: Author Information

Justin Karneges
Email
justin@karneges.com
JabberID
justin@andbit.net
Peter Saint-Andre
Email
stpeter@stpeter.im
JabberID
stpeter@jabber.org
URI
https://stpeter.im/

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2024 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) 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.

Appendix E: Discussion Venue

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 <https://xmpp.org/community/> for a complete list.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

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".

Appendix G: Notes

1. RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc6120>.

2. RFC 6121: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://tools.ietf.org/html/rfc6121>.

3. XEP-0107: User Mood <https://xmpp.org/extensions/xep-0107.html>.

4. XEP-0080: User Geolocation <https://xmpp.org/extensions/xep-0080.html>.

5. XEP-0131: Stanza Headers and Internet Metadata <https://xmpp.org/extensions/xep-0131.html>.

6. XEP-0020: Feature Negotiation <https://xmpp.org/extensions/xep-0020.html>.

7. XEP-0079: Advanced Message Processing <https://xmpp.org/extensions/xep-0079.html>.

8. A message stanza SHOULD NOT be empty or contain only whitespace, but some clients are known to generate such stanzas.

9. XEP-0045: Multi-User Chat <https://xmpp.org/extensions/xep-0045.html>.

10. XEP-0066: Out of Band Data <https://xmpp.org/extensions/xep-0066.html>.

11. XEP-0071: XHTML-IM <https://xmpp.org/extensions/xep-0071.html>.

12. XEP-0085: Chat State Notifications <https://xmpp.org/extensions/xep-0085.html>.

13. XEP-0144: Roster Item Exchange <https://xmpp.org/extensions/xep-0144.html>.

14. XEP-0172: User Nickname <https://xmpp.org/extensions/xep-0172.html>.

15. XEP-0004: Data Forms <https://xmpp.org/extensions/xep-0004.html>.

16. XEP-0009: Jabber-RPC <https://xmpp.org/extensions/xep-0009.html>.

17. XEP-0070: Verifying HTTP Requests via XMPP <https://xmpp.org/extensions/xep-0070.html>.

18. XEP-0072: SOAP over XMPP <https://xmpp.org/extensions/xep-0072.html>.

19. XEP-0155: Stanza Session Negotiation <https://xmpp.org/extensions/xep-0155.html>.

20. XEP-0033: Extended Stanza Addressing <https://xmpp.org/extensions/xep-0033.html>.

21. XEP-0203: Delayed Delivery <https://xmpp.org/extensions/xep-0203.html>.

22. 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/>.

23. 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 <https://xmpp.org/registrar/>.

Appendix H: Revision History

Note: Older versions of this specification might be available at https://xmpp.org/extensions/attic/

  1. Version 0.3 (2008-11-05)

    For consistency, defined Metadata Profile; specified that the registrar shall create a registry for message stanza profiles.

    psa
  2. Version 0.2 (2008-10-01)

    Revised/reordered text.

    jk
  3. Version 0.1 (2007-08-08)

    Initial published version; specified more granular profiles; renamed transmission elements to metadata elements.

    psa
  4. Version 0.0.2 (2007-08-01)

    Clarified that message profiles apply to sending entities as well as receiving entities.

    psa
  5. Version 0.0.1 (2007-08-01)

    First draft.

    jk/psa

Appendix I: Bib(La)TeX Entry

@report{karneges2007profiles,
  title = {Message Stanza Profiles},
  author = {Karneges, Justin and Saint-Andre, Peter},
  type = {XEP},
  number = {0226},
  version = {0.3},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-0226.html},
  date = {2007-08-01/2008-11-05},
}

END