<abstract>This document specifies an XMPP protocol extension that enables entities to include RFC822-style address headers within XMPP stanzas in order to specify multiple recipients or sub-addresses.</abstract>
<remark>Re-worked to simpler/more structured XML.</remark>
</revision>
<revision>
<version>0.1</version>
<date>2002-04-19</date>
<initials>jjh</initials>
<remark>Initial version.</remark>
</revision>
</header>
<section1topic='Introduction'anchor='intro'>
<p>On the existing Jabber network, there are many opportunities to optimize stanza traffic. For example, clients that want to send the same stanza to multiple recipients currently must send multiple stanzas. Similarly, when a user comes online the server sends many nearly-identical presence stanzas to remote servers.</p>
<p>The 'http://jabber.org/protocol/address' specification provides a method for both clients and servers to send a single stanza and have it be delivered to multiple recipients, similar to that found in &rfc0822;. As a side-effect, it also provides all of the functionality specified by the old 'jabber:x:envelope' <note><linkurl='http://www.jabber.org/old-docs/proto-draft/envelope.html'>jabber:x:envelope</link> - Message Envelope Information Extension</note> proposal, which this XEP can supersede.</p>
<p>Support for Extended Stanza Addressing in a given server instance SHOULD be determined using &xep0030;. A conforming server MUST respond to disco#info requests.</p>
<p>The IM service MAY implement multicast directly, or it MAY delegate that chore to a separate service. A client can use the following approach to find a multicast-capable service hosted by its domain:</p>
<ol>
<li>Send a disco#info request to the IM server; if its reply includes the 'http://jabber.org/protocol/address' feature, then it is a multicast-capable service.</li>
<li>If the IM server is not a multicast-capable service, send a disco#items request to the IM server; the IM server will then return a list of associated services.</li>
<li>Send a disco#info request to each of the services associated with the IM server; if one of the replies includes the 'http://jabber.org/protocol/address' feature, then that service is a multicast-capable service.</li>
</ol>
<p>The multicast service MAY choose to limit which local users can use the service. The server MAY choose to limit whether non-local servers can send address headers that require the local server to send to third parties (relaying). In either case, if the server chooses to disallow the request, the server MUST return a Forbidden error (see the <linkurl='#errors'>Error Conditions</link> section below). In the relaying case, the server SHOULD NOT deliver to <em>any</em> of the addresses (even the local ones) if the sender is disallowed.</p>
</section2>
<section2topic='Caching'anchor='disco-caching'>
<p>Implementations MAY choose to cache the disco response.
Positive responses MAY be cached differently than negative
responses. The result SHOULD NOT be cached for more than 24
hours, unless some sort of time-to-live information is
added to the Service Discovery protocol in the future.</p>
</section2>
</section1>
<section1topic='Outer Stanza'anchor='outer'>
<p>For multicast processing, the stanza containing an address header
(the 'outer stanza') MUST be addressed to the multicast service,
with no username or resource in the 'to' attribute.</p>
<p>When used for additional information in a one-to-one stanza
(e.g. using the 'node' attribute), the outer stanza SHOULD be
addressed directly to the recipient, not to the multicast
service.</p>
<p>A multicast service MUST NOT change the 'from' address on
the outer stanza. Note that this will limit third-party
relaying across server-to-server connections as a side-effect.</p>
<p>Address headers MAY be included in message or presence
stanzas. They MUST NOT be included as the direct child of an
IQ stanza.</p>
</section1>
<section1topic='Addresses'anchor='addresses'>
<p>Address values are packaged together into an
<addresses/> element.</p>
<examplecaption='Message with an extended address'><![CDATA[<message to='multicast.jabber.org'>
<p>Each address to which the sender wants the stanza to be re-sent will show up as an <address/> in the <addresses/> element. There are several different types of address, shown below.</p>
<p>An <address/> element MUST possess a 'type' attribute, and MUST possess at least one of the 'jid', 'uri', 'node', and 'desc' attributes. An <address/> element MUST NOT possess both a 'jid' attribute and a 'uri' attribute. If sending through a multicast service, an address MUST include a 'jid' or a 'uri' attribute, unless it is of type 'noreply'.</p>
<p>The 'jid' attribute is used to specify a simple Jabber ID associated with this address. If the 'jid' attribute is specified, the 'uri' attribute MUST NOT be specified. Support for the 'jid' attribute is REQUIRED.</p>
<p>The 'uri' attribute is used to specify an external system address, such as a sip:, sips:, or im: URI. If the 'uri' attribute is specified, the 'jid' and 'node' attributes MUST NOT be specified. These URIs MUST be formatted as specified in their respective RFCs, however with the characters &<>'" replaced by their equivalent XML escapes, &amp; &lt; &gt; &apos; &quot;. If a receiving entity does not understand the given URI scheme, or if the URI is not formatted correctly, a "JID Malformed" error SHOULD be returned. Support for the 'uri' attribute is OPTIONAL.</p>
<p>The 'node' attribute is used to specify a sub-addressable unit at a particular JID, corresponding to a Service Discovery node. A node attribute MAY be included if a 'jid' attribute is specified. If a 'uri' attribute is specified, a 'node' attribute MUST NOT be specified. Support for the 'node' attribute is RECOMMENDED.</p>
<p>The 'desc' attribute is used to specify human-readable information for this address. This data may be used by clients to provide richer address-book integration. This information is in the language of the sender, which MAY be identified using the standard xml:lang rules from &xmppcore;. Support for the 'desc' attribute is RECOMMENDED.</p>
<p>When a multicast service delivers the stanza to a non-bcc address, it MUST add a delivered='true' attribute to the address element. A multicast service MUST NOT deliver to an address that was marked with a delivered='true' attribute when the service received the stanza. A multicast service SHOULD attempt to deliver to all addresses that are not marked with a delivered='true' attribute. The delivered attribute is used to prevent loops. See the <linkurl='#multicast'>Multicast Usage</link> section below for more details. Support for the 'delivered' attribute is REQUIRED.</p>
<p>These addressees should receive 'blind carbon copies' of the stanza. This means that the server MUST remove these addresses before the stanza is delivered to anyone other than the given bcc addressee or the multicast service of the bcc addressee.</p>
<p>This is the address to which all replies are requested to be sent. Clients SHOULD respect this request unless an explicit override occurs. There MAY be more than one replyto or replyroom on a stanza, in which case the reply stanza MUST be routed to all of the addresses.</p>
<p>This is the JID of a &xep0045; room to which responses should be sent. When a user wants to reply to this stanza, the client SHOULD join this room first. Clients SHOULD respect this request unless an explicit override occurs. There MAY be more than one replyto or replyroom on a stanza, in which case the reply stanza MUST be routed to all of the addresses.</p>
<p>This address type contains no actual address information. Instead, it means that the receiver SHOULD NOT reply to the message. This is useful when broadcasting messages to many receivers.</p>
<p>As specified herein, the <address/> element is empty. Implementations or future protocols MAY extend the <address/> element for additional functionality, but any extensions are out of scope for this XEP. Such extensions SHOULD be appropriately qualified with a new namespace, and any extensions that are not understood by an implementation MUST be ignored.</p>
<p>The following usage scenario shows how messages flow through both address-enabled and non-address-enabled portions of the Jabber network.</p>
<p>Note: the logic associated with <em>how</em> to perform the following tasks is purely informational. A conforming service MUST generate output as if these rules had been followed, but need not (and probably <em>will not</em>) use this algorithm.</p>
<ol>
<li>User desires to send a stanza to more than one
recipient.</li>
<li>Client determines the JID of a multicast service,
using Service Discovery.</li>
<li>If no multicast service is found, the client MAY
choose to deliver each stanza individually, or it MAY
query each of the servers associated with desired
recipients, and batch stanzas to those servers
itself.</li>
<li>If a multicast service is found, the client constructs
a stanza with an address block, and sends it to the
multicast service. (Note: For the following rules, any
address that was marked on the incoming address header
with delivered='true' is never re-delivered.)</li>
<li>The server checks to see if it can deliver to all of
the specified addresses. If not, the stanza is returned
with a "Forbidden" error, and processing stops.</li>
<li>The server adds a delivered='true' attribute to all
addresses.</li>
<li>The server removes all type='bcc' attributes.</li>
<li>The server delivers the stanza to all of the 'to',
'cc', and 'bcc' addresses from the original address header that
are being handled locally. The server replaces the
'to' attribute on the outer stanza with the JID of each
addressee. Each 'bcc' recipient MUST receive only the
<address type='bcc'/> associated with that
addressee.</li>
<li>For each non-local server (the 'target server') that
has addresses specified in 'to', 'cc', or 'bcc' addresses
in the original address header, the local server determines
whether the target server supports multicast, using Service
Discovery.</li>
<li>If the target server does not support address headers, the
local server sends a copy of the stanza to each address,
with the 'to' attribute on the outer stanza set to the JID
of the given addressee.</li>
<li>If the target server does support address headers, the server
removes the delivered='true' attributes on each of the
addresses bound for that server, and replaces the 'to'
attribute on the outer stanza with the adress of the
multicast service for the target server. The 'bcc'
addresses for the target server from the original address header
are added back to the address header. A single stanza is sent to
the target server.</li>
</ol>
</section1>
<section1topic='Example Flow'anchor='examples'>
<p>Assume for these examples that header1.org and header2.org
support address headers, and noheader.org does not.</p>
<examplecaption='Client checks local server for address header support'><![CDATA[<iq type='get' to='header1.org' from='a@header1.org/work' id='id_1'>
<examplecaption='Local server checks target server for another component having address support'><![CDATA[<iq type='get' to='header2.org' from='header1.org' id='id_3'>
<examplecaption='Local server delivers to target server supporting address headers'><![CDATA[<message to='multicast.header2.org' from='a@header1.org/work'>
<examplecaption='Local server receives negative results from target server (assume no associated services found)'><![CDATA[<iq type='result' from='noheader.org' to='header1.org' id='id_5'>
<examplecaption='Server delivers to each address on the target server not supporting address headers'><![CDATA[<message to='to@noheader.org' from='a@header1.org/work'>
<td>Too many receiver fields were specified. Servers SHOULD have a configurable upper limit for the number of addresses. The limit SHOULD be more than 20 and less than 100.</td>
<p>A recipient SHOULD trust a stanza's extended addressing headers only as much as it trusts the sender of the stanza.</p>
<p>Furthermore, there exists the potential for abuse related to the 'replyto' and 'replyroom' features (e.g., an entity could send messages with 'replyroom' set to the address of a room that hosts salacious content or with 'replyto' set to the address of a spambot that harvests Jabber addresses). Therefore if a human user's receiving application receives a message with extended stanza addressing that specifies a 'replyto' or 'replyroom' address other than that of the sender, it SHOULD inform the user of that fact. (Naturally, the receiving application MAY also limit the entities to which the recipient can reply using privacy lists as specified in &xmppim;.)</p>