<?xml version='1.0'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
  <!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
    <header>
        <title>Extended Stanza Addressing</title> 
        <abstract>This specification defines 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>
        &LEGALNOTICE;
        <number>0033</number>
        <status>Draft</status>
        <type>Standards Track</type>
        <sig>Standards</sig>
        <dependencies>
            <spec>XMPP Core</spec>
            <spec>XEP-0030</spec>
        </dependencies>
        <supersedes/>
        <supersededby/>
        <shortname>address</shortname>
        <schemaloc>
            <url>http://www.xmpp.org/schemas/address.xsd</url>
        </schemaloc>
        &hildjj;
        &stpeter;

        <revision>
            <version>1.1</version>
            <date>2004-09-15</date>
            <initials>psa</initials>
            <remark>Per list discussion, removed prohibition on multiple replyto and replyroom addresses, since this is allowed by RFC 822.</remark>
        </revision>

        <revision>
            <version>1.0</version>
            <date>2004-05-10</date>
            <initials>psa</initials>
            <remark>Per a vote of the Jabber Council, advanced status to Draft; also added Security Considerations in consultation with author.</remark>
        </revision>

        <revision>
            <version>0.10</version>
            <date>2004-03-18</date>
            <initials>psa</initials>
            <remark>Disallowed &lt;addresses/&gt; as direct child 
            of &IQ;.</remark>
        </revision>

        <revision>
            <version>0.9</version>
            <date>2004-02-27</date>
            <initials>jjh</initials>
            <remark>Added language note on desc attribute.  Ensured
            that if uri attribute is used, node MUST NOT be.</remark>
        </revision>

        <revision>
            <version>0.8</version>
            <date>2004-02-11</date>
            <initials>jjh</initials>

            <remark>Editorial cleanups, rearrangement.  Allowed IQ's
            in certain cases.  Clarified node rules.  Changed
            delivered='yes' to delivered='true'.  Noreply shouldn't
            imply no other addresses.  Clarified when authorization
            checks take place.  Remove own address on reply.  Bad URI
            error added.</remark>
        </revision>

        <revision>
            <version>0.7</version>
            <date>2004-02-04</date>
            <initials>jjh</initials>

            <remark>Clarified that a node attribute refers to a disco
            node.</remark>
        </revision>

        <revision>
            <version>0.6</version>
            <date>2004-02-04</date>
            <initials>jjh</initials>

            <remark>Changed namespace to
            'http://www.jabber.org/protocol/address', and removed one
            level of nesting, since addresses are the only block left.
            Made it clearer that the session manager can implement
            multicast directly.  Removed infobits (needs to be a
            separate specification).  Reworked the examples to be more correct.
            Added reply handling rules. Added schema.</remark>

        </revision>
        <revision>
            <version>0.5</version>
            <date>2003-12-17</date>
            <initials>jjh</initials>

            <remark>Replaced info with infobits, added noreply address
            type.</remark>

        </revision>
        <revision>
            <version>0.4</version>
            <date>2003-12-15</date>
            <initials>jjh</initials>

            <remark>Removed trace; if you want that, use a different
            namespace.  Required disco use, and removed agents/browse.
            Added URI addressing.</remark>

        </revision>
        <revision>
            <version>0.3</version>
            <date>2002-07-29</date>
            <initials>jjh</initials>
            <remark>Made addresses extensible, added replyroom</remark>
        </revision>
        <revision>
            <version>0.2</version>
            <date>2002-05-06</date>
            <initials>jjh</initials>
            <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>
    <section1 topic='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><link url='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>
    </section1>
    <section1 topic='Discovering Server Support' anchor='disco'>
        <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>
        
        <section2 topic='Disco to determine support' anchor='disco-support'>
            <p>To determine if a server or service supports Extended Stanza Addressing, the requesting entity SHOULD send a disco#info request to it.</p>

           <example caption='Disco request for address header support'><![CDATA[
<iq type='get'
    from='romeo@montague.net/orchard'
    to='multicast.montague.net'
    id='info1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>]]>
           </example>
            <p>If the server supports Extended Stanza Addressing, it MUST include a "http://jabber.org/protocol/address" feature in the response.</p>
           <example caption='Disco response for server supporting address headers'><![CDATA[
<iq type='result'
    from='multicast.montague.net'
    to='romeo@montague.net/orchard'
    id='info1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    ...
    <feature var='http://jabber.org/protocol/address'/>
    ...
  </query>
</iq>]]>
           </example>
        </section2>

        <section2 topic='Multicast service' anchor='disco-multicast'>
            <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 <link url='#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>

        <section2 topic='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>

    <section1 topic='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>

    <section1 topic='Addresses' anchor='addresses'>
        <p>Address values are packaged together into an
        &lt;addresses/&gt; element.</p>

        <example caption='Message with an extended address'><![CDATA[<message to='multicast.jabber.org'>
   <addresses xmlns='http://jabber.org/protocol/address'>
       <address type='to' jid='hildjj@jabber.org/Work' desc='Joe Hildebrand'/>
       <address type='cc' jid='jer@jabber.org/Home' desc='Jeremie Miller'/>
   </addresses>
   <body>Hello, world!</body>
</message>]]></example>

        <example caption='Presence with an extended address'><![CDATA[<presence from='hildjj@jabber.com' to='multicast.jabber.org' type='unavailable'>
    <addresses xmlns='http://jabber.org/protocol/address'>
        <address type='bcc' jid='temas@jabber.org'/>
        <address type='bcc' jid='jer@jabber.org'/>
    </addresses>
</presence>]]></example>

        
        <p>Each address to which the sender wants the stanza to be re-sent will show up as an &lt;address/&gt; in the &lt;addresses/&gt; element.  There are several different types of address, shown below.</p>

        <p>An &lt;address/&gt; element MUST possess a 'type' attribute, and MUST possess at least one of the 'jid', 'uri', 'node', and 'desc' attributes. An &lt;address/&gt; 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>

        <section2 topic="'jid' attribute" anchor='addr-jid'>
            <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>
        </section2>

        <section2 topic="'uri' attribute" anchor='addr-uri'>
            <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 &amp; &lt; &gt; &apos; &quot; replaced by their equivalent XML escapes, &amp;amp; &amp;lt; &amp;gt; &amp;apos; &amp;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>
        </section2>

        <section2 topic="'node' attribute" anchor='addr-node'>
            <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>
        </section2>

        <section2 topic="'desc' attribute" anchor='addr-desc'>
            <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>
        </section2>

        <section2 topic="'delivered' attribute" anchor='addr-delivered'>
            <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 <link url='#multicast'>Multicast Usage</link> section below for more details. Support for the 'delivered' attribute is REQUIRED.</p>
        </section2>

        <section2 topic="'type' attribute" anchor='addr-type'>
            <p>The 'type' attribute is used to specify the semantics of a particular address. Support for the 'type' attribute is REQUIRED.</p>

            <section3 topic="Address type='to'" anchor='addr-type-to'>
                <p>These addressees are the primary recipients of the stanza.</p>
            </section3>
            <section3 topic="Address type='cc'" anchor='addr-type-cc'>
                <p>These addressees are the secondary recipients of the stanza.</p>
            </section3>
            <section3 topic="Address type='bcc'" anchor='addr-type-bcc'>
                <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>
            </section3>
            <section3 topic="Address type='replyto'" anchor='addr-type-replyto'>
                <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>
            </section3>
            <section3 topic="Address type='replyroom'" anchor='addr-type-replyroom'>
                <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>
            </section3>
            <section3 topic="Address type='noreply'" anchor='addr-type-noreply'>
                <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>
            </section3>
        </section2>

        <section2 topic="Extensibility" anchor='extensibility'>
            <p>As specified herein, the &lt;address/&gt; element is empty.  Implementations or future protocols MAY extend the &lt;address/&gt; 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>

            <example caption='Possible future extension'><![CDATA[<message to='groups.jabber.org'>
  <addresses xmlns='http://jabber.org/protocol/address'>
    <address type='to' desc='Foo Group'>
      <group xmlns='some:funny:group:ns'>foo</group>
    </address>
    <address type='replyroom' jid='jdev@conference.jabber.org'/>
  </addresses>
</message>]]></example>      
        </section2>
    </section1>

    <section1 topic='Multicast Usage' anchor='multicast'>
        <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
            &lt;address type='bcc'/&gt; 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>

    <section1 topic='Example Flow' anchor='examples'>
        <p>Assume for these examples that header1.org and header2.org
        support address headers, and noheader.org does not.</p>

        <example caption='Client checks local server for address header support'><![CDATA[<iq type='get' to='header1.org' from='a@header1.org/work' id='id_1'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>]]></example>

        <example caption='Client receives positive results from server'><![CDATA[<iq type='result' from='header1.org' to='a@header1.org/work' id='id_1'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <feature var='http://jabber.org/protocol/address'/>
  </query>
</iq>]]></example>

        <example caption='Client sends message to local server with address header'><![CDATA[<message to='header1.org' from='a@header1.org/work'>
   <addresses xmlns='http://jabber.org/protocol/address'>
     <address type='to'  jid='to@header1.org'/>
     <address type='cc'  jid='cc@header1.org'/>
     <address type='bcc' jid='bcc@header1.org'/>
     <address type='to'  jid='to@header2.org'/>
     <address type='cc'  jid='cc@header2.org'/>
     <address type='bcc' jid='bcc@header2.org'/>
     <address type='to'  jid='to@noheader.org'/>
     <address type='cc'  jid='cc@noheader.org'/>
     <address type='bcc' jid='bcc@noheader.org'/>
   </addresses>
   <body>Hello, World!</body>
</message>]]></example>

        <example caption='Server delivers to local addresses'><![CDATA[<message to='to@header1.org' from='a@header1.org/work'>
   <addresses xmlns='http://jabber.org/protocol/address'>
      <address type='to' jid='to@header1.org' delivered='true'/>
      <address type='cc' jid='cc@header1.org' delivered='true'/>
      <address type='to' jid='to@header2.org' delivered='true'/>
      <address type='cc' jid='cc@header2.org' delivered='true'/>
      <address type='to' jid='to@noheader.org' delivered='true'/>
      <address type='cc' jid='cc@noheader.org' delivered='true'/>
   </addresses>
   <body>Hello, World!</body>
</message>
<message to='cc@header1.org' from='a@header1.org/work'>
   <addresses xmlns='http://jabber.org/protocol/address'>
     <address type='to' jid='to@header1.org' delivered='true'/>
     <address type='cc' jid='cc@header1.org' delivered='true'/>
     <address type='to' jid='to@header2.org' delivered='true'/>
     <address type='cc' jid='cc@header2.org' delivered='true'/>
     <address type='to' jid='to@noheader.org' delivered='true'/>
     <address type='cc' jid='cc@noheader.org' delivered='true'/>
   </addresses>
   <body>Hello, World!</body>
</message>
<message to='bcc@header1.org' from='a@header1.org/work'>
   <addresses xmlns='http://jabber.org/protocol/address'>
     <address type='to' jid='to@header1.org' delivered='true'/>
     <address type='cc' jid='cc@header1.org' delivered='true'/>
     <address type='to' jid='to@header2.org' delivered='true'/>
     <address type='cc' jid='cc@header2.org' delivered='true'/>
     <address type='to' jid='to@noheader.org' delivered='true'/>
     <address type='cc' jid='cc@noheader.org' delivered='true'/>
   </addresses>
   <body>Hello, World!</body>
</message>]]></example>

        <example caption='Local server checks target server for address support'><![CDATA[<iq type='get' to='header2.org' from='header1.org' id='id_2'>
   <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]></example>

        <example caption='Local server receives initial negative results from target server'><![CDATA[<iq type='result' from='header2.org' to='header1.org' id='id_2'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
... no address feature ...
  </query>
</iq>]]></example>

        <example caption='Local server checks target server for another component having address support'><![CDATA[<iq type='get' to='header2.org' from='header1.org' id='id_3'>
   <query xmlns='http://jabber.org/protocol/disco#items'/>
</iq>
]]></example>

        <example caption='Local server receives associated services from target server'><![CDATA[<iq type='result' from='header2.org' to='header1.org' id='id_3'>
  <query xmlns='http://jabber.org/protocol/disco#items>
    <item jid='multicast.header2.org'
          name='Multicast Service'/>
  </query>
</iq>]]></example>

        <example caption='Local server checks associated services for address support'><![CDATA[<iq type='get' to='multicast.header2.org' from='header1.org' id='id_4'>
   <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]></example>

        <example caption='Local server receives positive results from target server'><![CDATA[<iq type='result' from='multicast.header2.org' to='header1.org/work' id='id_4'>
  <query xmlns='http://jabber.org/protocol/disco#info'>
    <feature var='http://jabber.org/protocol/address'/>
  </query>
</iq>]]></example>

        <example caption='Local server delivers to target server supporting address headers'><![CDATA[<message to='multicast.header2.org' from='a@header1.org/work'>
   <addresses xmlns='http://jabber.org/protocol/address'>
      <address type='to'  jid='to@header1.org' delivered='true'/>
      <address type='cc'  jid='cc@header1.org' delivered='true'/>
      <address type='to'  jid='to@header2.org'/>
      <address type='cc'  jid='cc@header2.org'/>
      <address type='bcc' jid='bcc@header2.org'/>
      <address type='to'  jid='to@noheader.org' delivered='true'/>
      <address type='cc'  jid='cc@noheader.org' delivered='true'/>
   </addresses>
   <body>Hello, World!</body>
</message>]]></example>
         <example caption='Target server delivers to its recipients'><![CDATA[<message to='to@header2.org' from='a@header1.org/work'>
   <addresses xmlns='http://jabber.org/protocol/address'>
      <address type='to' jid='to@header1.org'  delivered='true'/>
      <address type='cc' jid='cc@header1.org'  delivered='true'/>
      <address type='to' jid='to@header2.org'  delivered='true'/>
      <address type='cc' jid='cc@header2.org'  delivered='true'/>
      <address type='to' jid='to@noheader.org' delivered='true'/>
      <address type='cc' jid='cc@noheader.org' delivered='true'/>
   </addresses>
   <body>Hello, World!</body>
</message>
<message to='cc@header2.org' from='a@header1.org/work'>
   <address xmlns='http://jabber.org/protocol/address'>
      <address type='to' jid='to@header1.org'  delivered='true'/>
      <address type='cc' jid='cc@header1.org'  delivered='true'/>
      <address type='to' jid='to@header2.org'  delivered='true'/>
      <address type='cc' jid='cc@header2.org'  delivered='true'/>
      <address type='to' jid='to@noheader.org' delivered='true'/>
      <address type='cc' jid='cc@noheader.org' delivered='true'/>
   </addresses>
   <body>Hello, World!</body>
</message>
<message to='bcc@header2.org' from='a@header1.org/work'>
   <address xmlns='http://jabber.org/protocol/address'>
      <address type='to' jid='to@header1.org'  delivered='true'/>
      <address type='cc' jid='cc@header1.org'  delivered='true'/>
      <address type='to' jid='to@header2.org'  delivered='true'/>
      <address type='cc' jid='cc@header2.org'  delivered='true'/>
      <address type='to' jid='to@noheader.org' delivered='true'/>
      <address type='cc' jid='cc@noheader.org' delivered='true'/>
   </addresses>
   <body>Hello, World!</body>
</message>]]></example>

        <example caption='Local server checks target server for address header support'><![CDATA[<iq type='get' to='noheader.org' from='header1.org' id='id_5'>
  <query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>]]></example>

        <example caption='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'>
   <query xmlns='http://jabber.org/protocol/disco#info'>
... no address feature ...
   </query>
</iq>]]></example>

        <example caption='Server delivers to each address on the target server not supporting address headers'><![CDATA[<message to='to@noheader.org' from='a@header1.org/work'>
   <addresses xmlns='http://jabber.org/protocol/address'>
      <address type='to' jid='to@header1.org'  delivered='true'/>
      <address type='cc' jid='cc@header1.org'  delivered='true'/>
      <address type='to' jid='to@header2.org'  delivered='true'/>
      <address type='cc' jid='cc@header2.org'  delivered='true'/>
      <address type='to' jid='to@noheader.org' delivered='true'/>
      <address type='cc' jid='cc@noheader.org' delivered='true'/>
   </addresses>
   <body>Hello, World!</body>
</message>
<message to='cc@noheader.org' from='a@header1.org/work'>
   <addresses xmlns='http://jabber.org/protocol/address'>
      <address type='to' jid='to@header1.org'  delivered='true'/>
      <address type='cc' jid='cc@header1.org'  delivered='true'/>
      <address type='to' jid='to@header2.org'  delivered='true'/>
      <address type='cc' jid='cc@header2.org'  delivered='true'/>
      <address type='to' jid='to@noheader.org' delivered='true'/>
      <address type='cc' jid='cc@noheader.org' delivered='true'/>
   </addresses>
   <body>Hello, World!</body>
</message>
<message to='bcc@noheader.org' from='a@header1.org/work'>
   <addresses xmlns='http://jabber.org/protocol/address'>
      <address type='to' jid='to@header1.org'  delivered='true'/>
      <address type='cc' jid='cc@header1.org'  delivered='true'/>
      <address type='to' jid='to@header2.org'  delivered='true'/>
      <address type='cc' jid='cc@header2.org'  delivered='true'/>
      <address type='to' jid='to@noheader.org' delivered='true'/>
      <address type='cc' jid='cc@noheader.org' delivered='true'/>
   </addresses>
   <body>Hello, World!</body>
</message>]]></example>
    </section1>

    <section1 topic='Reply Handling' anchor='replies'>
        <p>When replying to a message stanza that contains an extended
        address, the following rules apply:</p>

        <ol>
            <li>If a noreply address is
            specified, a reply SHOULD NOT be generated.</li> 

            <li>If a replyroom address is specified, the client SHOULD
            join the specified chat room instead of replying directly
            to the specified user.  No further extended address
            processing is required.</li>

            <li>If a replyto address is specified, the reply SHOULD go
            to the specified address.  No further extended address
            processing is required.  Any &lt;thread/&gt; element from
            the initial message MUST be copied into the reply.</li>

            <li>Otherwise, an extended-address aware client MUST copy
            the address header from the original message into the reply,
            removing any delivered attributes.  If the original sender
            is not in the copied list, the original sender MUST be
            added as a 'to' address.  The recipient's address SHOULD
            be removed from the list.  The client then proceeds with
            the rules from the <link url='#multicast'>Multicast Usage</link>
            section above for delivery of the message.</li>
        </ol>
    </section1>

    <section1 topic='Error Conditions' anchor='errors'>
        <p>The following error conditions are to be used by implementations (for further information regarding error syntax, see &xep0086;):</p>
        <table caption='Error Conditions'>
          <tr>
            <th>XMPP Condition</th>
            <th>Purpose</th>
          </tr>
          <tr>
            <td>&lt;forbidden/&gt;</td>
            <td>The sending user does not have permission to use this multicast service.</td>
          </tr>
          <tr>
            <td>&lt;jid-malformed/&gt;</td>
            <td>A URI attribute was invalid or not understood (note that support for the 'uri' attribute is optional).</td>
          </tr>
          <tr>
            <td>&lt;not-acceptable/&gt;</td>
            <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>
          </tr>
        </table>
    </section1>

  <section1 topic='Security Considerations' anchor='security'>
    <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>
  </section1>
  <section1 topic='IANA Considerations' anchor='iana'>
    <p>This document requires no interaction with &IANA;.</p>
  </section1>
  <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
    <p>The &REGISTRAR; shall include 'http://jabber.org/protocol/address' in its registry of protocol namespaces.</p>
  </section1>

    <section1 topic='XML Schema' anchor='schema'>
        <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='http://jabber.org/protocol/address'
    xmlns='http://jabber.org/protocol/address'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0033: http://www.xmpp.org/extensions/xep-0033.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name='addresses'>
     <xs:complexType>
        <xs:sequence>
           <xs:element ref='address'
                       minOccurs='1'
                       maxOccurs='unbounded'/>
        </xs:sequence>
     </xs:complexType>
  </xs:element>

  <xs:element name='address'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='empty'>
          <xs:attribute name='delivered' use='optional' fixed='true'/>
          <xs:attribute name='desc' use='optional' type='xs:string'/>
          <xs:attribute name='jid' use='optional' type='xs:string'/>
          <xs:attribute name='node' use='optional' type='xs:string'/>
          <xs:attribute name='type' use='required'>
            <xs:simpleType>
              <xs:restriction base='xs:NCName'>
                <xs:enumeration value='bcc'/>
                <xs:enumeration value='cc'/>
                <xs:enumeration value='noreply'/>
                <xs:enumeration value='replyroom'/>
                <xs:enumeration value='replyto'/>
                <xs:enumeration value='to'/>
              </xs:restriction>
            </xs:simpleType>
          </xs:attribute>
          <xs:attribute name='uri' use='optional' type='xs:string'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name='empty'>
    <xs:restriction base='xs:string'>
      <xs:enumeration value=''/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
        ]]></code>
    </section1>

    <section1 topic='Acknowledgements' anchor='ack'>
        <p>Sections of this document were inspired by RFC 822.</p>
    </section1>
</xep>
