draft-saintandre-rfc3921bis-02.txt  -->   draft-saintandre-rfc3921bis-03.txt

view Side-By-Side changes



XMPP


Network Working Group                                P. Saint-Andre Saint-Andre, Ed.
Internet-Draft                                                       XSF                                 XMPP Standards Foundation
Obsoletes: 3921 (if approved)                              July 17, 2007
Intended status: Standards Track                          April 17, 2007
Expires: October 19, 2007 January 18, 2008


Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and
                                Presence
                     draft-saintandre-rfc3921bis-02
                     draft-saintandre-rfc3921bis-03

Status of this Memo

   By submitting this Internet-Draft, each author represents that any
   applicable patent or other IPR claims of which he or she is aware
   have been or will be disclosed, and any of which he or she becomes
   aware will be disclosed, in accordance with Section 6 of BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups.  Note that
   other groups may also distribute working documents as Internet-
   Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at
   http://www.ietf.org/ietf/1id-abstracts.txt.

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   This Internet-Draft will expire on October 19, 2007. January 18, 2008.

Copyright Notice

   Copyright (C) The IETF Trust (2007).

Abstract

   This document describes extensions to the core features of the
   Extensible Messaging and Presence Protocol (XMPP) that provide basic
   instant messaging (IM) and presence functionality in conformance with
   RFC 2779.

   This document obseletes obsoletes RFC 3921.



Saint-Andre             Expires October 19, 2007 January 18, 2008                [Page 1]

Internet-Draft                   XMPP IM                      April                       July 2007


Table of Contents

   1.  Introduction . . . . . . . . . . . . . . . . . . . . . . . . .  4
     1.1.  Overview . . . . . . . . . . . . . . . . . . . . . . . . .  4
     1.2.  Requirements . . . . . . . . . . . . . . . . . . . . . . .  4
     1.3.  Typical Session Flow . . . . . . . . . . . . . . . . . . .  5
     1.4.  Terminology  Conventions  . . . . . . . . . . . . . . . . . . . . . . .  6
   2.  Managing the Roster  . . . . . . . . . . . . . . . . . . . . .  6
     2.1.  Syntax and Semantics . . . . . . . . . . . . . . . . . . .  6
     2.2.  Business Rules . . . . . . . . . . . . . . . . . . . . . .  7
     2.3.  Retrieving One's the Roster on Login . . . . . . . . . . . . .  7
     2.4. .  9
     2.3.  Adding a Roster Item . . . . . . . . . . . . . . . . . . .  8
     2.5. 10
     2.4.  Updating a Roster Item . . . . . . . . . . . . . . . . . . 10
     2.6. 15
     2.5.  Deleting a Roster Item . . . . . . . . . . . . . . . . . . 11 17
   3.  Managing Presence Subscriptions  . . . . . . . . . . . . . . . 12 18
     3.1.  Requesting a Subscription  . . . . . . . . . . . . . . . . 12 18
     3.2.  Handling  Cancelling a Subscription Request  . . . . . . . . . . . . . 13 . . . 24
     3.3.  Cancelling a Subscription from Another Entity  Unsubscribing  . . . . . . . 14
     3.4.  Unsubscribing from Another Entity's Presence . . . . . . . 14 . . . . . . . . 26
   4.  Exchanging Presence Information  . . . . . . . . . . . . . . . 14 27
     4.1.  Overview . . . . . . . . . . . . . . . . . . . . . . . . . 14 28
     4.2.  Initial Presence . . . . . . . . . . . . . . . . . . . . . 16 28
     4.3.  Presence Probes  . . . . . . . . . . . . . . . . . . . . . 17 30
     4.4.  Subsequent Presence Broadcast  . . . . . . . . . . . . . . 18 32
     4.5.  Unavailable Presence . . . . . . . . . . . . . . . . . . . 18 34
     4.6.  Directed Presence  . . . . . . . . . . . . . . . . . . . . 19 36
     4.7.  Presence Syntax  . . . . . . . . . . . . . . . . . . . . . 20 37
   5.  Exchanging Messages  . . . . . . . . . . . . . . . . . . . . . 23 41
     5.1.  Overview  Attributes . . . . . . . . . . . . . . . . . . . . . . . . . 23 41
     5.2.  Specifying a Message Body  . . . . . . . . .  Child Elements . . . . . . . 25
     5.3.  Specifying a Message Subject . . . . . . . . . . . . . . . 26
     5.4.  Specifying a Conversation Thread . 43
     5.3.  Extended Content . . . . . . . . . . . . 26
     5.5.  Message Errors . . . . . . . . . 45
   6.  Exchanging IQ Stanzas  . . . . . . . . . . . . . 27
     5.6.  Extended Namespaces . . . . . . . 46
   7.  A Sample Session . . . . . . . . . . . . 27
   6.  Exchanging IQ Stanzas . . . . . . . . . . . 46
   8.  Server Rules for Processing XML Stanzas  . . . . . . . . . 27
   7.  Examples . . 52
     8.1.  No Such User . . . . . . . . . . . . . . . . . . . . . . . 53
     8.2.  Full JID at Local Domain . . 27
   8.  Server Rules for Handling XML Stanzas . . . . . . . . . . . . 34
     8.1.  Inbound Stanzas . . . 53
     8.3.  Bare JID at Local Domain . . . . . . . . . . . . . . . . . 53
     8.4.  Foreign Domain . 34
     8.2.  Outbound Stanzas . . . . . . . . . . . . . . . . . . . . . 36 56
   9.  IM and Presence Compliance Requirements  . . . . . . . . . . . 36 57
     9.1.  Servers  . . . . . . . . . . . . . . . . . . . . . . . . . 37 57
     9.2.  Clients  . . . . . . . . . . . . . . . . . . . . . . . . . 37 57
   10. Internationalization Considerations  . . . . . . . . . . . . . 37 58
   11. Security Considerations  . . . . . . . . . . . . . . . . . . . 37 58
   12. IANA Considerations  . . . . . . . . . . . . . . . . . . . . . 38 59
     12.1. Instant Messaging SRV Protocol Label Registration  . . . . 38 59
     12.2. Presence SRV Protocol Label Registration . . . . . . . . . 39 59
   13. References . . . . . . . . . . . . . . . . . . . . . . . . . . 39



Saint-Andre             Expires October 19, 2007                [Page 2]

Internet-Draft                   XMPP IM                      April 2007 60
     13.1. Normative References . . . . . . . . . . . . . . . . . . . 39 60
     13.2. Informative References . . . . . . . . . . . . . . . . . . 40 60
   Appendix A.  Integration of Roster Management and Presence
                Subscriptions  Subscription States . . . . . . . . . . . . . . . . . 61



Saint-Andre             Expires January 18, 2008                [Page 2]

Internet-Draft                   XMPP IM                       July 2007


     A.1.  Defined States . . . 40
     A.1.  Overview . . . . . . . . . . . . . . . . . . . 62
     A.2.  Server Processing of Outbound Presence Subscription
           Stanzas  . . . . . . 41
     A.2.  User Subscribes to Contact . . . . . . . . . . . . . . . . 41 . . . 63
     A.3.  Creating a Mutual  Server Processing of Inbound Presence Subscription
           Stanzas  . . . . . . . . . . . . . . 47
     A.4.  Unsubscribing . . . . . . . . . . . 65
   Appendix B.  Blocking Communication  . . . . . . . . . . . 51
     A.5.  Cancelling a Subscription . . . . 68
   Appendix C.  vCards  . . . . . . . . . . . . 56
     A.6.  Removing a Roster Item and Cancelling All Subscriptions  . 60
   Appendix B.  Subscription States . . . . . . . . . . . . . . . . . 63
     B.1.  Defined States . . . . . . . . . . . . . . . . . . . . . . 63
     B.2.  Server Handling of Outbound Presence Subscription
           Stanzas  . . 68
   Appendix D.  XML Schemas . . . . . . . . . . . . . . . . . . . . . 68
     D.1.  jabber:client  . . 64
     B.3.  Server Handling of Inbound Presence Subscription
           Stanzas . . . . . . . . . . . . . . . . . . . . 69
     D.2.  jabber:server  . . . . . 66
   Appendix C.  Blocking Communication . . . . . . . . . . . . . . . 69
   Appendix D.  vCards . . 73
     D.3.  jabber:iq:roster . . . . . . . . . . . . . . . . . . . . . 69 77
   Appendix E.  XML Schemas . . . . . . . . . . . . . . . . . . . . . 70
     E.1.  jabber:client  . . . . . . . . . . . . . . . . . .  Differences From RFC 3921 . . . . 70
     E.2.  jabber:server . . . . . . . . . . 78
   Appendix F.  Copying Conditions  . . . . . . . . . . . . 74
     E.3.  jabber:iq:roster . . . . . 78
   Index  . . . . . . . . . . . . . . . . 78
   Appendix F.  Differences From RFC 3921 . . . . . . . . . . . . . . 79
   Author's Address . . . . . . . . . . . . . . . . . . . . . . . . . 80
   Intellectual Property and Copyright Statements . . . . . . . . . . 81



































Saint-Andre             Expires October 19, 2007 January 18, 2008                [Page 3]

Internet-Draft                   XMPP IM                      April                       July 2007


1.  Introduction

1.1.  Overview

   The Extensible Messaging and Presence Protocol (XMPP) is a protocol technology
   for streaming Extensible Markup Language [XML] elements in order to
   exchange messages, presence (availability) information, and other structured data in
   close to real time.  The core features of XMPP are defined in
   [XMPP-CORE].  These features -- mainly XML streams, use of
   TLS Transport
   Layer Security ([TLS]) and SASL, Simple Authentication and Security Layer
   ([SASL]), and the <message/>, <presence/>, and <iq/> children of the
   stream root -- provide the building blocks for many types of
   near-real-time near-
   real-time applications, which may be layered on top of the core by
   sending application-specific data qualified by particular XML
   namespaces (see [XML-NAMES]).  This document describes extensions to
   the core features of XMPP that provide the basic functionality
   expected of an instant messaging (IM) and presence application as
   defined in [IMP-REQS].

   This document obsoletes RFC 3921.

1.2.  Requirements

   Traditionally, instant messaging applications have combined the
   following factors:

   1.  The central point of focus is a list of one's contacts or
       "buddies" (in XMPP this list is called a ROSTER).
   2.  The purpose of using such an application is to exchange
       relatively brief text messages with each of one's contacts in
       close to real time -- often relatively large numbers of such
       messages in rapid succession, in the form of one-to-one "chat
       sessions".
   3.  The catalyst for exchanging messages is PRESENCE -- i.e.,
       knowledge about the network availability of each of one's
       contacts (thus knowing who is online and available for a chat
       session).
   4.  Presence information is provided only to contacts that a user has
       authorized via a presence subscription.

   Thus at a high level this document assumes that a user must be able
   to complete the following use cases:

   o  Manage items in a contact list
   o  Exchange messages with one's contacts
   o  Exchange presence information with one's contacts





Saint-Andre             Expires January 18, 2008                [Page 4]

Internet-Draft                   XMPP IM                       July 2007


   o  Manage presence subscriptions to and from one's contacts

   Detailed definitions of these functionality areas are contained in



Saint-Andre             Expires October 19, 2007                [Page 4]

Internet-Draft                   XMPP IM                      April 2007
   [IMP-REQS], and the interested reader should refer to that document
   regarding the requirements addressed herein.  While the XMPP instant
   messaging and presence extensions specified herein meet the
   requirements of [IMP-REQS], they were not designed explicitly with
   that specification in mind, since the base protocol evolved through
   an open development process within the Jabber open-source community
   before RFC 2779 was written.  Note also that although  Although XMPP protocol extensions
   addressing many other functionality areas have been defined in the Jabber Software
   XMPP Standards Foundation's XEP series, series (e.g., multi-user text chat as
   specified in [XEP-0045]), such extensions are not included in this
   document because they are not required by [IMP-REQS].

   Note: [IMP-REQS] stipulates that presence services must be separable
   from instant messaging services and vice-versa; i.e., it must be
   possible to use the protocol to provide a presence service, an
   instant messaging service, or both.  Although the text of this
   document assumes that implementations and deployments will want to
   offer a unified instant messaging and presence service, there is no
   requirement that a service must offer both a presence service and an
   instant messaging service, and the protocol makes it possible to
   offer separate and distinct services for presence and for instant
   messaging.  (For example, a presence-only service could return
   <service-unavailable/> errors in response to attempts if clients attempt to route send <message/>
   stanzas.)

1.3.  Typical Session Flow

   [XMPP-CORE] specifies how an XMPP client connects to an XMPP server.
   In particular, it specifies the preconditions (including XML stream
   establishment, authentication, and binding of a resource to the
   stream) that must be fulfilled before a client is allowed to send XML
   stanzas (the basic unit of meaning in XMPP) to other entities on an
   XMPP network.  The reader is referred to [XMPP-CORE] for details, and
   knowledge of [XMPP-CORE] is assumed herein.

   Upon fulfillment of the preconditions specified in [XMPP-CORE], an
   XMPP client has a session long-lived XML stream with an XMPP server and may server, which
   enables the user to send and receive a potentially unlimited number
   of XML stanzas over the
   underlying XML stream.  Such a stream can be used as the
   basis for the exchange of instant messaging, presence, and other
   information in close to real time.  The typical flow for an instant
   messaging and presence session is as follows:






Saint-Andre             Expires January 18, 2008                [Page 5]

Internet-Draft                   XMPP IM                       July 2007


   1.  Negotiate an XML stream with one's server.  (See [XMPP-CORE].)
   2.  Retrieve one's roster.  (See Section 2.3.)
   2. 2.2.)
   3.  Send initial presence to the server for broadcasting to all
       subscribed contacts, thus "going online" from the perspective of
       XMPP communications.  (See Section 4.2.)
   3.
   4.  Exchange messages, manage presence subscriptions, perform roster
       updates, and in general process and generate other XML stanzas
       with particular semantics throughout the life of the session.



Saint-Andre             Expires October 19, 2007                [Page 5]

Internet-Draft                   XMPP IM                      April 2007


   4.  Terminate the session
       (See Section 5 and Section 6.)
   5.  Terminate the session when desired by sending unavailable
       presence and closing the underlying XML stream.  (See
       Section 4.5.)

1.4.  Terminology  Conventions

   This document inherits the terminology defined in [XMPP-CORE].

   The following keywords are to be interpreted as described in [TERMS]:
   "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD",
   "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".

   For convenience, this document employs the term "user" to refer to
   the owner of an XMPP account; however, account owners need not be
   human persons and may be bots, devices, or other non-human
   applications.

   In examples, lines have been wrapped for improved readability,
   "[...]" means elision, and the following prepended strings are used:

   o  C: = client
   o  CC: = contact's client
   o  CS: = contact's server
   o  S: = server
   o  UC: = user's client
   o  US: = user's server


2.  Managing the Roster

   In XMPP, one's roster contains any number of specific contacts.  A
   user's roster is stored by the user's server on the user's behalf so
   that the user may access roster information from any resource.

   Note: There are important interactions between rosters and
   subscriptions; these are defined under Integration of Managing the
   Roster and Presence Subscriptions (Appendix A), and the reader must
   refer to that section for a complete understanding of roster
   management (however, such an understanding is necessary only for
   developers of XMPP servers, since most of the complexity is shielded
   from clients).

2.1.  Syntax and Semantics

   Rosters are managed using IQ stanzas, specifically by means of a
   <query/> child element qualified by the 'jabber:iq:roster' namespace.
   The detailed syntax and semantics are defined in the following



Saint-Andre             Expires January 18, 2008                [Page 6]

Internet-Draft                   XMPP IM                       July 2007


   sections.

2.1.1.  Items

   The <query/> element MAY contain one or more <item/> children, each
   describing a unique roster item or "contact".

   The "key" or syntax of the <item/> is as follows:

   1.  The 'jid' attribute is REQUIRED; the value of this attribute is a
       unique identifier or "key" for each roster item is a Jabber
       Identifier or JID, encapsulated in the 'jid' attribute of the <item/>
   element (which is REQUIRED).

   Note: JID.  (Note: When the item added represents another
       IM user, the value of the 'jid' attribute MUST be of the form a bare JID
       <contact@domain> rather
   <contact@domain/resource>.

   The state of the presence subscription in relation to a roster item full JID <contact@domain/resource>,
       since the desired result is captured for the user to receive presence from
       all of the contact's resources, not merely the particular
       resource specified in the 'subscription' 'to' attribute.)
   2.  The 'name' attribute of is OPTIONAL; the <item/> element.
   Allowable values for value of this attribute are:






Saint-Andre             Expires October 19, 2007                [Page 6]

Internet-Draft                   XMPP IM                      April 2007


   o  "none" --
       specifies the user does not have a subscription "handle" to be associated with the contact's
      presence information, and JID, as
       determined by the contact does not have a subscription
      to user (not the user's presence information
   o  "to" -- contact).  The value of the user has a subscription
       'name' attribute is opaque to the contact's presence
      information, server but the contact does not may have a subscription meaning to the
      user's presence information
   o  "from" -- the contact has
       a subscription human user.
   3.  The 'subscription' attribute is OPTIONAL; see Section 2.1.3.
   4.  The 'ask' attribute is OPTIONAL and is used to the user's presence
      information, but the user does not have a specify certain
       subscription to the
      contact's presence information
   o  "both" -- both the user and sub-states; for details, see Section 3.1.2.
   5.  The <group/> element is OPTIONAL; the contact have subscriptions to each
      other's presence information (also called a "mutual subscription")

   Each <item/> XML character of this
       element MAY possess specifies a 'name' attribute, category into which sets the
   "handle" to roster item should be associated with the JID, as determined
       grouped by the user
   (not the contact). a client.  The value of the 'name' attribute is opaque.

   Each <item/> element MAY contain one or more than one <group/> child elements,
   for use in collecting roster items into various categories.
       element.  The XML character data of the <group/> element is opaque.

2.2.  Business Rules

   A server MUST ignore any 'to' address on a roster "set", and MUST
   treat any roster "set" as applying has no
       meaning to the sender.  For added safety, server but may have meaning to a human user.

2.1.2.  Actions

2.1.2.1.  Roster Get

   A ROSTER GET is an IQ stanza of type "get" sent from client SHOULD check to server
   and containing a <query/> element qualified by the "from" address of 'jabber:iq:roster'
   namespace.

   The <query/> element in a roster get MUST NOT contain any <item/>
   child elements.

2.1.2.2.  Roster Set

   A ROSTER PUSH (i.e., SET is an
   incoming IQ stanza of type "set" sent from client to server
   and containing a roster item) to ensure that it
   is from a trusted source; specifically, <query/> element qualified by the 'jabber:iq:roster'
   namespace.




Saint-Andre             Expires January 18, 2008                [Page 7]

Internet-Draft                   XMPP IM                       July 2007


   The following rules apply to roster sets:

   1.  The <query/> element MUST contain one and only one <item/>
       element.
   2.  A receiving server MUST ignore any value of the 'subscription'
       attribute other than "remove" (see Section 2.1.3).
   3.  A receiving server MUST ignore any 'to' address specified on the
       IQ stanza and MUST either have handle the IQ stanza as if it included no 'to'
       attribute.

2.1.2.3.  Roster Push

   A ROSTER PUSH is an IQ stanza of type "set" sent from server to
   client and containing a <query/> element qualified by the 'jabber:iq:
   roster' namespace.

   The following rules apply to roster pushes:

   1.  The <query/> element in a roster get MUST contain one and only
       one <item/> element.
   2.  A receiving client MUST ignore the stanza unless it has no 'from'
       attribute (i.e., implicitly from the server) or have it has a 'from'
       attribute whose value matches the user's bare JID (of the form
   <user@domain>) or full JID (of the form <user@domain/resource>);
   otherwise, the client SHOULD ignore the "roster push".

2.3.  Retrieving One's <user@domain>.

2.1.2.4.  Roster on Login

   Upon authenticating with a Result

   A ROSTER RESULT is an IQ stanza of type "result" sent from server to
   client and binding a resource (thus
   becoming a CONNECTED RESOURCE), containing a client SHOULD request the roster
   before sending initial presence (however, because receiving <query/> element qualified by the
   roster may not be desirable for all resources, e.g., 'jabber:iq:
   roster' namespace.

   The <query/> element in a connection
   with limited bandwidth, the client's request roster result contains one <item/> element
   for the each roster is
   recommended item and not required).  If an available resource does not
   request therefore MAY contain more than one <item/>
   element.

2.1.3.  Subscription Attribute

   The state of the roster during presence subscription in relation to a session, the server MUST NOT send it
   presence subscriptions and associated roster updates.  For item
   is captured in the sake 'subscription' attribute of brevity, the term INTERESTED RESOURCE is used herein <item/> element.
   Allowable subscription-related values for this attribute are:

   o  "none" -- the user does not have a subscription to refer the contact's
      presence information, and the contact does not have a subscription
      to the concept of "an available resource that user's presence information
   o  "to" -- the user has requested a subscription to the roster". contact's presence
      information, but the contact does not have a subscription to the
      user's presence information





Saint-Andre             Expires October 19, 2007 January 18, 2008                [Page 7] 8]

Internet-Draft                   XMPP IM                      April                       July 2007


   Example: Client requests current roster from server:

   <iq from='juliet@example.com/balcony' type='get' id='roster_1'>
     <query xmlns='jabber:iq:roster'/>
   </iq>

   Example: Client receives roster from server:

   <iq to='juliet@example.com/balcony' type='result' id='roster_1'>
     <query xmlns='jabber:iq:roster'>
       <item jid='romeo@example.net'
             name='Romeo'
             subscription='both'>
         <group>Friends</group>
       </item>
       <item jid='mercutio@example.org'
             name='Mercutio'
             subscription='from'/>
       <item jid='benvolio@example.org'
             name='Benvolio'
             subscription='both'/>
     </query>
   </iq>

2.4.  Adding


   o  "from" -- the contact has a Roster Item

   At any time, subscription to the user's presence
      information, but the user does not have a subscription to the
      contact's presence information
   o  "both" -- both the user MAY add an item and the contact have subscriptions to his or her each
      other's presence information (also called a "mutual subscription")

   In a roster by sending
   an IQ stanza push or result, a receiving client MUST ignore values of type "set" containing
   the 'subscription' attribute other than "none", "to", "from", or
   "both".

   In a <query/> element roster set, the value of the 'subscription' attribute MAY be
   "remove", which indicates that in turn
   contains one <item/> element.

   Example: Client adds the item is to be removed from the
   roster; a new item:

   <iq from='juliet@example.com/balcony' type='set' id='roster_2'>
     <query xmlns='jabber:iq:roster'>
       <item jid='nurse@example.com'
             name='Nurse'>
         <group>Servants</group>
       </item>
     </query>
   </iq>

   Note: The <query/> element receiving server MUST NOT contain more ignore all values of the
   'subscription' attribute other than one <item/>
   child element when "remove".

2.2.  Retrieving the Roster on Login

   Upon authenticating with a server and binding a resource (thus
   becoming a connected resource), a client sends an IQ set to the server.  In
   addition, SHOULD request the <item/> element MAY contain more than one <group/>
   element but roster
   before sending initial presence (however, because receiving the XML character data of each <group/> element MUST
   specify distinct groups (where duplicates are to
   roster may not be determined using desirable for all resources, e.g., a connection
   with limited bandwidth, the Resourceprep profile of stringprep as defined in [XMPP-CORE]).
   If either of these rules is violated, client's request for the server MUST return roster is
   recommended and not required).  After a <bad-



Saint-Andre             Expires October 19, 2007                [Page 8]

Internet-Draft                   XMPP IM                      April 2007


   format/> error connected resource sends
   initial presence (see Section 4.2), it is referred to as an available
   resource.  If a connected resource requests the client.

   Note: A client MUST roster but does not
   send initial presence, the server SHOULD NOT add itself to its own roster; i.e., send it presence
   subscriptions and SHOULD NOT send it associated roster pushes.  If an
   available resource does not request the value
   of roster during a session, the <item/> element's 'jid' attribute
   server SHOULD NOT send it presence subscriptions and MUST NOT match
   associated roster pushes.  For the bare JID
   (node@domain) portion sake of brevity, the <iq/> element's 'from' attribute.  If
   this rule term
   INTERESTED RESOURCE is violated, the server MUST return a <not-allowed/> error used herein to refer to the client. concept of "an
   available resource that has requested the roster".

   A client requests the roster by sending a roster get over its stream
   to the server.

   C: <iq from='juliet@example.com/balcony' type='get' id='roster_1'>
       <query xmlns='jabber:iq:roster'/>
     </iq>












Saint-Andre             Expires January 18, 2008                [Page 9]

Internet-Draft                   XMPP IM                       July 2007


   S: <iq to='juliet@example.com/balcony' type='result' id='roster_1'>
       <query xmlns='jabber:iq:roster'>
         <item jid='romeo@example.net'
               name='Romeo'
               subscription='both'>
           <group>Friends</group>
         </item>
         <item jid='mercutio@example.org'
               name='Mercutio'
               subscription='from'/>
         <item jid='nurse@example.com'
               name='Nurse'
               subscription='to'/>
         <item jid='benvolio@example.org'
               name='Benvolio'
               subscription='both'/>
       </query>
     </iq>

   If the server cannot process the roster get, it MUST return an
   appropriate stanza error as described in [XMPP-CORE] (such as
   <service-unavailable/> if the roster namespace is not supported or
   <internal-server-error/> if the server experiences trouble returning
   the roster).

2.3.  Adding a Roster Item

2.3.1.  Success Case

   At any time, a client may add an item to the roster by sending a
   roster set to the server.

   C: <iq from='juliet@example.com/balcony' type='set' id='roster_2'>
        <query xmlns='jabber:iq:roster'>
          <item jid='nurse@example.com'
                name='Nurse'>
            <group>Servants</group>
          </item>
        </query>
      </iq>

   If the server can successfully process the roster addition, set (i.e., if none
   of the error cases occurs), it MUST
   update create the roster information item in
   persistent storage and send a roster push the
   change out to all of the user's
   interested resources.  This "roster
   push" consists of an IQ stanza of type "set" from the server to the
   client and enables all interested resources to remain in sync with
   the server-based roster information.

   Example: Server (1) pushes containing the updated new roster information to all
   interested resources and (2) replies with an IQ result to the sending
   resource: item.






Saint-Andre             Expires January 18, 2008               [Page 10]

Internet-Draft                   XMPP IM                       July 2007


   S: <iq to='juliet@example.com/balcony'
          type='set'
          id='a78b4q6ha463'>
        <query xmlns='jabber:iq:roster'>
          <item jid='nurse@example.com'
                name='Nurse'
                subscription='none'>
            <group>Servants</group>
          </item>
        </query>
      </iq>

   S: <iq to='juliet@example.com/chamber'
          type='set'
          id='a78b4q6ha464'>
        <query xmlns='jabber:iq:roster'>
          <item jid='nurse@example.com'
                name='Nurse'
                subscription='none'>
            <group>Servants</group>
          </item>
        </query>
      </iq>

   The server MUST also return an IQ stanza of type "result" to the
   connected resource that sent the roster set.

   S: <iq to='juliet@example.com/balcony' type='result' id='roster_2'/>

   As required by the semantics of the IQ stanza kind as defined in
   [XMPP-CORE], each resource that received the roster push MUST reply
   with an IQ stanza of type "result" (or "error").



Saint-Andre             Expires October 19, 2007                [Page 9]

Internet-Draft                   XMPP IM                      April 2007


   Example: Resources reply with an IQ result to the server:

   C: <iq from='juliet@example.com/balcony'
       to='example.com'
         type='result'
         id='a78b4q6ha463'/>
   C: <iq from='juliet@example.com/chamber'
       to='example.com'
         type='result'
         id='a78b4q6ha464'/>

2.5.  Updating a Roster Item

   Updating an existing roster item (e.g., changing the group)

   Note: There is done
   in the same way as adding a new no error case for client replies to roster item, i.e., by sending pushes, and
   if the
   roster item in server receives an IQ set of type "error" in response to the server.

   Example: User updates a roster item (add group):

   <iq from='juliet@example.com/chamber' type='set' id='roster_3'>
     <query xmlns='jabber:iq:roster'>
       <item jid='romeo@example.net'
             name='Romeo'>
         <group>Friends</group>
         <group>Lovers</group>
       </item>
     </query>
   </iq>

   Example: User updates
   push it SHOULD ignore the error.

2.3.2.  Error Cases

   If the server cannot successfully process the roster item (remove group):

   <iq from='juliet@example.com/chamber' type='set' id='roster_4'>
     <query xmlns='jabber:iq:roster'>
       <item jid='romeo@example.net'
             name='Romeo'>
         <group>Lovers</group>
       </item>
     </query>
   </iq> set, it MUST
   return an error.  The following error cases are defined (naturally,



Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 10] 11]

Internet-Draft                   XMPP IM                      April                       July 2007


   Example: User updates roster item (change handle):

   <iq from='juliet@example.com/chamber' type='set' id='roster_5'>
     <query xmlns='jabber:iq:roster'>
       <item jid='romeo@example.net'
             name='MyRomeo'>
         <group>Lovers</group>
       </item>
     </query>
   </iq>

   Example: User updates roster item (remove handle):

   <iq from='juliet@example.com/chamber' type='set' id='roster_6'>
     <query xmlns='jabber:iq:roster'>
       <item jid='romeo@example.net'
             name=''>
         <group>Lovers</group>
       </item>
     </query>
   </iq>

   As with adding a roster item, when updating a roster item the


   other stanza errors may occur, e.g., <internal-server-error/>).

   The server
   MUST update the roster information in persistent storage, initiate SHOULD return a
   roster push <bad-request/> error to all of the user's interested resources, and send an IQ
   result to client if the initiating resource.

2.6.  Deleting a Roster Item

   At any time, a user MAY delete an item from his or her
   roster by
   sending an IQ set to violates any of the server and setting following conditions:

   1.  The <query/> element contains more than one <item/> child
       element.
   2.  The <item/> element contains more than one <group/> element, but
       there are duplicates among the value XML character data of each
       <group/> element (where duplicates are determined using the
   'subscription' attribute to "remove" (a compliant server MUST ignore
   any other values
       Resourceprep profile of the 'subscription' attribute when received from a
   client).

   Example: Client removes an item:

   <iq from='juliet@example.com/balcony' type='set' id='roster_7'>
     <query xmlns='jabber:iq:roster'>
       <item jid='nurse@example.com' subscription='remove'/>
     </query>
   </iq>

   As with adding a roster item, when deleting stringprep as defined in [XMPP-CORE]).

   The server SHOULD return a roster item <not-allowed/> error to the server
   MUST update client if the
   roster information in persistent storage, initiate a
   roster push to all set violates any of the user's interested resources (with following conditions:

   1.  The value of the
   'subscription' 'name' attribute set to is greater than a value server-
       configured limit.
   2.  The XML character data of "remove"), and send an IQ
   result to the initiating resource.



Saint-Andre             Expires October 19, 2007               [Page 11]

Internet-Draft                   XMPP IM                      April 2007


   This command will result in cancellation <group/> element is of existing presence
   subscriptions; for details, see Removing a Roster Item and Cancelling
   All Subscriptions (Appendix A.6). zero length.
   3.  Managing Presence Subscriptions

   In order to protect the privacy  The XML character data of instant messaging users and any
   other entities, presence and availability information is disclosed
   only to other entities that the user has approved.  When a user has
   agreed that another entity may view its presence, the entity <group/> element is said
   to have greater than a subscription to
       server-configured limit.

   Alternatively, the user's presence information.  A
   subscription lasts across sessions; indeed, it lasts until server MAY ignore the
   subscriber unsubscribes or foregoing violations and
   process the subscribee cancels roster set as best as possible (e.g., process only the previously-
   granted subscription.

   Subscriptions are managed within XMPP by sending presence stanzas
   containing specially-defined attributes.  In particular,
   first <item/> element, ignore duplicate <group/> elements, place the
   roster item in no group or a
   SUBSCRIPTION REQUEST default group if the <group/> element is a presence stanza whose 'type' attribute has
   a value of "subscribe".  If the subscription request is being sent to
   an instant messaging contact, the JID supplied in the 'to' attribute
   SHOULD be of the form <contact@domain> rather than
   <contact@domain/resource>, since the desired result is normally for
   the user to receive presence from all of the contact's resources, not
   merely the particular resource specified in the 'to' attribute.

   Note: There are important interactions between subscriptions and
   rosters; these are defined under Integration of Managing the Roster
   empty, and Presence Subscriptions (Appendix A), truncate 'name' attributes and the reader must refer to <group/> elements that section for a complete understanding of presence subscriptions.

3.1.  Requesting a Subscription

   A request to subscribe to another entity's presence is made by
   sending a presence stanza of type "subscribe".

   Example: Sending a subscription request:

   <presence from='romeo@example.net'
             to='juliet@example.com'
             type='subscribe'/>

   If the user does not exist, the user's server SHOULD automatically
   return a presence stanza of type "unsubscribed" to the requesting
   entity. are
   too long).

   Error: Roster set contains more than one item

   C: <iq from='juliet@example.com/balcony' type='set' id='roster_3'>
        <query xmlns='jabber:iq:roster'>
          <item jid='nurse@example.com'
                name='Nurse'>
            <group>Servants</group>
          </item>
          <item jid='mother@example.com'
                name='Mom'>
            <group>Family</group>
          </item>
        </query>
      </iq>

   S: <iq to='juliet@example.com/balcony' type='error' id='roster_3'>
       <error type='modify'>
         <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
       </error>
     </iq>



Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 12]

Internet-Draft                   XMPP IM                      April                       July 2007


   Example: User does not exist

   <presence from='juliet@example.com'
             to='romeo@example.net'
             type='unsubscribed'/>

   A user's server MUST NOT automatically approve subscription requests
   on the user's behalf.  All subscription requests MUST be delivered to
   the user's client, specifically to one or more of the user's
   interested resources.  If the user has no interested resources when
   the subscription request is received by the user's server, the user's
   server MUST keep a record of the complete subscription request
   (including any extended namespacescontained therein) and deliver the
   request when the user next has an interested resource, until the user
   either approves or denies the request.  If there is more than one
   interested resource associated


   Error: Roster set contains item with the user when the subscription
   request is received by the user's server, the user's oversized handle

   C: <iq from='juliet@example.com/balcony' type='set' id='roster_4'>
        <query xmlns='jabber:iq:roster'>
          <item jid='nurse@example.com'
                name='__some-very-long-handle__'>
            <group>Servants</group>
          </item>
        </query>
      </iq>

   S: <iq to='juliet@example.com/balcony' type='error' id='roster_4'>
        <error type='modify'>
          <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>

   Error: Roster set contains duplicate groups

   C: <iq from='juliet@example.com/balcony' type='set' id='roster_5'>
        <query xmlns='jabber:iq:roster'>
          <item jid='nurse@example.com'
                name='Nurse'>
            <group>Servants</group>
            <group>Servants</group>
          </item>
        </query>
      </iq>

   S: <iq to='juliet@example.com/balcony' type='error' id='roster_5'>
        <error type='modify'>
          <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>

















Saint-Andre             Expires January 18, 2008               [Page 13]

Internet-Draft                   XMPP IM                       July 2007


   Error: Roster set contains empty group

   C: <iq from='juliet@example.com/balcony' type='set' id='roster_6'>
        <query xmlns='jabber:iq:roster'>
          <item jid='nurse@example.com'
                name='Nurse'>
            <group></group>
          </item>
        </query>
      </iq>

   S: <iq to='juliet@example.com/balcony' type='error' id='roster_6'>
        <error type='modify'>
          <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>

   Error: Roster set contains oversized group

   C: <iq from='juliet@example.com/balcony' type='set' id='roster_7'>
        <query xmlns='jabber:iq:roster'>
          <item jid='nurse@example.com'
                name='Nurse'>
            <group>__some-very-long-group-name__</group>
          </item>
        </query>
      </iq>

   S: <iq to='juliet@example.com/balcony' type='error' id='roster_7'>
        <error type='modify'>
          <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
        </error>
      </iq>

   The server MUST
   broadcast that subscription request to all interested resources in
   accordance with Server Rules for Handling XML Stanzas (Section 8).
   However, if the user receives a presence stanza of type "subscribe"
   from return a contact to whom the user has already granted permission <not-allowed/> error to see
   the user's presence information (e.g., in cases when the contact is
   seeking to resynchronize subscription states), client if the user's server
   SHOULD auto-reply on behalf
   value of the user.  In addition, <item/> element's 'jid' attribute matches the user's
   server MAY choose to re-send an unapproved pending subscription
   request to bare JID
   <node@domain> portion of the contact based on an implementation-specific algorithm
   (e.g., whenever a new resource becomes available for the user, or
   after <iq/> element's 'from' attribute.














Saint-Andre             Expires January 18, 2008               [Page 14]

Internet-Draft                   XMPP IM                       July 2007


   Error: Roster set contains sender's JID

   C: <iq from='juliet@example.com/balcony' type='set' id='roster_8'>
        <query xmlns='jabber:iq:roster'>
          <item jid='juliet@example.com'/>
         </query>
       </iq>

   S: <iq to='juliet@example.com/balcony' type='error' id='roster_8'>
         <error type='cancel'>
           <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
         </error>
       </iq>

2.4.  Updating a certain amount of time has elapsed); this helps to recover
   from transient, silent errors that may have occurred Roster Item

2.4.1.  Success Case

   Updating an existing roster item is done in relation to the original subscription request.

   Note: When same way as adding a contact generates
   new roster item, i.e., by sending a subscription request roster set to a user, the
   contact's server MUST stamp the outgoing presence stanza with the
   bare JID (<contact@domain>) of server.
   Because a roster item is atomic, the contact, not item shall be updated exactly as
   provided in the full JID
   (<contact@domain/resource>).  The same is true for presence stanzas
   of type "subscribed", "unsubscribe", and "unsubscribed".

   Note: If roster set.

   There are several reasons why a user sends client might update a presence subscription request to roster item:

   1.  Adding a contact
   but has not already added the contact to group
   2.  Deleting a group
   3.  Changing the user's roster, handle
   4.  Deleting the
   user's server MUST send handle

   Consider a roster push to all of the user's interested
   resources.  Thus a client MAY simply wait for the item that is defined as follows:

       <item jid='romeo@example.net'
             name='Romeo'>
         <group>Friends</group>
       </item>

   The user who has this item in her roster push rather
   than proactively adding may want to add the contact item to the user's roster.

3.2.  Handling a Subscription Request

   When a client receives a subscription request from
   another entity, it
   SHOULD either approve the request by sending a presence stanza of
   type "subscribed" or refuse the request by sending a presence stanza group.

   C: <iq from='juliet@example.com/chamber' type='set' id='update_1'>
        <query xmlns='jabber:iq:roster'>
          <item jid='romeo@example.net'
                name='Romeo'>
            <group>Friends</group>
            <group>Lovers</group>
          </item>
        </query>



Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 13] 15]

Internet-Draft                   XMPP IM                      April                       July 2007


   of type "unsubscribed".

   Example: Approving a subscription request:

   <presence from='juliet@example.com'
             to='romeo@example.net'
             type='subscribed'/>

   Example: Refusing a presence subscription request:

   <presence from='juliet@example.com'
             to='romeo@example.net'
             type='unsubscribed'/>

3.3.  Cancelling a Subscription from Another Entity

   If a


      </iq>

   The user would like may then want to cancel a previously-granted subscription
   request, it sends a presence stanza of type "unsubscribed".

   Example: Cancelling a previously granted subscription request:

   <presence from='juliet@example.com'
             to='romeo@example.net'
             type='unsubscribed'/>

3.4.  Unsubscribing remove the item from Another Entity's Presence

   If a the original group.

   C: <iq from='juliet@example.com/chamber' type='set' id='update_2'>
        <query xmlns='jabber:iq:roster'>
          <item jid='romeo@example.net'
                name='Romeo'>
            <group>Lovers</group>
          </item>
        </query>
      </iq>

   The user would like may then want to unsubscribe from change the presence of another
   entity, it sends a presence stanza of type "unsubscribe".

   Example: Unsubscribing from an entity's presence:

   <presence from='romeo@example.net'
             to='juliet@example.com'
             type='unsubscribe'/>


4.  Exchanging Presence Information

4.1.  Overview handle for the item.

   C: <iq from='juliet@example.com/chamber' type='set' id='update_3'>
        <query xmlns='jabber:iq:roster'>
          <item jid='romeo@example.net'
                name='MyRomeo'>
            <group>Lovers</group>
          </item>
        </query>
      </iq>

   The concept of presence refers user may then want to an entity's availability for
   communication over a network.  At remove the most basic level, presence is a
   boolean "on/off" variable that signals whether handle altogether (note:
   including an entity empty 'name' attribute is available
   or unavailable for communication; equivalent to including no
   'name' attribute).

   C: <iq from='juliet@example.com/chamber' type='set' id='update_4'>
        <query xmlns='jabber:iq:roster'>
          <item jid='romeo@example.net'
                name=''>
            <group>Lovers</group>
          </item>
        </query>
      </iq>

   The user may then want to remove the terms "online" and "offline"
   are also used.  In XMPP, item from all groups.

   C: <iq from='juliet@example.com/chamber' type='set' id='update_5'>
        <query xmlns='jabber:iq:roster'>
          <item jid='romeo@example.net'/>
        </query>
      </iq>

   As with adding a principal's availability is signalled roster item, when updating a client controlled by roster item the principal generates server
   MUST update the roster information in persistent storage, send a <presence/> stanza
   with no 'type' attribute,
   roster push to all of the user's interested resources, and send an entity's lack of availability is IQ



Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 14] 16]

Internet-Draft                   XMPP IM                      April                       July 2007


   signalled when


   result to the initiating resource; for details, see Section 2.3.

2.4.2.  Error Cases

   The error cases described under Section 2.3 also apply to updating a client or entity generates
   roster item.

2.5.  Deleting a <presence/> stanza
   whose 'type' attribute has Roster Item

2.5.1.  Success Case

   At any time, a value of "unavailable".  In XMPP-based
   applications that combine messaging client may delete an item from his or her roster by
   sending roster set and presence functionality, setting the
   default type value of communication for which presence signals availability
   is messaging; however, XMPP-based applications are not required to
   combine messaging and presence functionality, and can provide
   standalone presence features without messaging (in addition, XMPP
   servers do not require presence information in order the 'subscription'
   attribute to successfully
   route message and IQ stanzas).

   XMPP presence typically follows "remove".

   C: <iq from='juliet@example.com/balcony' type='set' id='delete_1'>
        <query xmlns='jabber:iq:roster'>
          <item jid='nurse@example.com' subscription='remove'/>
        </query>
      </iq>

   As with adding a "publish-subscribe" or "observer"
   pattern, wherein an entity sends presence information to its server,
   and its roster item, if the server can successfully process
   the roster set then broadcasts or multiplexes that it MUST update the roster information in
   persistent storage, send a roster push to all of the entity's contacts who have user's
   interested resources (with the 'subscription' attribute set to a subscription
   value of "remove"), and send an IQ result to the entity's initiating resource;
   for details, see Section 2.3.

   The server MUST also generate a presence (in the terminology stanza of [IMP-MODEL], an entity that generates
   presence information is a "presentity" type "unsubscribe"
   and the entities that receive
   presence information are "subscribers").  A client generates presence
   for broadcasting to all subscribed entities by sending a presence stanza of type "unsubscribed" from the user to its server with no 'to' address, where the presence stanza
   has either no 'type' attribute or a 'type' attribute whose
   contact.

   S: <presence from='juliet@example.com'
                to='nurse@example.com'
                type='unsubscribe'/>

   S: <presence from='juliet@example.com'
                to='nurse@example.com'
                type='unsubscribed'/>

2.5.2.  Error Cases

   If the value of the 'jid' attribute specifies an item that is
   "unavailable".  A user's not in
   the roster, the server MUST NOT leak the user's network
   availability to entities who are return an <item-not-found/> error.







Saint-Andre             Expires January 18, 2008               [Page 17]

Internet-Draft                   XMPP IM                       July 2007


   Error: Roster item not authorized found

 C: <iq from='juliet@example.com/balcony' type='set' id='delete_2'>
      <query xmlns='jabber:iq:roster'>
        <item jid='__no-such-user__@example.com' subscription='remove'/>
      </query>
    </iq>

 S: <iq to='juliet@example.com/balcony' type='error' id='delete_2'>
      <error type='modify'>
        <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
      </error>
    </iq>


3.  Managing Presence Subscriptions

   In order to know protect the user's
   presence, either via an explicit subscription as described herein or
   via an existing trust relationship (such as presence-enabled user
   directories within organizations).  However, a client MAY also send
   directed privacy of instant messaging users, presence (Section 4.6)
   information is disclosed only to other entities that are not subscribed
   to the principal's presence (this does not constitute user has
   approved.  When a presence
   leak, since it is initiated by user has agreed that another entity may view its
   presence, the client); this entity is done by
   specifying said to have a 'to' address on SUBSCRIPTION to the relevant presence stanza.  (Note:
   While user's
   presence information MAY be provided on information.  An entity that has a subscription to a user's behalf by an
   automated service, normally it
   presence (or to which a user has a presence subscription) is provided by the user's client.)

   After called a client completes the preconditions specified in [XMPP-CORE],
   CONTACT.  A subscription lasts across sessions; indeed, it can establish a "presence session" at its server by sending
   "initial presence" as described under Section 4.2, that is by sending
   a presence stanza with to 'type' lasts
   until the contact unsubscribes or 'to' attribute.

   The XMPP presence stanza is also used to negotiate and manage
   subscriptions to the presence of other entities.  These tasks user cancels the previously-
   granted subscription.

   Subscriptions are
   completed via managed within XMPP by sending presence stanzas of type "subscribe",
   containing specially-defined attributes ("subscribe", "unsubscribe",
   "subscribed", and "unsubscribed" as described under Section 3.

   If "unsubscribed").

   Note: When a user and or contact are associated with different XMPP servers,
   those servers also use generates a special presence stanza of type "probe" in
   order to determine
   "subscribe", "subscribed", "unsubscribe", and "unsubscribed" or a
   server processes or generates such a stanza on behalf of a user or
   contact, the availability server MUST stamp the outgoing presence stanza with the
   bare JID <node@domain> of the entity on user or contact, not the peer server.
   Clients SHOULD NOT send full JID
   <node@domain/resource>.  This rule helps to prevent presence stanzas leaks;
   for details, see the security considerations of type "probe".

   Naturally, [XMPP-CORE].)

3.1.  Requesting a Subscription

   A SUBSCRIPTION REQUEST is a presence stanza may also be whose 'type' attribute
   has a value of type "error". "subscribe".  A subscription request is generated by a
   user's client, processed by the (potential) contact's server, and
   acted on by the contact via the contact's client.  The workflow is
   described in the following sections.





Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 15] 18]

Internet-Draft                   XMPP IM                      April                       July 2007


   The values


3.1.1.  Client Generation of the 'type' attribute are summarized in the following
   list (the reader is reminded that Outbound Subscription Request

   A user's client generates a subscription request by sending a
   presence stanza with no 'type'
   attribute signals that of type "subscribe" and specifying a 'to' address of
   the relevant entity is available potential contact's bare JID <contact@domain>.

   UC: <presence to='juliet@example.com' type='subscribe'/>

   Typically the user's client prompts the user for
   communication):

   o  unavailable -- Signals information about
   the potential contact ("handle" and desired roster group) and
   generates a roster set with that information before sending the entity
   subscription request, but that behavior is no longer available for
      communication.
   o  subscribe -- The sender wishes to subscribe to recommended rather than
   required.

3.1.2.  Server Processing of Outbound Subscription Request

   As mentioned, the recipient's
      presence.
   o  subscribed -- The sender has allowed user's server MUST stamp the recipient to receive
      their presence.
   o  unsubscribe -- The sender is unsubscribing from another entity's
      presence.
   o  unsubscribed -- The subscription request has been denied or a
      previously-granted outbound subscription has been cancelled.
   o  probe -- A
   request for an entity's current presence; SHOULD be
      generated only by a server on behalf with the bare JID <user@domain> of a the user.
   o  error -- An error has occurred regarding processing or delivery of
      a previously-sent presence stanza.

4.2.  Initial Presence

   After completing

   US: <presence from='romeo@example.net'
                 to='juliet@example.com'
                 type='subscribe'/>

   If the preconditions described in [XMPP-CORE]
   (REQUIRED) and requesting potential contact is hosted on the same server, the roster (RECOMMENDED), a client SHOULD
   send INITIAL PRESENCE to its server in order
   MUST adhere to signal its
   availability for communications.  As defined herein, the initial
   presence stanza (1) MUST possess no 'to' address (signalling that rules specified in the next section in processing
   the subscription request and delivering it
   is meant to be broadcasted by the server (local) contact.

   If the potential contact is hosted on behalf of the client) and
   (2) MUST possess no 'type' attribute (signalling a different server, the user's
   availability).  After sending initial presence, a connected resource
   (in
   server then routes the terminology of [XMPP-CORE]) is said stanza to be an AVAILABLE
   RESOURCE.

   Upon receiving initial presence from a client, the that foreign domain in accordance
   with core XMPP stanza processing rules.

   The user's server MUST
   do the following if there is not already one or more available
   resources for the user (if there is already one or more available
   resources for the user, the server obviously does not need to then send
   the presence probes, since it already possesses the requisite
   information):

   1.  Send a PRESENCE PROBE (i.e., presence stanza whose 'type'
       attribute is set roster push to a value all of "probe") from the full JID (e.g.,
       <juliet@example.com/balcony>) of user's
   interested resources, containing the user to each potential contact to
       which the user is subscribed in order to determine if they are
       available; such contacts are those for which with a JID is present in
       the user's roster
   subscription state of "none" and with notation that the 'subscription' subscription
   is pending (via an 'ask' attribute set to a whose value of "to" or "both". is "subscribe").
















Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 16] 19]

Internet-Draft                   XMPP IM                      April                       July 2007


   2.  Broadcast initial presence from the full JID (e.g.,
       <juliet@example.com/balcony>) of the user to all contacts that
       are subscribed to


   US: <iq to='romeo@example.net/foo'
           type='set'
           id='b89c5r7ib574'>
         <query xmlns='jabber:iq:roster'>
           <item jid='juliet@example.com'
                 subscription='none'
                 ask='subscribe'/>
         </query>
       </iq>

   US: <iq to='romeo@example.net/bar'
           type='set'
           id='b89c5r7ib575'>
         <query xmlns='jabber:iq:roster'>
           <item jid='juliet@example.com'
                 subscription='none'
                 ask='subscribe'/>
           </item>
         </query>
       </iq>

   Note: Because the user's presence information; such contacts
       are those for which server must send this roster push, a JID is present in client MAY
   simply wait for the user's roster with push rather than proactively adding the 'subscription' attribute set
   contact to a value of "from" or "both".

   In addition, the user's server MUST broadcast initial presence from
   the user's newly available resource to the user's existing available
   resources (if any).

   Upon receiving initial presence from the user, if the contact address
   does not exist or the user is not in the contact's roster with a before sending the subscription state request.

3.1.3.  Server Processing of "to" or "both", then the Inbound Subscription Request

   The contact's server MUST
   return a presence stanza of type "unsubscribe" adhere to the user.
   Otherwise, if following rules when
   processing the user is in inbound subscription request:

   1.  Above all, the contact's roster with server MUST NOT automatically approve
       subscription requests on the contact's behalf; instead, if a
       subscription
   state of "to" or "both", request requires approval then the contact's server
       MUST deliver the
   user's presence stanza that request to the full JIDs (e.g.,
   <romeo@example.net/orchard>) associated with all of the contact's
   available resources. interested resource(s)
       for approval or denial by the contact.
   2.  If the user's contact does not exist, the contact's server receives MUST
       automatically return a presence stanza of type "error" in
   response "unsubscribed" to
       the initial presence that it sent to a contact on behalf
   of user.

   CS: <presence from='juliet@example.com'
                 to='romeo@example.net'
                 type='unsubscribed'/>

   3.  If the user, it SHOULD NOT send further presence updates to that contact (until exists and unless it receives a presence stanza from the
   contact).

4.3.  Presence Probes

   Upon receiving user already has a presence probe from subscription to
       the user's presence, the contact's server SHOULD auto-reply on
       behalf of the user, user by sending a presence stanza of type
       "subscribed" from the contact's server SHOULD reply as follows:

   1. bare JID to the user's bare JID.




Saint-Andre             Expires January 18, 2008               [Page 20]

Internet-Draft                   XMPP IM                       July 2007


   4.  If the contact account does not exist or exists, the user is in the
       contact's roster with does not already have a
       subscription state other than "From",
       "From + Pending Out", or "Both" (as defined under Subscription
       States (Appendix B)), to the contact's server MUST return a presence
       stanza of type "unsubscribed" in response to presence, and there is at least one
       interested resource associated with the presence probe
       (however, if a contact when the
       subscription request is received by the contact's server, the
       contact's server receives a presence probe from a subdomain
       of MUST broadcast that subscription request to all
       interested resources in accordance with Server Rules for
       Processing XML Stanzas (Section 8).
   5.  If the server's hostname or another such trusted service, it MAY
       provide presence information about contact exists, the user does not already have a
       subscription to that entity).
   2.  Else, if the contact's presence, and the contact has no available resources, the server MUST
       either (1) reply to
       interested resources when the presence probe subscription request is received by sending to
       the user contact's server, the
       full XML contact's server MUST keep a record of
       the last complete presence stanza of type "unavailable"
       received by comprising the server from subscription request,
       including any extended content contained therein, and deliver the contact, or (2) not reply at all.
   3.  Else, if
       request when the contact next has at least one available an interested resource, until
       the contact either approves or denies the request.  (Note: The
       contact's server MUST reply to NOT deliver more than one subscription
       request from any given user when the presence probe by sending to contact next has an
       interested resource; e.g., if the user sends multiple
       subscription requests to the full XML of contact while the last presence stanza with no 'to' attribute
       received by contact is
       offline, the contact's server from each SHOULD store only one of those
       requests, such as the contact's available
       resources.



Saint-Andre             Expires October 19, 2007               [Page 17]

Internet-Draft                   XMPP IM                      April 2007


4.4.  Subsequent Presence Broadcast

   After sending initial presence, the user MAY update its availability
   for broadcasting at any time during its session by sending a presence
   stanza with no 'to' address and no 'type' attribute.  (Note: A user's
   client SHOULD NOT send a presence update to broadcast information
   that changes independently of the user's presence first request or last request, and availability.)

   Upon receiving such a presence stanza expressing updated
   availability, the user's server MUST broadcast the full XML
       deliver only one of that
   presence stanza to all contacts (1) that are in the user's roster
   with a subscription type of "from" or "both" and (2) from whom requests when the
   server contact next has not received unavailable presence, presence of type
   "unsubscribe", or a presence error during the user's session, as well
   as an
       interested resource; this helps to prevent "subscription request
       spam".)

   Note: If the user's other available resources.  (Note: Regarding rule 2
   above, if contact does not approve or deny the subscription state is "both" then
   request within some configurable amount of time, the user's server
   MAY
   broadcast subsequent presence only if choose to re-send the server has received
   available presence from subscription request to the contact at some point during the user's
   session; i.e., if the server never received based
   on an implementation-specific algorithm (e.g., whenever a new
   resource becomes available presence for the user, or after a certain amount of
   time has elapsed); this helps to recover from transient, silent
   errors that may have occurred in relation to the contact and original
   subscription request.

3.1.4.  Client Processing of Inbound Subscription Request

   When the user has contact's client receives a mutual presence subscription with request from the
   contact,
   user, it MAY decline to send subsequent presence to MUST present the contact.)

   Upon receiving subsequent presence from request to the user, if contact for approval (unless
   the contact
   address does not exist or the user is not in has explicitly configured the contact's roster
   with a subscription state of "to" client to automatically
   approve or "both", then the contact's
   server MUST return deny some or all subscription requests).

   A subscription request is approved by sending a presence stanza of
   type "unsubscribe" to the
   user.  Otherwise, if the user "subscribed".

   CC: <presence to='romeo@example.net' type='subscribed'/>

   Note: Server processing of presence stanzas of type 'subscribed' is
   described in the contact's roster with a
   subscription state of "to" or "both", then following sections for both the contact's server MUST
   deliver and



Saint-Andre             Expires January 18, 2008               [Page 21]

Internet-Draft                   XMPP IM                       July 2007


   the user's presence stanza to the full JIDs (e.g.,
   <romeo@example.net/orchard>) associated with all of the contact's
   available resources.

4.5.  Unavailable Presence

   Before ending its session with a server, a client SHOULD gracefully
   become unavailable server.

   A subscription request is denied by sending UNAVAILABLE PRESENCE, i.e., a presence stanza that possesses no 'to' attribute and that possesses a 'type'
   attribute whose value of type
   "unsubscribed".

   CC: <presence to='romeo@example.net' type='unsubscribed'/>

   Note: Server processing of presence stanzas of type 'unsubscribed' is "unavailable" (optionally,
   described under Section 3.2 for both the final
   presence stanza MAY contain one or more <status/> elements specifying contact's server and the reason why
   user's server.

3.1.5.  Server Processing of Outbound Subscription Approval

   When the user is no longer available).  However, contact's client sends the user's subscription approval, the
   contact's server MUST NOT depend on receiving final presence from an available
   resource, since stamp the resource may become unavailable unexpectedly or
   may be timed out by outbound stanza with the server.  If one bare JID
   <contact@domain> of the user's resources
   becomes unavailable for any reason (either gracefully contact and route or
   ungracefully), deliver the user's stanza to
   the user.

   CS: <presence from='juliet@example.com'
                 to='romeo@example.net'
                 type='subscribed'/>

   The contact's server then MUST broadcast unavailable presence send a roster push to all contacts (1) that are in the user's roster with a subscription
   type of "from" or "both" and (2) from whom the
   contact's interested resources.

   CS: <iq to='juliet@example.com/balcony'
           type='set'
           id='a78b4q6ha463'>
         <query xmlns='jabber:iq:roster'>
           <item jid='romeo@example.net'
                 subscription='from'/>
         </query>
       </iq>

   CS: <iq to='juliet@example.com/chamber'
           type='set'
           id='a78b4q6ha464'>
         <query xmlns='jabber:iq:roster'>
           <item jid='romeo@example.net'
                 subscription='from'/>
         </query>
       </iq>

   The contact's server has not
   received unavailable presence, MUST then also send current presence information
   to the user from each of type "unsubscribe", or a the contact's available resources.






Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 18] 22]

Internet-Draft                   XMPP IM                      April                       July 2007


   presence error during


   CS: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'/>

   CS: <presence from='juliet@example.com/chamber'
                 to='romeo@example.net'/>

   From the user's session; perspective of the user's server MUST also
   send that unavailable presence stanza contact, there now exists a subscription
   from the user.

   In order to subscribe to the user's other available
   resources.  (Note: Regarding rule 2 above, if presence, the subscription state
   is "both" contact would then
   send a subscription request to the server MAY broadcast unavailable presence only if user.  (XMPP clients will often
   automatically send the server has received available presence from subscription request instead of requiring the
   contact at some
   point during to initiate the user's session; i.e., if subscription request, since it is assumed
   that the server never received
   available presence from desired end state is a mutual subscription.)  Naturally,
   when the contact and the user has sends a mutual
   presence subscription with the contact, it MAY decline to send
   unavailable presence request to the contact).  If user, the unavailable presence
   stanza was received
   Appendix A (as well as the roles of the two JIDs) will be different
   from those shown in the client, foregoing examples.

3.1.6.  Server Processing of Inbound Subscription Approval

   When the user's server MUST broadcast receives the
   full XML of that presence stanza to all entities that fit subscription approval, it MUST
   first check if the above
   description.

   Any presence stanza with no 'type' attribute and no 'to' attribute
   that contact is sent after sending broadcasted unavailable presence MUST be
   broadcasted by the server to all subscribers (i.e., MUST be treated
   as equivalent to "initial presence" for a new presence session).

4.6.  Directed Presence

   This section supplements and in some respects modifies the rules
   defined above, but only for the special case of "directed presence".

   BROADCASTED PRESENCE is generated when a client sends a presence
   stanza with no type (or user's roster with type "unavailable") a
   subscription='none' or subscription='from' and no 'to' address
   over the XML to its server.  However, a user MAY also send DIRECTED
   PRESENCE 'ask' flag set to another entity -- i.e., a presence stanza with
   "subscribe" (i.e., a 'to'
   attribute whose value is the JID Appendix A of the other entity and with either
   no 'type' attribute "None + Pending Out" or a 'type' attribute whose value is
   "unavailable".  There are three possible cases:

   1. "From +
   Pending Out").  If the user sends directed available or unavailable presence to a contact that is not in the user's roster with a subscription type
   either of
       "from" or "both" after having sent initial presence and before
       sending broadcasted unavailable presence, those states, the user's server MUST
       route or deliver silently ignore the full XML of that
   presence stanza but SHOULD
       NOT otherwise modify the contact's status regarding broadcasted
       presence of type "subscribed" (i.e., it SHOULD include MUST NOT route it to
   the contact's JID in any
       subsequent presence broadcasts initiated by user, modify the user).
   2. user's roster, or generate a roster push to the
   user's available resources).

   If the user sends directed presence to an entity that foregoing check is not in successful, the user's roster with server MUST initiate
   a subscription type of "from" or "both"
       after having sent initial presence and before sending broadcasted
       unavailable presence, roster push to all of the user's server MUST route or deliver interested resources, containing
   an updated roster item for the
       full XML of that presence stanza contact with the 'subscription'
   attribute set to a value of "to".

















Saint-Andre             Expires January 18, 2008               [Page 23]

Internet-Draft                   XMPP IM                       July 2007


   US: <iq to='romeo@example.net/foo'
           type='set'
           id='b89c5r7ib576'>
         <query xmlns='jabber:iq:roster'>
           <item jid='juliet@example.com'
                 subscription='to'/>
         </query>
       </iq>

   US: <iq to='romeo@example.net/bar'
           type='set'
           id='b89c5r7ib577'>
         <query xmlns='jabber:iq:roster'>
           <item jid='juliet@example.com'
                 subscription='to'/>
           </item>
         </query>
       </iq>

   From the entity but MUST NOT
       modify perspective of the user, there now exists a subscription to
   the contact's status regarding available presence
       broadcast (i.e., it information.

   The user's server MUST NOT include also deliver the entity's JID in any
       subsequent broadcasts of available presence initiated by the
       user); however, if stanza
   received from each of the contact's available resource from which resources to each of
   the user user's available resources.

   US: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'/>

   US: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'/>

   US: <presence from='juliet@example.com/chamber'
                 to='romeo@example.net'/>

   US: <presence from='juliet@example.com/chamber'
                 to='romeo@example.net'/>

3.2.  Cancelling a Subscription

3.2.1.  Client Generation of Subscription Cancellation

   If a contact would like to cancel a subscription that it has
   previously granted to a user, it sends a presence stanza of type
   "unsubscribed".

   CC: <presence to='romeo@example.net' type='unsubscribed'/>




Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 19] 24]

Internet-Draft                   XMPP IM                      April                       July 2007


       sent the directed presence become unavailable,


3.2.2.  Server Processing of Outbound Subscription Cancellation

   As mentioned, the user's contact's server MUST route that unavailable presence to stamp the entity (if outbound
   subscription cancellation with the bare JID <user@domain> of the
   contact.

   CS: <presence from='juliet@example.com'
                 to='romeo@example.net'
                 type='unsubscribed'/>

   If the user
       has not yet sent directed unavailable presence is hosted on the same server, the server MUST adhere to that entity).
   3.
   the rules specified in the next section when processing the
   subscription cancellation.

   If the user sends directed presence without first sending initial
       presence or after having sent unavailable presence broadcast
       (i.e., the resource is connected but not available), hosted on a different server, the user's contact's server
   then routes the stanza to that foreign domain in accordance with core
   XMPP stanza processing rules.

   The contact's server then MUST treat send a roster push with the entities updated
   roster item to which all of the user sends directed
       presence in contact's interested resources.

   CS: <iq to='juliet@example.com/balcony'
           type='set'
           id='a78b4q6ha465'>
         <query xmlns='jabber:iq:roster'>
           <item jid='romeo@example.net'
                 subscription='none'/>
         </query>
       </iq>

   CS: <iq to='juliet@example.com/chamber'
           type='set'
           id='a78b4q6ha466'>
         <query xmlns='jabber:iq:roster'>
           <item jid='romeo@example.net'
                 subscription='none'/>
         </query>
       </iq>

3.2.3.  Server Processing of Inbound Subscription Cancellation

   When the same way that user's server receives the inbound subscription
   cancellation, it treats MUST modify the entities listed in
       case #2 above.

   A server SHOULD respond to presence probes from entities to which subscription state and send a
   user has sent directed presence (before sending directed or
   broadcasted unavailable presence), even if such entities are not in roster
   push to the user's roster with a subscription type interested resource(s).







Saint-Andre             Expires January 18, 2008               [Page 25]

Internet-Draft                   XMPP IM                       July 2007


   US: <iq to='romeo@example.net/foo'
           type='set'
           id='h37h3u1bv400'>
         <query xmlns='jabber:iq:roster'>
           <item jid='juliet@example.com'
                 subscription='none'/>
         </query>
       </iq>

   US: <iq to='romeo@example.net/bar'
           type='set'
           id='h37h3u1bv401'>
         <query xmlns='jabber:iq:roster'>
           <item jid='juliet@example.com'
                 subscription='none'/>
           </item>
         </query>
       </iq>

3.3.  Unsubscribing

3.3.1.  Client Generation of "from" or "both".  For
   instance, Unsubscribe

   If a user may join would like to unsubscribe from a contact's presence, it
   sends a multi-user chat room (see [XEP-0045]) by
   sending directed presence to the room: stanza of type "unsubscribe".

   UC: <presence from='romeo@example.net/orchard'
             to='shakespeare@chat.example.com/RM'/>

   In order to discover if to='juliet@example.com' type='unsubscribe'/>

3.3.2.  Server Processing of Outbound Unsubscribe

   As mentioned, the user remains online, user's server MUST stamp the chat service
   SHOULD send a presence probe to outbound unsubscribe
   with the user on behalf bare JID <user@domain> of the room: user.

   US: <presence from='shakespeare@chat.example.com'
             to='romeo@example.net'/> from='romeo@example.net'
                 to='juliet@example.com'
                 type='unsubscribe'/>

   If the user contact is still online, hosted on the same server, the user's server SHOULD send an empty
   available presence MUST adhere
   to the requesting entity:

   <presence from='romeo@example.net/orchard'
             to='shakespeare@chat.example.com'/> rules specified in the next section when processing the
   unsubscribe.

   If the user contact is now offline, hosted on a different server, the user's server SHOULD send an empty
   unavailable presence to
   then routes the requesting entity:

   <presence from='romeo@example.net/orchard'
             to='shakespeare@chat.example.com'
             type='unavailable'/>

4.7.  Presence Syntax

   In stanza to that foreign domain in accordance with the default namespace declaration, a presence core
   XMPP stanza is qualified by processing rules.

   The user's server then MUST send a roster push with the 'jabber:client' or 'jabber:server'
   namespace, which defines certain allowable children updated
   roster item to all of presence
   stanzas, in particular the <show/>, <status/>, user's interested resources.




Saint-Andre             Expires January 18, 2008               [Page 26]

Internet-Draft                   XMPP IM                       July 2007


   US: <iq to='romeo@example.net/foo'
           type='set'
           id='h37h3u1bv402'>
         <query xmlns='jabber:iq:roster'>
           <item jid='juliet@example.com'
                 subscription='none'/>
         </query>
       </iq>

   US: <iq to='romeo@example.net/bar'
           type='set'
           id='h37h3u1bv403'>
         <query xmlns='jabber:iq:roster'>
           <item jid='juliet@example.com'
                 subscription='none'/>
           </item>
         </query>
       </iq>

3.3.3.  Server Processing of Inbound Unsubscribe

   When the contact's server receives the inbound unsubscribe, it MUST
   modify the subscription state and <priority/>
   elements.  These child elements are used send a roster push to provide more detailed
   information about an entity's availability.  Typically these child
   elements are provided only if the presence stanza possesses no 'type' contact's
   interested resource(s).

   CS: <iq to='juliet@example.com/balcony'
           type='set'
           id='a78b4q6ha467'>
         <query xmlns='jabber:iq:roster'>
           <item jid='romeo@example.net'
                 subscription='none'/>
         </query>
       </iq>

   CS: <iq to='juliet@example.com/chamber'
           type='set'
           id='a78b4q6ha468'>
         <query xmlns='jabber:iq:roster'>
           <item jid='romeo@example.net'
                 subscription='none'/>
         </query>
       </iq>


4.  Exchanging Presence Information






Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 20] 27]

Internet-Draft                   XMPP IM                      April                       July 2007


   attribute, although exceptions are noted in the text that follows.

4.7.1.  Availability States


4.1.  Overview

   The OPTIONAL <show/> element contains non-human-readable XML
   character data that specifies the particular availability sub-state concept of presence refers to an entity or entity's availability for
   communication over a specific resource thereof.  A network.  At the most basic level, presence stanza MUST
   NOT contain more than one <show/> element.  The <show/> element MUST
   NOT possess any attributes.  If provided, the XML character data
   value MUST be one of the following (additional availability types
   could be defined through a properly-namespaced child element of the
   presence stanza):

   o  away -- The entity or resource is temporarily away.
   o  chat -- The entity or resource is actively interested in chatting.
   o  dnd -- The a
   boolean "on/off" variable that signals whether an entity or resource is busy (dnd = "Do Not Disturb").
   o  xa -- The entity available
   or resource is away unavailable for an extended period (xa =
      "eXtended Away").

   If no <show/> element is provided, the entity is assumed to be online communication (the terms "online" and available.

   Example: Availability status:

   <presence>
     <show>dnd</show>
   </presence>

4.7.2.  Availability Description

   The OPTIONAL <status/> element contains XML character data specifying "offline"
   are also used).  In XMPP, a natural-language description of an entity's availability.  It principal's availability is
   normally used in conjunction with signalled
   when a client controlled by the show element to provide principal generates a
   detailed description of <presence/>
   stanza with no 'type' attribute, and an entity's lack of availability state (e.g., "In a meeting")
   is signalled when the presence a client generates a <presence/> stanza has no whose
   'type' attribute.  The <status/>
   element MUST NOT possess any attributes, with the exception of the
   'xml:lang' attribute.  Multiple instances of the <status/> element
   MAY be included, but only if each instance possesses an 'xml:lang' attribute with has a distinct language value (either explicitly or by
   inheritance of "unavailable".  In XMPP-based
   applications that combine messaging and presence functionality, the 'xml:lang' value
   default type of an element farther up in the
   XML hierarchy, communication for which may include the XML stream header as described
   in Section 4.4 of [XMPP-CORE]).









Saint-Andre             Expires October 19, 2007               [Page 21]

Internet-Draft                   XMPP IM                      April 2007


   Example: Availability description:

   <presence from='romeo@example.net/orchard'
             xml:lang='en'>
     <show>dnd</show>
     <status>Wooing Juliet</status>
     <status xml:lang='cs'>Dvo&#x0159;&#x00ED;m se Julii</status>
   </presence>

   A presence stanza of type "unavailable" MAY also include a <status/>
   element signals availability
   is messaging; however, XMPP-based applications are not required to
   combine messaging and presence functionality, and can provide detailed
   standalone presence features without messaging (in addition, XMPP
   servers do not require presence information about why the entity is going
   offline.

   Example: Unavailability description:

   <presence from='romeo@example.net/orchard'
             type='unavailable'>
     <status>Busy IRL</status>
   </presence>

   The <status/> child MAY also be sent in a subscription-related order to successfully
   route message and IQ stanzas).

   XMPP presence stanza (i.e., type "subscribe", "subscribed", "unsubscribe", typically follows a "publish-subscribe" or "unsubscribed") "observer"
   pattern, wherein an entity sends presence information to provide a description its server,
   and its server then broadcasts that information to all of the action:

   Example: Description of
   entity's contacts who have a subscription request:

   <presence from='romeo@example.net'
             to='nurse@example.com'
             type='subscribe'>
     <status>Hi, Juliet said I should add you to my buddy list.</status>
   </presence>

4.7.3.  Resource Priority

   The OPTIONAL <priority/> element contains non-human-readable XML
   character data that specifies the priority level of entity's presence
   (in the resource.
   The value MUST be terminology of [IMP-MODEL], an integer between -128 entity that generates presence
   information is a "presentity" and +127. the entities that receive presence
   information are "subscribers").  A client generates presence
   stanza MUST NOT contain more than one <priority/> element.  The
   <priority/> element MUST NOT possess any attributes.  If no priority
   is provided, for
   broadcasting to all subscribed entities by sending a presence stanza
   to its server SHOULD consider the priority to be zero.











Saint-Andre             Expires October 19, 2007               [Page 22]

Internet-Draft                   XMPP IM                      April 2007


   Example: Presence priority:

   <presence xml:lang='en'>
     <show>dnd</show>
     <status>Wooing Juliet</status>
     <status xml:lang='cs'>Dvo&#x0159;&#x00ED;m se Julii</status>
     <priority>1</priority>
   </presence>

   For information regarding the semantics of priority values in stanza
   routing within instant messaging and presence applications, refer to
   Server Rules for Handling XML Stanzas (Section 8).

4.7.4.  Presence Errors

   If with no 'to' address, where the presence stanza has
   either no 'type' attribute or a 'type' attribute whose value is of
   "unavailable".  This type "error", it MUST include an
   <error/> child element; for details, see [XMPP-CORE].

4.7.5.  Extended Namespaces

   As described in [XMPP-CORE], an XML stanza of presence is called BROADCASTED PRESENCE.
   (A client MAY contain any properly-
   namespaced child element; this applies to the also send DIRECTED PRESENCE, i.e., a presence stanza as
   well.


5.  Exchanging Messages

5.1.  Overview

   Once a client has authenticated
   with a server and bound a resource 'to' address; this is less common but is sometimes used to
   an XML stream as described
   send presence to entities that are not subscribed to the principal's
   presence.)

   After a client completes the preconditions specified in [XMPP-CORE], an XMPP
   it can establish a PRESENCE SESSION at its server will route
   XML stanzas to and from that client.  One type of stanza that may be
   exchanged is <message/>.  Exchanging messages is by sending initial
   presence (Section 4.2).  Such a basic use of XMPP
   and presence session is brought about when a terminated by
   sending unavailable presence (Section 4.5).

   Note: A user generates SHOULD NOT send a message stanza that is
   addressed presence update to another entity.  As defined under Server Rules for
   Handling XML Stanzas (Section 8), broadcast
   information that changes independently of the sender's server is responsible user's presence and
   availability for delivering the message to the intended recipient (if the
   recipient is on the same server) or for routing the message to communication.

4.2.  Initial Presence






Saint-Andre             Expires January 18, 2008               [Page 28]

Internet-Draft                   XMPP IM                       July 2007


4.2.1.  Client Generation

   After completing the
   recipient's server (if preconditions described in [XMPP-CORE]
   (REQUIRED) and requesting the recipient is on roster (RECOMMENDED), a different server).  Thus
   the message stanza is used to "push" information to another entity.

   An instant messaging client SHOULD specify an intended recipient
   signal its availability for communication by sending INITIAL PRESENCE
   to its server, i.e., a message presence stanza with no 'to' address
   (signalling that it is meant to be broadcasted by providing the JID server on
   behalf of an entity other than the sender in the 'to' client) and no 'type' attribute of (signalling the <message/> stanza.  If user's
   availability).  After sending initial presence, a connected resource
   (in the message terminology of [XMPP-CORE]) is being
   sent in reply said to a message previously received from be an address of the
   form <user@domain/resource> (e.g., within the context AVAILABLE
   RESOURCE.

   UC: <presence/>

4.2.2.  Server Processing of Outbound Presence

   Upon receiving initial presence from a chat
   session), client, the value of user's server MUST
   send the 'to' address SHOULD be of initial presence stanza from the form full JID
   <user@domain/resource> rather than of the form <user@domain> unless



Saint-Andre             Expires October 19, 2007               [Page 23]

Internet-Draft                   XMPP IM                      April 2007


   the sender has knowledge (via presence) user to all contacts that are
   subscribed to the intended recipient's
   resource user's presence information; such contacts are
   those for which a JID is no longer available.  If present in the message is being sent
   outside user's roster with the context
   'subscription' attribute set to a value of any existing chat session "from" or received message, "both".

   Note: In the value of following examples, the 'to' address SHOULD be of "user" is juliet@example.com and
   the form <user@domain>
   rather than user has three contacts in her roster with a subscription state
   of from or both: romeo@example.net, mercutio@example.com, and
   benvolio@example.com.

   US: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'/>

   US: <presence from='juliet@example.com/balcony'
                 to='mercutio@example.com'/>

   US: <presence from='juliet@example.com/balcony'
                 to='benvolio@example.com'/>

   The user's server MUST also broadcast initial presence from the form <user@domain/resource>.

   Common uses
   user's newly available resource to all of the message stanza in instant messaging applications
   include single messages, messages sent in user's available
   resources.

   US: <presence from='juliet@example.com/balcony'
                 to='juliet@example.com/balcony'/>

   US: <presence from='juliet@example.com/balcony'
                 to='juliet@example.com/chamber'/>

   In the context absence of a chat
   conversation, messages sent in presence information about the context user's contacts, the



Saint-Andre             Expires January 18, 2008               [Page 29]

Internet-Draft                   XMPP IM                       July 2007


   user's server SHOULD also send presence probes to the user's contacts
   on behalf of a multi-user chat room,
   headlines and other alerts, and errors.  These uses are
   differentiated via 'type' attribute.  Inclusion the user as specified under Section 4.3.

4.2.3.  Server Processing of Inbound Presence

   Upon receiving presence from the 'type'
   attribute is RECOMMENDED.  If included, user, the 'type' attribute contact's server MUST
   have one
   deliver the user's presence stanza to the full JIDs
   <contact@domain/resource> associated with all of the following values:

   o  chat -- The message contact's
   available resources.

   CC: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'/>

   CC: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'/>

4.2.4.  Client Processing of Inbound Presence

   When the contact's client receives presence from the user and the
   user is sent in the context of a one-to-one chat
      conversation.  A compliant client contact's roster, it SHOULD present display the message presence
   information in an appropriate roster interface.

   If the user is not in the contact's roster but the contact and the
   user are actively exchanging message or IQ stanzas, the contact's
   client SHOULD display the presence information in the user interface enabling one-to-one
   for that chat between session.

   Otherwise, the two parties,
      including an appropriate conversation history.
   o  error -- An error has occurred related to a previous message sent
      by client SHOULD ignore the sender (for details regarding stanza error syntax, refer presence information and not
   display it to
      [XMPP-CORE]). the contact.

4.3.  Presence Probes

   A compliant client PRESENCE PROBE is a presence stanza whose 'type' attribute has a
   value of "probe".  The value of the 'from' address SHOULD present an appropriate
      interface informing be the sender full
   JID <user@domain/resource> of the nature probing user and the value of the error.
   o  groupchat -- The message is sent in
   'to' address SHOULD be the context bare JID <contact@domain> of a multi-user
      chat environment (similar the contact
   whose availability the user wants to that of [IRC]). discover.

   US: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'
                 type='probe'/>

   A compliant client presence probe SHOULD present NOT be sent by a client.  Instead, it is
   designed to be sent by a user's server on the message user's behalf in an interface enabling many-to-many
      chat between order
   to discover the parties, including a roster availability of parties in the
      chatroom and an appropriate conversation history.  Full definition
      of XMPP-based groupchat protocols is out user's contacts.






Saint-Andre             Expires January 18, 2008               [Page 30]

Internet-Draft                   XMPP IM                       July 2007


4.3.1.  Server Generation of scope for this
      document (for details see [XEP-0045]).
   o  headline -- The message is probably generated by an automated
      service that delivers or broadcasts content (news, sports, market
      information, syndicated content, etc.).  No reply Outbound Presence Probe

   When a server needs to discover the message
      is expected, and availability of a compliant client user's contact,
   it SHOULD present send a presence probe from the message in
      an interface that appropriately differentiates full JID
   <user@domain/resource> of the message from
      standalone messages, chat sessions, or groupchat sessions (e.g.,
      by not providing the recipient with the ability user to reply).
   o  normal -- The message is a single message that is sent outside the
      context bare JID <contact@domain>
   of a one-to-one conversation or groupchat, and to which it
      is expected that the recipient will reply.  A compliant client contact.  The server SHOULD present the message in an interface enabling the recipient send a probe to reply, but without a conversation history.  This is the default
      value of the 'type' attribute.

   An IM application SHOULD support all of the foregoing message types; contact only if an application receives a message with no 'type' attribute or
   the
   application does not understand contact is in the value of user's roster with the 'type' 'subscription' attribute
   provided, it MUST consider the message
   set to be a value of type "normal" "to" or "both" (i.e.,
   "normal" is the default).  The "error" type MUST be generated only in



Saint-Andre             Expires October 19, 2007               [Page 24]

Internet-Draft                   XMPP IM                      April 2007


   response to an error related to a message received from another
   entity.

   Although if the 'type' attribute is OPTIONAL, it user is considered polite subscribed to
   mirror
   the type in any replies to contact's presence).

   The user's server SHOULD send a message; furthermore, some
   specialized applications (e.g., presence probe whenever the user
   starts a multi-user chat service) new presence session by sending initial presence; however,
   the server MAY choose not to send the probe at
   their discretion enforce that point if it has
   what it deems to be reliable and up-to-date presence information
   about the use of a particular message type user's contacts (e.g.,
   type='groupchat').

   In addition to because the 'type' attribute (which differentiates user has another
   available resource or because the
   conversational context user briefly logged off and on
   before the new presence session began).

   US: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'
                 type='probe'/>

   US: <presence from='juliet@example.com/balcony'
                 to='benvolio@example.com'
                 type='probe'/>

   US: <presence from='juliet@example.com/balcony'
                 to='nurse@example.com'
                 type='probe'/>

4.3.2.  Server Processing of Inbound Presence Probe

   Upon receiving a presence probe from the message), an XMPP message stanza MAY
   contain any allowable child elements qualified by user's server on behalf of
   the 'jabber:client'
   (or 'jabber:server') namespace, as well as any other properly-
   namespaced child element.  These payloads are described in user, the text
   that follows.

5.2.  Specifying a Message Body

   The <body/> element contains human-readable XML character data that
   specifies contact's server SHOULD reply as follows:

   1.  If the textual contents of contact account does not exist or the message; this child element is
   normally included but user is OPTIONAL.  The <body/> element MUST NOT
   possess any attributes, in the
       contact's roster with a subscription state other than "From",
       "From + Pending Out", or "Both" (as defined under Appendix A),
       the exception contact's server MUST return a presence stanza of type
       "unsubscribed" in response to the 'xml:lang'
   attribute.  Multiple instances presence probe (however, if a
       server receives a presence probe from a configured hostname of
       the <body/> element server itself or another such trusted service, it MAY be
   included, but only provide
       presence information about the user to that entity).

   CS: <presence from='mercutio@example.com'
                 to='juliet@example.com'
                 type='unsubscribed'/>




Saint-Andre             Expires January 18, 2008               [Page 31]

Internet-Draft                   XMPP IM                       July 2007


   2.  Else, if each instance possesses an 'xml:lang' attribute
   with a distinct language value (either explicitly or the contact has no available resources, the server MUST
       either (1) reply to the presence probe by inheritance
   of sending to the 'xml:lang' value of an element farther up in user the
       full XML
   hierarchy, which may include of the XML stream header as described in
   Section 4.4 last presence stanza of [XMPP-CORE]).  The <body/> element type "unavailable"
       received by the server from the contact, or (2) not reply at all.
   3.  Else, if the contact has at least one available resource, the
       server MUST NOT contain
   mixed content (as defined in Section 3.2.2 of [XML]).

   A message stanza often will contain a child <body/> element whose XML
   character data specifies reply to the primary meaning of presence probe by sending to the message.

   Example: A message with a body:

   <message
       to='romeo@example.net'
       from='juliet@example.com/balcony'
       type='chat'
       xml:lang='en'>
     <body>Wherefore art thou, Romeo?</body>
     <body xml:lang='cs'>Pro&#x010D;e&#x017D; jsi ty, Romeo?</body>
   </message>








Saint-Andre             Expires October 19, 2007               [Page 25]

Internet-Draft                   XMPP IM                      April 2007


5.3.  Specifying a Message Subject

   The <subject/> element contains human-readable XML character data
   that specifies user
       the topic full XML of the message.  The <subject/> element MUST
   NOT possess any attributes, last presence stanza with no 'to' attribute
       received by the exception server from each of the 'xml:lang' contact's available
       resources.

   CS: <presence from='romeo@example.net/foo'
                 to='juliet@example.com'/>

   CS: <presence from='romeo@example.net/bar'
                 to='juliet@example.com'>
         <show>away</show>
       </presence>

4.4.  Subsequent Presence Broadcast

4.4.1.  Client Generation

   After sending initial presence, the user's client may update its
   availability for broadcasting at any time during its session by
   sending a presence stanza with no 'to' address and no 'type'
   attribute.  Multiple instances

   UC: <presence>
         <show>away</show>
       </presence>

4.4.2.  Server Processing of Outbound Presence

   Upon receiving a presence stanza expressing updated availability, the <subject/> element MAY be
   included for
   user's server MUST broadcast the purpose full XML of providing alternate versions that presence stanza to
   all contacts who meet both of the same
   subject, but only if each instance possesses an 'xml:lang' attribute following criteria:

   1.  The contact is in the user's roster with a distinct language value (either explicitly or by inheritance subscription type of
       "from" or "both".
   2.  The last presence stanza received from the 'xml:lang' value contact during the
       user's presence session was not of type "error", "unavailable",
       or "unsubscribe".









Saint-Andre             Expires January 18, 2008               [Page 32]

Internet-Draft                   XMPP IM                       July 2007


   US: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'>
         <show>away</show>
       </presence>

   US: <presence from='juliet@example.com/balcony'
                 to='benvolio@example.com'>
         <show>away</show>
       </presence>

   US: <presence from='juliet@example.com/balcony'
                 to='mercutio@example.com'>
         <show>away</show>
       </presence>

   Note: As an element farther up in optimization, if the XML
   hierarchy, which may include subscription state is "both" then
   the XML stream header as described in
   Section 4.4 of [XMPP-CORE]). user's server MAY choose to broadcast subsequent presence only if
   the server has received available presence from the contact at some
   point during the user's session; i.e., if the server never received
   available presence from the contact and the user has a mutual
   presence subscription with the contact, it MAY decline to send
   subsequent presence to the contact.

   The <subject/> element user's server MUST NOT contain
   mixed content (as defined in Section 3.2.2 also send the presence stanza to all of [XML]).

   Example: A message with a subject:

   <message
       to='romeo@example.net' the
   user's available resources.

   US: <presence from='juliet@example.com/balcony'
       type='chat'
       xml:lang='en'>
     <subject>I implore you!</subject>
     <subject xml:lang='cs'>
       &#x00DA;p&#x011B;nliv&#x011B; pros&#x00EDm!
     </subject>
     <body>Wherefore art thou, Romeo?</body>
     <body xml:lang='cs'>Pro&#x010D;e&#x017E; jsi ty, Romeo?</body>
   </message>

5.4.  Specifying a Conversation Thread

   The primary use
                 to='juliet@example.com/chamber'>
         <show>away</show>
       </presence>

   US: <presence from='juliet@example.com/balcony'
                 to='juliet@example.com/balcony'>
         <show>away</show>
       </presence>

4.4.3.  Server Processing of Inbound Presence

   Upon receiving presence from the XMPP <thread/> element is user, the contact's server MUST
   deliver the user's presence stanza to uniquely identify
   a conversation thread or "chat session" between two entities
   instantiated by <message/> stanzas the full JIDs
   <contact@domain/resource> associated with all of type 'chat'.  However, the contact's
   available resources.









Saint-Andre             Expires January 18, 2008               [Page 33]

Internet-Draft                   XMPP
   <thread/> element may also be used to uniquely identify an analogous
   thread between two entities instantiated by <message/> stanzas IM                       July 2007


   CS: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'>
         <show>away</show>
       </presence>

   CS: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'>
         <show>away</show>
       </presence>

4.4.4.  Client Processing of
   type 'headline' or 'normal', Inbound Presence

   When the contact's client receives presence from the user and the
   user is in the contact's roster, it SHOULD display the presence
   information in an appropriate roster interface.

   If the user is not in the contact's roster but the contact and the
   user are actively exchanging message or among multiple entities IQ stanzas, the contact's
   client SHOULD display the presence information in the
   context of a multi-user chat room instantiated by <message/> stanzas
   of type 'groupchat'.  It may also be used user interface
   for <message/> stanzas that chat session.

   Otherwise, the client SHOULD ignore the presence information and not
   related
   display it to a conversation, such as a game session or between plugins.

   The value of the <thread/> element MUST be contact.

4.5.  Unavailable Presence

4.5.1.  Client Generation

   Before ending its presence session with a universally unique
   identifier (UUID) as described in [UUID].

   The use of server, the <thread/> element is OPTIONAL user's client
   SHOULD gracefully become unavailable by sending UNAVAILABLE PRESENCE,
   i.e., a presence stanza that possesses no 'to' attribute and that
   possesses a 'type' attribute whose value is not used to
   identify individual messages, only conversations.  A message "unavailable".

   UC: <presence type='unavailable'/>

   Optionally, the final presence stanza
   MUST NOT MAY contain more than one <thread/> element. or more
   <status/> elements specifying the reason why the user is no longer
   available.

   US: <presence type='unavailable'>
         <status>going on vacation</status>
       </presence>

4.5.2.  Server Processing of Outbound Unavailable Presence

   The <thread/>
   element user's server MUST NOT possess any attributes.  The value of the <thread/> depend on receiving unavailable presence
   from an available resource, since the resource may become unavailable
   ungracefully (e.g., the resource may be timed out by the server



Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 26] 34]

Internet-Draft                   XMPP IM                      April                       July 2007


   element MUST be treated as opaque by entities; no semantic meaning
   may be derived from it, and only exact comparisons may be made
   against it.  The <thread/> element MUST NOT contain mixed content (as
   defined in Section 3.2.2


   because of [XML]).

5.5.  Message Errors inactivity).

   If the message stanza is of type "error", it MUST include an <error/>
   child; available resource becomes unavailable for details, see [XMPP-CORE].

5.6.  Extended Namespaces

   As described in [XMPP-CORE], an XML stanza MAY contain any properly-
   namespaced child element; this applies to reason (either
   gracefully or ungracefully), the message stanza as well.


6.  Exchanging IQ Stanzas

   As described in [XMPP-CORE], IQ stanzas provide a structured request-
   response mechanism.  The basic semantics of that mechanism (e.g., user's server MUST broadcast
   unavailable presence to all contacts that meet both of the 'id' attribute following
   criteria:

   1.  The contact is required) are defined in [XMPP-CORE],
   whereas the specific semantics required to complete particular use
   cases are defined in all cases by an extended namespace.  Note that user's roster with a subscription type of
       "from" or "both".
   2.  The last presence stanza received from the 'jabber:client' and 'jabber:server' namespaces do contact during the
       user's presence session was not define any
   children of IQ stanzas other than the common <error/>.  This document
   defines such an extended namespace, for Managing type "error", "unavailable",
       or "unsubscribe".

   If the Roster
   (Section 2).  However, an IQ unavailable presence stanza MAY contain structured
   information qualified by any extended namespace.


7.  Examples

   The examples in this section illustrate a possible instant messaging
   and was gracefully received from the
   client, the server MUST broadcast the full XML of the presence session.
   stanza.

   US: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'
                 type='unavailable'/>

   US: <presence from='juliet@example.com/balcony'
                 to='benvolio@example.com'
                 type='unavailable'/>

   US: <presence from='juliet@example.com/balcony'
                 to='mercutio@example.com'
                 type='unavailable'/>

   The user is romeo@example.net, he has an
   available resource whose resource identifier is "orchard", and he has user's server MUST also send the following individuals in his roster:

   o  juliet@example.com (subscription="both" and she has two unavailable presence stanza to
   all of the user's remaining available
      resources, one whose resource is "chamber" resources.

   US: <presence from='juliet@example.com/balcony'
                 to='juliet@example.com/chamber'
                 type='unavailable'/>

   Note: Any presence stanza with no 'type' attribute and another whose
      resource no 'to'
   attribute that is "balcony")
   o  benvolio@example.org (subscription="to")
   o  mercutio@example.org (subscription="from")

   First, sent after sending broadcasted unavailable presence
   MUST be broadcasted by the user completes server to all subscribers (i.e., MUST be
   treated as equivalent to "initial presence" for a new presence
   session).

4.5.3.  Server Processing of Inbound Unavailable Presence

   Upon receiving unavailable presence from the preconditions (stream establishment,
   TLS and SASL negotiation, and resource binding) described in
   [XMPP-CORE]; those packet flows are not reproduced here.

   Next, user, the user requests his roster: contact's
   server MUST deliver the user's presence stanza to the full JIDs
   <contact@domain/resource> associated with all of the contact's
   available resources.



Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 27] 35]

Internet-Draft                   XMPP IM                      April                       July 2007


   Example 1: Client requests current roster from server:

   <iq from='romeo@example.net/balcony' type='get' id='ex1'>
     <query xmlns='jabber:iq:roster'/>
   </iq>

   Example 2:


   CS: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'
                 type='unavailable'/>

   CS: <presence from='juliet@example.com/balcony'
                 to='romeo@example.net'
                 type='unavailable'/>

4.5.4.  Client Processing of Inbound Unavailable Presence

   When the contact's client receives roster unavailable presence from server:

   <iq to='romeo@example.com/balcony' type='result' id='ex1'>
     <query xmlns='jabber:iq:roster'>
       <item jid='romeo@example.net'
             name='Juliet'
             subscription='both'>
         <group>Friends</group>
       </item>
       <item jid='benvolio@example.org'
             name='Benvolio'
             subscription='to'/>
       <item jid='mercutio@example.org'
             name='Mercutio'
             subscription='from'/>
     </query>
   </iq>

   Now the user sends initial presence.

   Example 3: User sends initial presence:

   <presence from='romeo@example.net/orchard'/>

   Example 4: User's server sends
   and the user is in the contact's roster, it SHOULD display the
   unavailable presence probes information in an appropriate roster interface.

   If the user is not in the contact's roster but the contact and the
   user are actively exchanging message or IQ stanzas, the contact's
   client SHOULD display the unavailable presence information in the
   user interface for that chat session.

   Otherwise, the client SHOULD ignore the unavailable presence
   information and not display it to contacts the contact.

4.6.  Directed Presence

   This section supplements and in some respects modifies the rules
   defined above, but only for the special case of directed presence.

4.6.1.  Client Generation

   As noted, directed presence is a presence stanza with
   subscription="to" a 'to'
   attribute whose value is the bare JID or full JID of the other entity
   and subscription="both" on behalf with either no 'type' attribute or a 'type' attribute whose value
   is "unavailable".

4.6.2.  Server Processing of Outbound Directed Presence

   When the user's
   available resource:

   <presence
       type='probe'
       from='romeo@example.net/orchard'
       to='juliet@example.com'/>

   <presence
       type='probe'
       from='romeo@example.net/orchard'
       to='benvolio@example.org'/>








Saint-Andre             Expires October 19, 2007               [Page 28]

Internet-Draft                   XMPP IM                      April 2007


   Example 5: User's server receives the directed presence stanza, it
   SHOULD process it according to the following rules.

   1.  If the user sends initial directed available or unavailable presence to contacts a
       contact that is in the user's roster with
   subscription="from" and subscription="both" on behalf a subscription type of
       "from" or "both" after having sent initial presence and before
       sending broadcasted unavailable presence, the user's
   available resource:

   <presence
       from='romeo@example.net/orchard'
       to='juliet@example.com'/>

   <presence
       from='romeo@example.net/orchard'
       to='mercutio@example.org'/>

   Example 6: Contacts' servers reply to presence probe on behalf server MUST
       route or deliver the full XML of all
   available resources:

   <presence
       from='juliet@example.com/balcony'
       to='romeo@example.net/orchard'
       xml:lang='en'>
     <show>away</show>
     <status>be right back</status>
     <priority>0</priority>
   </presence>

   <presence
       from='juliet@example.com/chamber'
       to='romeo@example.net/orchard'>
     <priority>1</priority>
   </presence>

   <presence
       from='benvolio@example.org/pda'
       to='romeo@example.net/orchard'
       xml:lang='en'>
     <show>dnd</show>
     <status>gallivanting</status>
   </presence> that presence stanza but SHOULD
       NOT otherwise modify the contact's status regarding broadcasted
       presence (i.e., it SHOULD include the contact's JID in any
       subsequent presence broadcasts initiated by the user).




Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 29] 36]

Internet-Draft                   XMPP IM                      April                       July 2007


   Example 7: Contacts' servers deliver user's initial presence to all
   available resources or return error to user:

   <presence
       from='romeo@example.net/orchard'
       to='juliet@example.com/chamber'/>

   <presence
       from='romeo@example.net/orchard'
       to='juliet@example.com/balcony'/>

   <presence
       type='error'
       from='mercutio@example.org'
       to='romeo@example.net/orchard'>
     <error type='cancel'>
       <gone xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
     </error>
   </presence>

   Example 8: User


   2.  If the user sends directed presence to another user an entity that is not in his
   roster:

   <presence
       from='romeo@example.net/orchard'
       to='nurse@example.com'
       xml:lang='en'>
     <show>dnd</show>
     <status>courting Juliet</status>
     <priority>0</priority>
   </presence>

   Now
       the user has a threaded conversation (chat session) user's roster with one of
   his contacts.

















Saint-Andre             Expires October 19, 2007               [Page 30]

Internet-Draft                   XMPP IM                      April 2007


   Example 9: A threaded conversation

   <message
       to='romeo@example.net/orchard'
       from='juliet@example.com/balcony'
       type='chat'
       xml:lang='en'>
     <body>Art thou not Romeo, and a Montague?</body>
     <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread>
   </message>

   <message
       to='juliet@example.com/balcony'
       from='romeo@example.net/orchard'
       type='chat'
       xml:lang='en'>
     <body>Neither, fair saint, if either thee dislike.</body>
     <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread>
   </message>

   <message
       to='romeo@example.net/orchard'
       from='juliet@example.com/balcony'
       type='chat'
       xml:lang='en'>
     <body>How cam'st thou hither, tell me, subscription type of "from" or "both"
       after having sent initial presence and wherefore?</body>
     <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread>
   </message>

   And so on.

   The user can also send subsequent before sending broadcasted
       unavailable presence, the user's server MUST route or deliver the
       full XML of that presence broadcast.

   Example 10: User sends updated stanza to the entity but MUST NOT
       modify the contact's status regarding available presence information for
   broadcasting:

   <presence xml:lang='en'>
     <show>away</show>
     <status>I shall return!</status>
     <priority>1</priority>
   </presence>










Saint-Andre             Expires October 19, 2007               [Page 31]

Internet-Draft                   XMPP IM                      April 2007


   Example 11: User's server
       broadcast (i.e., it MUST NOT include the entity's JID in any
       subsequent broadcasts updated of available presence information
   only to one contact (not those initiated by the
       user); however, if the available resource from whom an error was received or to
   whom which the user
       sent the directed presence):

   <presence
       from='romeo@example.net/orchard'
       to='juliet@example.com'
       xml:lang='en'>
     <show>away</show>
     <status>I shall return!</status>
     <priority>1</priority>
   </presence>

   Example 12: Contact's presence become unavailable, the user's server delivers updated
       MUST route that unavailable presence information to
   all of the contact's available resources:

   [to "balcony" resource...]

   <presence
       from='romeo@example.net/orchard'
       to='juliet@example.com'
       xml:lang='en'>
     <show>away</show>
     <status>I shall return!</status>
     <priority>1</priority>
   </presence>

   [to "chamber" resource...]

   <presence
       from='romeo@example.net/orchard'
       to='juliet@example.com'
       xml:lang='en'>
     <show>away</show>
     <status>I shall return!</status>
     <priority>1</priority>
   </presence>

   Example 13: One of entity (if the contact's resources broadcasts final presence:

   <presence from='juliet@example.com/balcony' type='unavailable'/>










Saint-Andre             Expires October 19, 2007               [Page 32]

Internet-Draft                   XMPP IM                      April 2007


   Example 14: Contact's server sends user
       has not yet sent directed unavailable presence information to user:

   <presence
       type='unavailable'
       from='juliet@example.com/balcony'
       to='romeo@example.net/orchard'/>

   Example 15: User that entity).
   3.  If the user sends unavailable presence:

   <presence from='romeo@example.net/orchard'
             type='unavailable'
             xml:lang='en'>
     <status>gone home</status>
   </presence>

   Example 16: User's server broadcasts directed presence without first sending initial
       presence or after having sent unavailable presence information
   to contact as well as to broadcast
       (i.e., the person resource is connected but not available), the user's
       server MUST treat the entities to whom which the user sent sends directed
   presence:

   <presence
       type='unavailable'
       from='romeo@example.net/orchard'
       to='juliet@example.com'
       xml:lang='en'>
     <status>gone home</status>
   </presence>

   <presence
       type='unavailable'
       from='romeo@example.net/orchard'
       to='nurse@example.com'
       xml:lang='en'>
     <status>gone home</status>
   </presence>

   Now
       presence in the user closes his stream:

   </stream:stream>

   And same way that it treats the user's server closes its stream as well:

   </stream:stream>

   THE END






Saint-Andre             Expires October 19, 2007               [Page 33]

Internet-Draft                   XMPP IM                      April 2007


8.  Server Rules for Handling XML Stanzas

   Basic routing and delivery rules for servers are defined entities listed in
   [XMPP-CORE].  This section defines additional rules for XMPP-
   compliant instant messaging and presence servers.

8.1.
       case #2 above.

4.6.3.  Server Processing of Inbound Stanzas

   If Directed Presence

   From the hostname perspective of the domain identifier portion of contact's server, there is no difference
   between broadcasted presence and directed presence, so the JID contained
   in contact's
   server follows the 'to' attribute existing rules for processing of an inbound stanza matches a hostname presence.

4.6.4.  Client Processing of Inbound Directed Presence

   When the
   server itself and contact's client receives presence from the JID contained in user and the 'to' attribute
   user is of the
   form <user@example.com> or <user@example.com/resource>, in the server
   MUST follow contact's roster, it SHOULD display the rules defined presence
   information in the following list:

   1. an appropriate roster interface.

   If the JID user is of the form <user@domain/resource> and an available
       resource exactly matches the full JID, the recipient's server
       MUST deliver the stanza to that resource.
   2.  Else if not in the JID is of contact's roster but the form <user@domain> or
       <user@domain/resource> contact and the associated
   user account does not
       exist, are actively exchanging message or IQ stanzas, the recipient's server (a) contact's
   client SHOULD silently ignore display the
       stanza (i.e., neither deliver it nor return an error) if it is a presence stanza, (b) MUST return a <service-unavailable/> stanza
       error to the sender if it is information in an IQ stanza, and (c) appropriate user
   interface.

   Otherwise, the client SHOULD return
       a <service-unavailable/> stanza error to ignore the sender if presence information and not
   display it is a
       message stanza.
   3.  Else if to the JID is contact.

4.7.  Presence Syntax

4.7.1.  Values of the form <user@domain/resource> and no
       connected or available resource exactly matches the full JID, the
       recipient's server (a) SHOULD silently ignore the stanza (i.e.,
       neither deliver it nor return an error) if it is a presence
       stanza, (b) MUST return Type Attribute

   The absence of a <service-unavailable/> stanza error to 'type' attribute signals that the sender if it relevant entity is an IQ stanza,
   available for communication (see Section 4.2 and (c) SHOULD treat the stanza
       as if it were addressed to <user@domain> if it is Section 4.4).

   A 'type' attribute with a message
       stanza.
   4.  Else if the JID is value of "unavailable" signals that the form <user@domain> and there
   relevant entity is at
       least one available resource not available for the user, the
       recipient's server MUST follow these rules:
       1.  For message stanzas, the server SHOULD deliver the communication (see Section 4.5).



Saint-Andre             Expires January 18, 2008               [Page 37]

Internet-Draft                   XMPP IM                       July 2007


   The XMPP presence stanza is also used to negotiate and manage
   subscriptions to the highest-priority available resource (if the resource did
           not provide presence of other entities.  These tasks are
   completed via presence stanzas of type "subscribe", "unsubscribe",
   "subscribed", and "unsubscribed" as described under Section 3.

   If a value for the <priority/> element, the server
           SHOULD consider it to have provided user and contact are associated with different XMPP servers,
   those servers also use a value special presence stanza of zero).  If two
           or more available resources have the same priority, type "probe" in
   order to determine the
           server MAY use some other rule (e.g., most recent connect
           time, most recent activity time, or highest availability as
           determined by some hierarchy of <show/> values) to choose
           between them or MAY deliver the message to all such
           resources.  However, entity on the server MUST NOT deliver the stanza
           to an available resource with a negative priority; if the
           only available resource has a negative priority, the server



Saint-Andre             Expires October 19, 2007               [Page 34]

Internet-Draft                   XMPP IM                      April 2007 peer server;
   for details, see Section 4.3.  Clients SHOULD handle the message as if there were no available
           resources (defined in the text that follows).  In addition,
           the server MUST NOT rewrite the 'to' attribute (i.e., it MUST
           leave it as <user@domain> rather than change it to
           <user@domain/resource>).
       2.  For send presence
   stanzas other than those of type "probe", the
           server MUST deliver the stanza to all available resources;
           for presence probes, the server SHOULD reply based on the
           rules defined in Presence Probes (Section 4.3).  In addition,
           the server MUST NOT rewrite "probe".

   The values of the 'to' 'type' attribute (i.e., it MUST
           leave it can be summarized as <user@domain> rather than change it to
           <user@domain/resource>).
       3.  For IQ stanzas, the server itself MUST reply on behalf follows:

   o  error -- An error has occurred regarding processing of the
           user with either an IQ result or an IQ error, and MUST NOT
           deliver the IQ stanza to the available resources.
           Specifically, a
      previously-sent presence stanza; if the semantics presence stanza is of the qualifying namespace
           define type
      "error", it MUST include an <error/> child element (see see
      [XMPP-CORE]).
   o  probe -- A request for an entity's current presence; SHOULD be
      generated only by a reply that the server can provide, the server MUST
           reply to the stanza on behalf of the user; if not, the server
           MUST reply with a <service-unavailable/> stanza error.
   5.  Else if user.
   o  subscribe -- The sender wishes to subscribe to the JID is of recipient's
      presence.
   o  subscribed -- The sender has allowed the form <user@domain> and there are recipient to receive
      their presence.
   o  unsubscribe -- The sender is unsubscribing from another entity's
      presence.
   o  unsubscribed -- The subscription request has been denied or a
      previously-granted subscription has been cancelled.
   o  unavailable -- Signals that the entity is no longer available resources associated for
      communication.

4.7.2.  Child Elements

   In accordance with the user, how the stanza
       shall be handled depends on the stanza type:
       1.  For default namespace declaration, a presence stanzas of type "subscribe", "subscribed",
           "unsubscribe", and "unsubscribed",
   stanza is qualified by the server MUST maintain a
           record 'jabber:client' or 'jabber:server'
   namespace, which defines certain allowable children of presence
   stanzas, in particular the stanza <show/>, <status/>, and deliver <priority/>
   elements.  These child elements are used to provide more detailed
   information about an entity's availability.  Typically these child
   elements are provided only if the presence stanza at least once
           (i.e., when possesses no 'type'
   attribute, although exceptions are noted in the user next creates text that follows.

4.7.2.1.  Show

   The OPTIONAL <show/> element specifies the particular availability
   sub-state of an available entity or a specific resource and
           requests the roster); in addition, thereof.  A presence
   stanza MUST NOT contain more than one <show/> element.  The <show/>
   element MUST NOT possess any attributes.  The XML character data of
   the server <show/> element is not human-readable.  The data MUST continue
           to deliver presence stanzas be one of type "subscribe" until



Saint-Andre             Expires January 18, 2008               [Page 38]

Internet-Draft                   XMPP IM                       July 2007


   the
           user either approves or denies following (additional availability types could be defined through
   a properly-namespaced child element of the subscription request (see
           also Managing Presence Subscriptions (Section 3)).
       2.  For all other presence stanzas, the server SHOULD silently
           ignore the stanza by not storing it for later delivery or
           replying to it on behalf of the user.
       3.  For message stanzas, the server MAY choose to store the
           stanza on behalf of the user and deliver it when the user
           next becomes available, or forward the message to the user
           via some other means (e.g., to the user's email account).
           However, if offline message storage stanza):

   o  away -- The entity or message forwarding resource is
           not enabled, the server MUST return to the sender a <service-
           unavailable/> stanza error.  (Note: Offline message storage
           and message forwarding are not defined in XMPP, since they
           are strictly a matter of implementation and service
           provisioning.)
       4.  For IQ stanzas, the server itself MUST reply on behalf of the
           user with either an IQ result temporarily away.
   o  chat -- The entity or an IQ error.  Specifically,
           if the semantics of the qualifying namespace define a reply
           that the server can provide, the server MUST reply to the
           stanza on behalf of the user; if not, the server MUST reply



Saint-Andre             Expires October 19, 2007               [Page 35]

Internet-Draft                   XMPP IM                      April 2007


           with a <service-unavailable/> stanza error.

8.2.  Outbound Stanzas

   If the hostname of the domain identifier portion of the address
   contained resource is actively interested in the 'to' attribute of an outbound stanza matches a
   hostname of the server itself, the server MUST deliver the stanza to
   a local chatting.
   o  dnd -- The entity according the rules for Inbound Stanzas (Section 8.1).

   If the hostname of the domain identifier portion of the address
   contained in the 'to' attribute of an outbound stanza does not match
   a hostname of the server itself, the server MUST attempt to route the
   stanza to the foreign domain.  The recommended order of actions is as
   follows:

   1.  First attempt to resolve the foreign hostname using an [SRV]
       Service of "xmpp-server" and Proto of "tcp", resulting in
       resource records such as "_xmpp-server._tcp.example.com.", as
       specified in [XMPP-CORE].
   2.  If the "xmpp-server" address record resolution fails, attempt to
       resolve the "_im" or "_pres" [SRV] Service as specified in
       [IMP-SRV], using the "_im" Service for <message/> stanzas and the
       "_pres" Service for <presence/> stanzas (it resource is up to the
       implementation how to handle <iq/> stanzas).  This will result in
       one or more resolutions of the form "_im.<proto>.example.com." or
       "_pres.<proto>.example.com.", where "<proto>" would be a label
       registered in the Instant Messaging SRV Protocol Label registry
       or the Presence SRV Protocol Label registry: either "_xmpp" for
       an XMPP-aware domain or some other IANA-registered label (e.g.,
       "_simple") for a non-XMPP-aware domain.
   3.  If both SRV address record resolutions fail, attempt to perform a
       normal IPv4/IPv6 address record resolution to determine the IP
       address using the "xmpp-server" port of 5269 registered with the
       IANA, as specified in [XMPP-CORE].

   Administrators of server deployments are strongly encouraged to keep
   the _im._xmpp, _pres._xmpp, and _xmpp._tcp SRV records properly
   synchronized, since different implementations might perform the "_im"
   and "_pres" lookups before the "xmpp-server" lookup.


9.  IM and Presence Compliance Requirements

   This section summarizes the specific aspects of the Extensible
   Messaging and Presence Protocol that MUST be supported by instant
   messaging and presence servers and clients in order to be considered
   compliant implementations.  All such applications MUST comply with
   the requirements specified in [XMPP-CORE].  The text in this section



Saint-Andre             Expires October 19, 2007               [Page 36]

Internet-Draft                   XMPP IM                      April 2007


   specifies additional compliance requirements for instant messaging
   and presence servers and clients; note well that the requirements
   described here supplement but do not supersede the core requirements.
   Note also that a server or client MAY support only presence or
   instant messaging, and is not required to support both if only a
   presence service or an instant messaging service is desired.

9.1.  Servers

   In addition to core server compliance requirements, an instant
   messaging and presence server MUST additionally support the following
   protocols:

   o  All server-related instant messaging and presence syntax and
      semantics defined in this document, including presence broadcast
      on behalf of clients, presence subscriptions, roster storage and
      manipulation, and IM-specific routing and delivery rules

9.2.  Clients

   In addition to core client compliance requirements, an instant
   messaging and presence client MUST additionally support the following
   protocols:

   o  Generation and handling of the IM-specific semantics of XML
      stanzas as defined by the XML schemas, including the 'type'
      attribute of message and presence stanzas as well as their child
      elements
   o  All client-related instant messaging syntax and semantics defined
      in this document, including presence subscriptions and roster
      management busy (dnd = "Do Not Disturb").
   o  End-to-end object encryption as defined in [XMPP-E2E]

   A client MUST also handle addresses that are encoded as "im:" URIs as
   specified in [CPIM], and MAY do so by removing the "im:" scheme and
   entrusting address resolution to the server as specified under
   Outbound Stanzas (Section 8.2).


10.  Internationalization Considerations

   For internationalization considerations, refer to the relevant
   section of [XMPP-CORE].


11.  Security Considerations

   Core security considerations for XMPP are defined in the relevant



Saint-Andre             Expires October 19, 2007               [Page 37]

Internet-Draft                   XMPP IM                      April 2007


   section of [XMPP-CORE].

   Additional considerations that apply only to instant messaging and
   presence applications of XMPP are defined in several places within
   this document; specifically:

   o  When a server processes an inbound presence stanza of type "probe"
      whose intended recipient is a user associated with one of the
      server's hostnames, the server MUST NOT reveal the user's presence
      information if the sender is an entity that is not authorized to
      receive that information as determined by presence subscriptions
      (see Exchanging Presence Information (Section 4)).
   o  When a server processes an outbound presence stanza with no type
      or of type "unavailable", it MUST follow the rules defined under
      Exchanging Presence Information (Section 4) in order to ensure
      that such presence information is not broadcasted to entities that
      are not authorized to know such information.
   o  When a server generates an error stanza in response to receiving a
      stanza for a user who does not exist, the use of the <service-
      unavailable/> error condition helps protect against well-known
      dictionary attacks, since this is the same error condition that is
      returned if, for instance, the namespace of an IQ child element is
      not understood, or if offline message storage or message
      forwarding is not enabled for a domain.


12.  IANA Considerations

   For a number of related IANA considerations, refer to the relevant
   section of [XMPP-CORE].

12.1.  Instant Messaging SRV Protocol Label Registration

   Address Resolution for Instant Messaging and Presence [IMP-SRV]
   defines an Instant Messaging SRV Protocol Label registry for
   protocols that can provide services that conform to the "_im" SRV
   Service label.  Because XMPP is one such protocol, the IANA registers
   the "_xmpp" protocol label in the appropriate registry, as follows:

   Protocol label:  _xmpp
   Specification:  RFC 3921
   Description:  Instant messaging protocol label for the Extensible
      Messaging and Presence Protocol (XMPP) as defined by RFC 3921.
   Registrant Contact:  IETF, XMPP Working Group, <xmppwg@jabber.org>







Saint-Andre             Expires October 19, 2007               [Page 38]

Internet-Draft                   XMPP IM                      April 2007


12.2.  Presence SRV Protocol Label Registration

   Address Resolution for Instant Messaging and Presence [IMP-SRV]
   defines a Presence SRV Protocol Label registry for protocols that can
   provide services that conform to the "_pres" SRV Service label.
   Because XMPP is one such protocol, the IANA registers the "_xmpp"
   protocol label in the appropriate registry, as follows:

   Protocol label:  _xmpp
   Specification:  RFC 3921
   Description:  Presence protocol label for the Extensible Messaging
      and Presence Protocol (XMPP) as defined by RFC 3921.
   Registrant Contact:  IETF, XMPP Working Group, <xmppwg@jabber.org>


13.  References

13.1.  Normative References

   [CPIM]     Peterson, J., "Common Profile for Instant Messaging
              (CPIM)", RFC 3860, August 2004.

   [IMP-REQS]
              Day, M., Aggarwal, S., and J. Vincent, "Instant Messaging
              / Presence Protocol Requirements", RFC 2779,
              February 2000.

   [IMP-SRV]  Peterson, J., "Address Resolution for Instant Messaging
              and Presence", RFC 3861, August 2004.

   [SRV]      Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR for
              specifying the location of services (DNS SRV)", RFC 2782,
              February 2000.

   [TERMS]    Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [UUID]     Leach, P., Mealling, M., and R. Salz, "A Universally
              Unique IDentifier (UUID) URN Namespace", RFC 4122,
              July 2005.

   [XML]      Bray, T., Paoli, J., Sperberg-McQueen, C., and E. Maler,
              "Extensible Markup Language (XML) 1.0 (2nd ed)", W3C REC-
              xml, October 2000, <http://www.w3.org/TR/REC-xml>.

   [XML-NAMES]
              Bray, T., Hollander, D., and A. Layman, "Namespaces in
              XML", W3C REC-xml-names, January 1999,



Saint-Andre             Expires October 19, 2007               [Page 39]

Internet-Draft                   XMPP IM                      April 2007


              <http://www.w3.org/TR/REC-xml-names>.

   [XMPP-CORE]
              Saint-Andre, P., "Extensible Messaging and Presence
              Protocol (XMPP): Core", draft-saintandre-rfc3920bis-02
              (work in progress), April 2007.

   [XMPP-E2E]
              Saint-Andre, P., "End-to-End Signing and Object Encryption
              for the Extensible Messaging and Presence Protocol
              (XMPP)", RFC 3923, October 2004.

13.2.  Informative References

   [IMP-MODEL]
              Day, M., Rosenberg, J., and H. Sugano, "A Model  xa -- The entity or resource is away for
              Presence and Instant Messaging", RFC 2778, February 2000.

   [IRC]      Kalt, C., "Internet Relay Chat: Architecture", RFC 2810,
              April 2000.

   [XEP-0016]
              Millard, P. and P. Saint-Andre, "Privacy Lists", XSF
              XEP 0016, February 2007.

   [XEP-0045]
              Saint-Andre, P., "Multi-User Chat", XSF XEP 0045,
              April 2007.

   [XEP-0054]
              Saint-Andre, P., "vcard-temp", XSF XEP 0054, March 2003.

   [XEP-0191]
              Saint-Andre, P., "Simple Communications Blocking", XSF
              XEP 0191, February 2007.

   [VCARD]    Dawson, F. an extended period (xa =
      "eXtended Away").

   If no <show/> element is provided, the entity is assumed to be online
   and T. Howes, "vCard MIME Directory Profile",
              RFC 2426, September 1998.


Appendix A.  Integration available.

   <presence>
     <show>dnd</show>
   </presence>

4.7.2.2.  Status

   The OPTIONAL <status/> element contains XML character data specifying
   a natural-language description of Roster Management and Presence Subscriptions

   This Appendix provides an entity's availability.  It is
   normally used in conjunction with the show element to provide a
   detailed description of how roster
   management and presence subscriptions are integrated in XMPP-based
   instant messaging and an availability state (e.g., "In a meeting")
   when the presence applications, mainly for stanza has no 'type' attribute.

   <presence from='romeo@example.net/orchard'
             xml:lang='en'>
     <show>dnd</show>
     <status>Wooing Juliet</status>
   </presence>

   The <status/> element MUST NOT possess any attributes, with the benefit
   exception of server developers (most the 'xml:lang' attribute.  Multiple instances of the
   <status/> element MAY be included, but only if each instance
   possesses an 'xml:lang' attribute with a distinct language value
   (either explicitly or by inheritance from the 'xml:lang' value of an
   element farther up in the XML hierarchy, which may include the XML
   stream header as described in [XMPP-CORE]).

   <presence from='romeo@example.net/orchard'
             xml:lang='en'>
     <show>dnd</show>
     <status>Wooing Juliet</status>
     <status xml:lang='cs'>Dvo&#x0159;&#x00ED;m se Julii</status>
   </presence>

   A presence stanza of type "unavailable" MAY also include a <status/>
   element to provide detailed information about why the complexity specified here can be
   safely ignored by client developers). entity is going
   offline.



Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 40] 39]

Internet-Draft                   XMPP IM                      April                       July 2007


A.1.  Overview

   Some level of integration between roster items and presence
   subscriptions is normally expected by an instant messaging user
   regarding the user's subscriptions to and from other contacts.  This
   section describes the level of integration that MUST


   <presence from='romeo@example.net/orchard'
             type='unavailable'>
     <status>Busy IRL</status>
   </presence>

   The <status/> child MAY also be supported
   within XMPP instant messaging applications.

   There are four primary subscription states:

   o  None -- the user does not have sent in a subscription to the contact's subscription-related
   presence information, and the contact does not have a subscription stanza (i.e., type "subscribe", "subscribed", "unsubscribe",
   or "unsubscribed") to the user's presence information
   o  To -- the user has provide a subscription to the contact's presence
      information, but description of the contact does not have a subscription action.  The
   receiving client MAY present this <status/> to the
      user's presence information
   o  From -- the contact has a subscription to the user's presence
      information, but the human user does not have a subscription (see
   Section 11).

   <presence from='romeo@example.net'
             to='nurse@example.com'
             type='subscribe'>
     <status>Hi, Juliet said I should add you to my buddy list.</status>
   </presence>

4.7.2.3.  Priority

   The OPTIONAL <priority/> element contains non-human-readable XML
   character data that specifies the
      contact's priority level of the resource.
   The value MUST be an integer between -128 and +127.  A presence information
   o  Both -- both
   stanza MUST NOT contain more than one <priority/> element.  The
   <priority/> element MUST NOT possess any attributes.

   <presence xml:lang='en'>
     <show>dnd</show>
     <status>Wooing Juliet</status>
     <status xml:lang='cs'>Dvo&#x0159;&#x00ED;m se Julii</status>
     <priority>1</priority>
   </presence>

   If no priority is provided, the user and processing server or client SHOULD
   consider the contact have subscriptions priority to each
      other's presence be zero.

   For information (i.e., the union of 'from' and 'to')

   Each of these states is reflected in the roster of both the user and regarding the contact, thus resulting in durable subscription states.
   Narrative explanations semantics of how these subscription states interact with
   roster items in order to complete certain defined use cases are
   provided priority values in the following sub-sections.  Full details regarding
   server stanza
   processing within instant messaging and client handling of all subscription states (including
   pending states between the primary states listed above) is provided
   in Subscription States (Appendix B).

   The server MUST NOT send presence subscription requests or roster
   pushes applications, refer
   to unavailable resources, nor Server Rules for Processing XML Stanzas (Section 8).

4.7.2.4.  Extended Content

   As described in [XMPP-CORE], an XML stanza MAY contain any properly-
   namespaced child element; this applies to available resources that have
   not requested the roster.

   The 'from' and 'to' addresses are OPTIONAL presence stanza as
   well.







Saint-Andre             Expires January 18, 2008               [Page 40]

Internet-Draft                   XMPP IM                       July 2007


   <presence from='romeo@example.net'>
     <c xmlns='http://jabber.org/protocol/caps'
        node='http://psi-im.org/caps'
        ver='0.11'/>
   </presence>

   Any extended content included in roster pushes; if
   included, their values a presence stanza SHOULD be the full JID represent
   aspects of the resource an entity's availability for
   that session.  A communication or provide
   information about communication-related capabilities.


5.  Exchanging Messages

   Once a client MUST acknowledge each roster push has authenticated with a server and bound a resource to
   an IQ
   stanza of type "result" (for the sake of brevity, these stanzas are
   not shown in the following examples but are required by the IQ
   semantics defined XML stream as described in [XMPP-CORE]).

A.2.  User Subscribes [XMPP-CORE], an XMPP server will route
   XML stanzas to Contact

   The process by which and from that client.  One type of stanza that may be
   exchanged is <message/>.  Exchanging messages is a basic use of XMPP
   and is brought about when a user subscribes to generates a contact, including message stanza that is
   addressed to another entity.  As defined under Server Rules for
   Processing XML Stanzas (Section 8), the
   interaction between roster items and subscription states, sender's server is as
   follows.




Saint-Andre             Expires October 19, 2007               [Page 41]

Internet-Draft                   XMPP IM                      April 2007


   1.  In preparation
   responsible for being able delivering the message to render the contact in intended recipient (if
   the user's
       client interface and recipient is on the same server) or for routing the server message to keep track of
   the
       subscription, recipient's server (if the user's recipient is on a different server).
   Thus a message stanza is used to "push" information to another
   entity.

5.1.  Attributes

5.1.1.  To Attribute

   An instant messaging client SHOULD perform a "roster set" for
       the new roster item.  This request consists of sending specify an IQ
       stanza of type='set' containing intended recipient for
   a <query/> element qualified message by providing the 'jabber:iq:roster' namespace, which in turn contains JID of an
       <item/> element that defines entity other than the new roster item; sender in
   the <item/>
       element MUST possess a 'jid' attribute, MAY possess a 'name'
       attribute, MUST NOT possess a 'subscription' attribute, and MAY
       contain one or more <group/> child elements:

   <iq type='set' id='set1'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='contact@example.org'
           name='MyContact'>
         <group>MyBuddies</group>
       </item>
     </query>
   </iq>

   2.  As a result, 'to' attribute of the user's server (1) MUST initiate a roster push
       for <message/> stanza.

   If the new roster item to all available resources associated
       with this user that have requested message is being sent outside the roster, setting context of any existing chat
   session or received message, the
       'subscription' attribute to a value of "none"; and (2) MUST reply
       to the sending resource with an IQ result indicating 'to' address SHOULD be
   of the success form <user@domain> rather than of the roster set:

   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='contact@example.org'
           subscription='none'
           name='MyContact'>
         <group>MyBuddies</group>
       </item>
     </query>
   </iq>

   <iq type='result' id='set1'/>

   3. form
   <user@domain/resource>.

   <message
       from='juliet@example.com/balcony'
       to='romeo@example.net'
       type='chat'
       xml:lang='en'>
     <body>Art thou not Romeo, and a Montague?</body>
   </message>

   If the user wants to request a subscription message is being sent in reply to the contact's
       presence information, the user's client MUST send a presence
       stanza of type='subscribe' to the contact:

   <presence to='contact@example.org' type='subscribe'/> message previously



Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 42] 41]

Internet-Draft                   XMPP IM                      April                       July 2007


   4.  As a result, the user's server MUST initiate a second roster push
       to all


   received from an address of the user's interested resources, setting form <user@domain/resource> (e.g.,
   within the contact to context of a chat session), the pending sub-state value of the 'none' subscription state; this
       pending sub-state is denoted by 'to' address
   SHOULD be of the inclusion form <user@domain/resource> rather than of the
       ask='subscribe' attribute in form
   <user@domain> unless the roster item:

   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='contact@example.org'
           subscription='none'
           ask='subscribe'
           name='MyContact'>
         <group>MyBuddies</group>
       </item>
     </query>
   </iq>

       Note: If sender has knowledge (via presence) that the user did not create a roster item before sending
   intended recipient's resource is no longer available.

   <message
       from='romeo@example.net/orchard'
       to='juliet@example.com/balcony'
       type='chat'
       xml:lang='en'>
     <body>Neither, fair saint, if either thee dislike.</body>
   </message>

5.1.2.  Type Attribute

   Common uses of the
       subscription request, message stanza in instant messaging applications
   include single messages, messages sent in the server MUST now create one on behalf context of
       the user, then send a roster push to all chat
   conversation, messages sent in the context of a multi-user chat room,
   headlines and other alerts, and errors.  These uses are
   differentiated via the user's interested
       resources, absent 'type' attribute.  Inclusion of the 'name' 'type'
   attribute and is RECOMMENDED.  If included, the <group/> child
       shown above.
   5.  The user's server 'type' attribute MUST also stamp the presence stanza
   have one of type
       "subscribe" with the user's bare JID (i.e., <user@example.com>)
       as the 'from' address (if following values:

   o  chat -- The message is sent in the user provided context of a 'from' address set
       to the user's full JID, the server one-to-one chat
      conversation.  A receiving client SHOULD remove present the resource
       identifier).  If message in an
      interface enabling one-to-one chat between the contact two parties,
      including an appropriate conversation history.
   o  error -- The message is served generated by by an entity that experiences
      an error in processing a different host than message received from another entity (for
      details regarding stanza error syntax, see [XMPP-CORE]).  A client
      that receives a message of type "error" SHOULD present an
      appropriate interface informing the user, sender of the user's server MUST route nature of the presence stanza to
      error.
   o  groupchat -- The message is sent in the
       contact's server for delivery context of a multi-user
      chat environment (similar to that of [IRC]).  A receiving client
      SHOULD present the contact (this case is
       assumed throughout; however, if message in an interface enabling many-to-many
      chat between the contact parties, including a roster of parties in the
      chatroom and an appropriate conversation history.  Full definition
      of XMPP-based groupchat protocols is out of scope for this
      document (for details, see [XEP-0045]).
   o  headline -- The message is served probably generated by an automated
      service that delivers or broadcasts content (news, sports, market
      information, syndicated content, alerts, etc.) or the same
       host, then the server can simply deliver the presence stanza
       directly):

   <presence
       from='user@example.com'
       to='contact@example.org'
       type='subscribe'/>

       Note: If the user's server receives a presence stanza of type
       "error" from sender
      wishes the contact's server, message to be delivered as if it MUST deliver the error
       stanza were.  No reply to the user, whose
      message is expected, and a receiving client MAY determine that SHOULD present the error is
      message in response to the outgoing presence stanza of type "subscribe"
       it sent previously (e.g., by tracking an 'id' attribute) and then
       choose to resend interface that appropriately differentiates the "subscribe" request
      message from standalone messages, chat sessions, or revert the roster to
       its previous state by sending a presence stanza of type
       "unsubscribe" to the contact. groupchat



Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 43] 42]

Internet-Draft                   XMPP IM                      April                       July 2007


   6.  Upon receiving the presence stanza of type "subscribe" addressed
       to the contact, the contact's server MUST determine if there is
       at least one available resource from which the contact has
       requested the roster.  If so, it MUST deliver the subscription
       request to the contact (if not, the contact's server MUST store
       the subscription request offline for delivery when this condition
       is next met; normally this is done


      sessions (e.g., by adding a roster item for
       the contact to not providing the user's roster, recipient with a state of "None + Pending
       In" as defined under Subscription States (Appendix B), however a the ability to
      reply).  The receiving server SHOULD NOT push or deliver roster items in that state to
       the contact).  No matter when the subscription request is
       delivered, the contact must decide whether or not to approve it
       (subject to the contact's configured preferences, the contact's
       client MAY approve or refuse the subscription request without
       presenting it message to all of
      the contact).  Here we assume the "happy path" recipient's available resources.
   o  normal -- The message is a single message that is sent outside the contact approves the subscription request (the alternate
       flow
      context of declining the subscription request a one-to-one conversation or groupchat, and to which it
      is defined in
       Appendix A.2.1).  In this case, expected that the contact's recipient will reply.  A receiving client (1)
      SHOULD
       perform a roster set specifying present the desired handle and group for message in an interface enabling the user (if any); and (2) MUST send a presence stanza of type
       "subscribed" recipient
      to reply, but without a conversation history.  This is the user in order to approve default
      value of the subscription
       request.

   <iq type='set' id='set2'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='user@example.com'
           name='SomeUser'>
         <group>SomeGroup</group>
       </item>
     </query>
   </iq>

   <presence to='user@example.com' type='subscribed'/>

   7.  As a result, 'type' attribute.

   An IM application SHOULD support all of the contact's server (1) MUST initiate foregoing message types.
   If an application receives a roster push
       to all available resources associated message with no 'type' attribute or the contact that have
       requested the roster, containing a roster item for
   application does not understand the user with value of the subscription state set to 'from' (the server 'type' attribute
   provided, it MUST send this
       even if consider the contact did not perform a roster set); (2) MUST
       return an IQ result message to be of type "normal" (i.e.,
   "normal" is the sending resource indicating default).

   Although the
       success of 'type' attribute is OPTIONAL, it is considered polite to
   mirror the roster set; (3) MUST route type in any replies to a message; furthermore, some
   specialized applications (e.g., a multi-user chat service) MAY at
   their discretion enforce the presence use of a particular message type (e.g.,
   type='groupchat').

5.2.  Child Elements

   An XMPP message stanza MAY contain any allowable child elements
   qualified by the 'jabber:client' (or 'jabber:server') namespace, as
   well as any other properly-namespaced child element that consists of
       type "subscribed" to
   extended content.  The defined payloads are described in the user, first stamping
   following sections and extended content payloads are described in the 'from' address
       as
   appropriate XMPP extension specifications (not herein).

5.2.1.  Body

   The <body/> element contains human-readable XML character data that
   specifies the bare JID (<contact@example.org>) textual contents of the contact; and (4) message; this child element is
   normally included but is OPTIONAL.

   <message
       to='romeo@example.net'
       from='juliet@example.com/balcony'
       type='chat'
       xml:lang='en'>
     <body>Wherefore art thou, Romeo?</body>
   </message>

   The <body/> element MUST send available presence from all NOT possess any attributes, with the
   exception of the contact's available
       resources to 'xml:lang' attribute.  Multiple instances of the user:
   <body/> element MAY be included in a message stanza, but only if each



Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 44] 43]

Internet-Draft                   XMPP IM                      April                       July 2007


   <iq type='set' to='contact@example.org/resource'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='user@example.com'
           subscription='from'
           name='SomeUser'>
         <group>SomeGroup</group>
       </item>
     </query>
   </iq>

   <iq type='result' to='contact@example.org/resource' id='set2'/>

   <presence
       from='contact@example.org'
       to='user@example.com'
       type='subscribed'/>

   <presence
       from='contact@example.org/resource'
       to='user@example.com'/>

       Note: If the contact's server receives


   instance possesses an 'xml:lang' attribute with a presence stanza of type
       "error" distinct language
   value (either explicitly or by inheritance from the user's server, it MUST deliver the error stanza
       to the contact, whose client MAY determine that the error is in
       response to the outgoing presence stanza 'xml:lang' value
   of type "subscribed" it
       sent previously (e.g., by tracking an 'id' attribute) and then
       choose to resend element farther up in the "subscribed" notification or revert XML hierarchy, which may include the
       roster to its previous state by sending a presence stanza
   XML stream header as described in [XMPP-CORE]).

   <message
       to='romeo@example.net'
       from='juliet@example.com/balcony'
       type='chat'
       xml:lang='en'>
     <body>Wherefore art thou, Romeo?</body>
     <body xml:lang='cs'>Pro&#x010D;e&#x017D; jsi ty, Romeo?</body>
   </message>

   The <body/> element MUST NOT contain mixed content (as defined in
   Section 3.2.2 of [XML]).

5.2.2.  Subject

   The <subject/> element contains human-readable XML character data
   that specifies the topic of type
       "unsubscribed" to the user.
   8.  Upon receiving message.

   <message
       to='romeo@example.net'
       from='juliet@example.com/balcony'
       type='chat'
       xml:lang='en'>
     <subject>I implore you!</subject>
     <body>Wherefore art thou, Romeo?</body>
   </message>

   The <subject/> element MUST NOT possess any attributes, with the presence stanza
   exception of type "subscribed" addressed
       to the user, the user's server MUST first verify that 'xml:lang' attribute.  Multiple instances of the contact
       is in
   <subject/> element MAY be included for the user's roster with either purpose of providing
   alternate versions of the following states: (a)
       subscription='none' and ask='subscribe' same subject, but only if each instance
   possesses an 'xml:lang' attribute with a distinct language value
   (either explicitly or (b)
       subscription='from' and ask='subscribe'.  If by inheritance from the contact is not 'xml:lang' value of an
   element farther up in the user's roster with either of those states, XML hierarchy, which may include the user's
       server XML
   stream header as described in [XMPP-CORE]).












Saint-Andre             Expires January 18, 2008               [Page 44]

Internet-Draft                   XMPP IM                       July 2007


   <message
       to='romeo@example.net'
       from='juliet@example.com/balcony'
       type='chat'
       xml:lang='en'>
     <subject>I implore you!</subject>
     <subject xml:lang='cs'>
       &#x00DA;p&#x011B;nliv&#x011B; pros&#x00EDm!
     </subject>
     <body>Wherefore art thou, Romeo?</body>
     <body xml:lang='cs'>Pro&#x010D;e&#x017E; jsi ty, Romeo?</body>
   </message>

   The <subject/> element MUST silently ignore NOT contain mixed content (as defined in
   Section 3.2.2 of [XML]).

5.2.3.  Thread

   The primary use of the presence stanza XMPP <thread/> element is to uniquely identify
   a conversation thread or "chat session" between two entities
   instantiated by <message/> stanzas of type
       "subscribed" (i.e., it MUST NOT route it to the user, modify 'chat'.  However, the
       user's roster, or generate a roster push XMPP
   <thread/> element may also be used to the user's available
       resources).  If the contact is uniquely identify an analogous
   thread between two entities instantiated by <message/> stanzas of
   type 'headline' or 'normal', or among multiple entities in the user's roster with either
   context of those states, the user's server (1) MUST deliver the presence
       stanza a multi-user chat room instantiated by <message/> stanzas
   of type "subscribed" from the contact 'groupchat'.  It may also be used for <message/> stanzas not
   related to a conversation, such as a game session or between plugins.

   The value of the user; (2) <thread/> element MUST initiate be a roster push to all universally unique
   identifier (UUID) as described in [UUID].

   The use of the user's interested
       resources, containing an updated roster item for the contact with
       the 'subscription' attribute set <thread/> element is OPTIONAL.  The <thread/> element
   is not used to a identify individual messages, only conversations.  A
   message stanza MUST NOT contain more than one <thread/> element.  The
   <thread/> element MUST NOT possess any attributes.  The value of "to"; and (3) MUST
       deliver the available presence stanza received
   <thread/> element MUST be treated as opaque by entities; no semantic
   meaning may be derived from each it, and only exact comparisons may be
   made against it.  The <thread/> element MUST NOT contain mixed
   content (as defined in Section 3.2.2 of the
       contact's available resources [XML]).

5.3.  Extended Content

   As described in [XMPP-CORE], an XML stanza MAY contain any properly-
   namespaced child element; this applies to each of the user's available
       resources: message stanza as well.







Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 45]

Internet-Draft                   XMPP IM                      April                       July 2007


   <presence
       to='user@example.com'
       from='contact@example.org'
       type='subscribed'/>

   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='contact@example.org'
           subscription='to'
           name='MyContact'>
         <group>MyBuddies</group>
       </item>
     </query>
   </iq>

   <presence
       from='contact@example.org/resource'
       to='user@example.com/resource'/>

   From the perspective of the user, there now exists a subscription to
   the contact's presence information; from the perspective of the
   contact, there now exists


   <message
       to='romeo@example.net'
       from='juliet@example.com/balcony'
       type='chat'
       xml:lang='en'>
     <body>Wherefore art thou, Romeo?</body>
     <html xmlns='http://jabber.org/protocol/xhtml-im'>
       <body xmlns='http://www.w3.org/1999/xhtml'>
         Wherefore <span style='font-style: italic'>art</span>
         thou, <span style='color:red'>Romeo</span>?
       </body>
     </html>
   </message>


6.  Exchanging IQ Stanzas

   As described in [XMPP-CORE], IQ stanzas provide a subscription from the user.

A.2.1.  Alternate Flow: Contact Declines Subscription Request

   The above activity flow represents the "happy path" regarding the
   user's subscription request to the contact. structured request-
   response mechanism.  The main alternate flow
   occurs if the contact refuses basic semantics of that mechanism (e.g.,
   that the user's subscription request, as
   follows:

   1.  If 'id' attribute is required) are defined in [XMPP-CORE],
   whereas the contact wants specific semantics required to refuse complete particular use
   cases are defined in all cases by the request, extended namespace that
   qualifies the contact's client
       MUST send a presence direct child element of an IQ stanza of type "unsubscribed" to the user
       (instead "get" or
   "set".  The 'jabber:client' and 'jabber:server' namespaces do not
   define any children of IQ stanzas other than the presence <error/> common to
   all stanza of type "subscribed" sent types.  This document defines one such extended namespace,
   for Managing the Roster (Section 2).  However, an IQ stanza MAY
   contain structured information qualified by any extended namespace.


7.  A Sample Session

   The examples in Step
       6 of Appendix A.2):

   <presence to='user@example.com' type='unsubscribed'/>

   2.  As this section illustrate a result, the contact's server MUST route the possible instant messaging
   and presence stanza
       of type "unsubscribed" to the user, first stamping the 'from'
       address as the bare JID (<contact@example.org>) of the contact:

   <presence
       from='contact@example.org'
       to='user@example.com'
       type='unsubscribed'/>

       Note: If session.  The user is romeo@example.net, he has an
   available resource whose resource identifier is "orchard", and he has
   the contact's server previously added following individuals in his roster:

   o  juliet@example.com (subscription="both" and she has two available
      resources, one whose resource identifier is "chamber" and another
      whose resource identifier is "balcony")
   o  benvolio@example.org (subscription="to")
   o  mercutio@example.org (subscription="from")

   First, the user to completes the preconditions (stream establishment,
   TLS and SASL negotiation, and resource binding) described in
   [XMPP-CORE]; those packet flows are not reproduced here.

   Next, the user requests his roster:



Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 46]

Internet-Draft                   XMPP IM                      April                       July 2007


       contact's roster for tracking purposes, it MUST remove the
       relevant item at this time.
   3.  Upon receiving the presence stanza of type "unsubscribed"
       addressed to the user, the user's server (1) MUST deliver that
       presence stanza to the user and (2) MUST initiate a


   Example 1: User requests current roster push
       to all of the user's interested resources, containing an updated from server:

   UC: <iq from='romeo@example.net/balcony' type='get' id='ex1'>
         <query xmlns='jabber:iq:roster'/>
       </iq>

   Example 2: User receives roster item for the contact with the 'subscription' attribute set
       to a value of "none" and with no 'ask' attribute:

   <presence
       from='contact@example.org'
       to='user@example.com'
       type='unsubscribed'/> from server:

   US: <iq type='set'> to='romeo@example.net/balcony' type='result' id='ex1'>
         <query xmlns='jabber:iq:roster'>
           <item
           jid='contact@example.org'
           subscription='none'
           name='MyContact'>
         <group>MyBuddies</group> jid='romeo@example.com'
                 name='Juliet'
                 subscription='both'>
             <group>Friends</group>
           </item>
           <item jid='benvolio@example.org'
                 name='Benvolio'
                 subscription='to'/>
           <item jid='mercutio@example.org'
                 name='Mercutio'
                 subscription='from'/>
         </query>
       </iq>

   As a result of this activity, the contact is now in the user's roster
   with a subscription state of "none", whereas

   Now the user is not in the
   contact's roster at all.

A.3.  Creating begins a Mutual Subscription

   The user presence session.

   Example 3: User sends initial presence:

   UC: <presence from='romeo@example.net/orchard'/>

   Example 4: User's server sends presence probes to contacts with
   subscription="to" and contact can build subscription="both" on the "happy path" described above to
   create a mutual subscription (i.e., a subscription behalf of type "both").
   The process is as follows:

   1.  If the contact wants to create a mutual subscription, the contact
       MUST send a subscription request user's
   available resource:

   US: <presence
           type='probe'
           from='romeo@example.net/orchard'
           to='juliet@example.com'/>

   US: <presence
           type='probe'
           from='romeo@example.net/orchard'
           to='benvolio@example.org'/>








Saint-Andre             Expires January 18, 2008               [Page 47]

Internet-Draft                   XMPP IM                       July 2007


   Example 5: User's server sends initial presence to contacts with
   subscription="from" and subscription="both" on behalf of the user (subject user's
   available resource:

   US: <presence
           from='romeo@example.net/orchard'
           to='juliet@example.com'/>

   US: <presence
           from='romeo@example.net/orchard'
           to='mercutio@example.org'/>

   Example 6: Contacts' servers reply to the
       contact's configured preferences, the contact's client MAY send
       this automatically): presence probe on behalf of all
   available resources:

   CS: <presence to='user@example.com' type='subscribe'/>

   2.  As a result, the contact's server (1) MUST initiate a roster push
           from='juliet@example.com/balcony'
           to='romeo@example.net/orchard'
           xml:lang='en'>
         <show>away</show>
         <status>be right back</status>
         <priority>0</priority>
       </presence>

   CS: <presence
           from='juliet@example.com/chamber'
           to='romeo@example.net/orchard'>
         <priority>1</priority>
       </presence>

   CS: <presence
           from='benvolio@example.org/pda'
           to='romeo@example.net/orchard'
           xml:lang='en'>
         <show>dnd</show>
         <status>gallivanting</status>
       </presence>














Saint-Andre             Expires January 18, 2008               [Page 48]

Internet-Draft                   XMPP IM                       July 2007


   Example 7: Contacts' servers deliver user's initial presence to all
   available resources associated with the contact that have
       requested the roster, with the or return unsubscribed to user:

   CS: <presence
           from='romeo@example.net/orchard'
           to='juliet@example.com'/>

   CS: <presence
           from='romeo@example.net/orchard'
           to='juliet@example.com'/>

   CS: <presence
           from='mercutio@example.org'
           to='romeo@example.net'
           type='unsubscribed'/>

   Example 8: User sends directed presence to another user still not in his
   roster:

   UC: <presence
           from='romeo@example.net/orchard'
           to='nurse@example.com'
           xml:lang='en'>
         <show>dnd</show>
         <status>courting Juliet</status>
         <priority>0</priority>
       </presence>

   Now the 'from'
       subscription state but with user has a pending 'to' subscription denoted
       by the inclusion threaded conversation (chat session) with one of the ask='subscribe' attribute in the roster
       item;
   his contacts.





















Saint-Andre             Expires January 18, 2008               [Page 49]

Internet-Draft                   XMPP IM                       July 2007


   Example 9: A threaded conversation

   CC: <message
           from='juliet@example.com/balcony'
           to='romeo@example.net'
           type='chat'
           xml:lang='en'>
         <body>Art thou not Romeo, and (2) MUST route the a Montague?</body>
         <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread>
       </message>

   UC: <message
           from='romeo@example.net/orchard'
           to='juliet@example.com/balcony'
           type='chat'
           xml:lang='en'>
         <body>Neither, fair saint, if either thee dislike.</body>
         <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread>
       </message>

   CC: <message
           from='juliet@example.com/balcony'
           to='romeo@example.net/orchard'
           type='chat'
           xml:lang='en'>
         <body>How cam'st thou hither, tell me, and wherefore?</body>
         <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread>
       </message>

   And so on.

   The user can also send subsequent broadcasted presence.

   Example 10: User sends updated available presence stanza of type "subscribe" information for
   broadcasting:

   UC: <presence xml:lang='en'>
         <show>away</show>
         <status>I shall return!</status>
         <priority>1</priority>
       </presence>










Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 47] 50]

Internet-Draft                   XMPP IM                      April                       July 2007


   Example 11: User's server broadcasts updated presence information
   only to the user, first stamping the 'from' address as the bare JID
       (<contact@example.org>) of the one contact:

   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='user@example.com'
           subscription='from'
           ask='subscribe'
           name='SomeUser'>
         <group>SomeGroup</group>
       </item>
     </query>
   </iq>

   US: <presence
       from='contact@example.org'
       to='user@example.com'
       type='subscribe'/>

       Note: If the contact's
           from='romeo@example.net/orchard'
           to='juliet@example.com'
           xml:lang='en'>
         <show>away</show>
         <status>I shall return!</status>
         <priority>1</priority>
       </presence>

   Example 12: Contact's server receives a presence stanza of type
       "error" from the user's server, it MUST deliver the error stanza
       to the contact, whose client MAY determine that the error is in
       response to the outgoing presence stanza of type "subscribe" it
       sent previously (e.g., by tracking an 'id' attribute) and then
       choose to resend the "subscribe" request or revert the roster to
       its previous state by sending a delivers updated presence stanza of type
       "unsubscribe" information to the user.
   3.  Upon receiving the presence stanza
   all of type "subscribe" addressed
       to the user, the user's server must determine if there is at
       least one contact's available resource for which the user has requested the
       roster.  If so, the user's server MUST deliver the subscription
       request to the user (if not, it MUST store the subscription
       request offline for delivery when this condition is next met).
       No matter when the subscription request is delivered, the user
       must then decide whether or not to approve it (subject to the
       user's configured preferences, the user's client MAY approve or
       refuse the subscription request without presenting it to the
       user).  Here we assume the "happy path" that the user approves
       the subscription request (the alternate flow resources ("balcony" and "chamber"):

   CS: <presence
           from='romeo@example.net/orchard'
           to='juliet@example.com'
           xml:lang='en'>
         <show>away</show>
         <status>I shall return!</status>
         <priority>1</priority>
       </presence>

   CS: <presence
           from='romeo@example.net/orchard'
           to='juliet@example.com'
           xml:lang='en'>
         <show>away</show>
         <status>I shall return!</status>
         <priority>1</priority>
       </presence>

   Example 13: One of declining the
       subscription request is defined in Appendix A.3.1).  In this
       case, the user's client MUST send a contact's resources broadcasts final presence:

   CC: <presence from='juliet@example.com/chamber' type='unavailable'/>

   Example 14: Contact's server sends unavailable presence stanza of type
       "subscribed" to the contact in order information
   to approve the subscription
       request. user:

   CS: <presence to='contact@example.org' type='subscribed'/>
           type='unavailable'
           from='juliet@example.com/chamber'
           to='romeo@example.net'/>







Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 48] 51]

Internet-Draft                   XMPP IM                      April                       July 2007


   4.  As a result, the user's


   Example 15: User sends unavailable presence:

   UC: <presence from='romeo@example.net/orchard'
                 type='unavailable'
                 xml:lang='en'>
         <status>gone home</status>
       </presence>

   Example 16: User's server (1) MUST initiate a roster push broadcasts unavailable presence information
   to
       all of the user's interested resources, containing a roster item
       for the contact with the 'subscription' attribute set as well as to a value
       of "both"; (2) MUST route the presence stanza of type
       "subscribed" person to whom the contact, first stamping the 'from' address as
       the bare JID (<user@example.com>) of the user; and (3) MUST send
       to user sent directed
   presence:

   US: <presence
           type='unavailable'
           from='romeo@example.net/orchard'
           to='juliet@example.com'
           xml:lang='en'>
         <status>gone home</status>
       </presence>

   US: <presence
           type='unavailable'
           from='romeo@example.net/orchard'
           to='nurse@example.com'
           xml:lang='en'>
         <status>gone home</status>
       </presence>

   Now the contact user closes his stream:

   UC: </stream:stream>

   And the full user's server closes its stream as well:

   US: </stream:stream>

   THE END


8.  Server Rules for Processing XML of the last Stanzas

   Basic routing and delivery rules for servers are defined in
   [XMPP-CORE].  This section defines supplementary rules for XMPP
   instant messaging and presence stanza with no
       'to' attribute received by servers; in the server from each absence of a
   supplementary rule defined below (e.g., for stanzas without a 'to'
   address), the user's
       available resources:

   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='contact@example.org'
           subscription='both'
           name='MyContact'>
         <group>MyBuddies</group>
       </item>
     </query>
   </iq>

   <presence
       from='user@example.com'
       to='contact@example.org'
       type='subscribed'/>

   <presence
       from='user@example.com/resource'
       to='contact@example.org'/>

       Note: rule defined in [XMPP-CORE] shall apply.





Saint-Andre             Expires January 18, 2008               [Page 52]

Internet-Draft                   XMPP IM                       July 2007


8.1.  No Such User

   If the user's server receives a presence stanza of type
       "error" from the contact's server, it MUST deliver user account does not exist, how the error stanza to shall be processed
   depends on the user, whose client MAY determine that stanza type.

   o  For a message stanza, the server SHOULD return a <service-
      unavailable/> stanza error is
       in response to the outgoing sender.
   o  For a presence stanza with no 'type' attribute or a 'type'
      attribute of type "subscribed"
       it sent previously (e.g., by tracking an 'id' attribute) and then
       choose to resend "unavailable", the subscription request or revert server SHOULD silently ignore the roster to
       its previous state by sending
      stanza (i.e., not return an error or a presence stanza of type
       "unsubscribed" to the contact.
   5.  Upon receiving the
      "unsubscribed".
   o  For a presence stanza with of type "subscribed" addressed
       to the contact, "subscribe", "subscribed",
      "unsubscribe", or "unsubscribed", the contact's server MUST first verify that the
       user is in the contact's roster with either of the following
       states: (a) subscription='none' and ask='subscribe' or (b)
       subscription='from' and ask='subscribe'.  If the user is not in follow the contact's roster with either of those states,
      guidelines provided under Section 3.
   o  For an IQ stanza, the contact's server MUST silently ignore the presence return a <service-unavailable/>
      stanza of type
       "subscribed" (i.e., it MUST NOT route it error to the contact, modify sender.

8.2.  Full JID at Local Domain

   If the contact's roster, or generate a roster push to hostname of the contact's
       available resources).  If domain identifier portion of the user is JID contained
   in the contact's roster



Saint-Andre             Expires October 19, 2007               [Page 49]

Internet-Draft                   XMPP IM                      April 2007


       with either 'to' attribute of an inbound stanza matches one of the
   configured hostnames of those states, the contact's server (1) MUST
       deliver itself and the JID contained in
   the presence stanza 'to' attribute is of type "subscribed" from the user to form <user@domain/resource>, the contact; (2) server
   MUST initiate a roster push adhere to all available
       resources associated with the contact that have requested the
       roster, containing following rules.

8.2.1.  Available Resource Matches

   If an updated roster item for available resource exactly matches the user with full JID, the
       'subscription' attribute set to a value of "both"; and (3)
   recipient's server MUST deliver the available presence stanza received from each of the
       user's available resources to each of the contact's that resource.

8.2.2.  No Available Resource Matches

   If no connected or available
       resources:

   <presence
       from='user@example.com'
       to='contact@example.org'
       type='subscribed'/>

   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='user@example.com'
           subscription='both'
           name='SomeUser'>
         <group>SomeGroup</group>
       </item>
     </query>
   </iq>

   <presence
       from='user@example.com/resource'
       to='contact@example.org/resource'/>

   The user and resource exactly matches the contact now have a mutual subscription to each
   other's presence -- i.e., full JID,
   how the subscription is of type "both".

A.3.1.  Alternate Flow: User Declines Subscription Request

   The above activity flow represents stanza shall be processed depends on the "happy path" regarding stanza type.

   o  For a message, the
   contact's subscription request to server SHOULD treat the user.  The main alternate flow
   occurs stanza as if the user refuses the contact's subscription request, it were
      addressed to <user@domain> as
   follows:

   1.  If described in the user wants to refuse next section.
   o  For a presence stanza, the request, server SHOULD silently ignore the user's client MUST
       send
      stanza (i.e., neither deliver it nor return an error or a presence
      stanza of type "unsubscribed" "unsubscribe" or "unsubscribed").
   o  For an IQ stanza, the server MUST return a <service-unavailable/>
      stanza error to the contact
       (instead sender.

8.3.  Bare JID at Local Domain

   If the hostname of the presence stanza domain identifier portion of type "subscribed" sent the JID contained
   in Step
       3 the 'to' attribute of Appendix A.3):

   <presence to='contact@example.org' type='unsubscribed'/> an inbound stanza matches one of the
   configured hostnames of the server itself and the JID contained in



Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 50] 53]

Internet-Draft                   XMPP IM                      April                       July 2007


   2.  As a result, the user's server MUST route


   the presence stanza 'to' attribute is of
       type "unsubscribed" to the contact, first stamping form <user@domain>, the 'from'
       address as server MUST
   adhere to the bare JID (<user@example.com>) of following rules.

8.3.1.  Available Resources

   If there is at least one available resource, how the user:

   <presence
       from='user@example.com'
       to='contact@example.org'
       type='unsubscribed'/>

   3.  Upon receiving stanza shall be
   processed depends on the presence stanza type.

8.3.1.1.  Message

   For a message stanza of type "unsubscribed"
       addressed to "headline", the contact, the contact's server (1) MUST SHOULD deliver
       that presence stanza to
   the contact; and (2) MUST initiate a
       roster push stanza to all available resources associated with the
       contact that have requested the roster, containing an updated
       roster item for the user with the 'subscription' attribute set to
       a value of "from" and with no 'ask' attribute:

   <presence
       from='user@example.com'
       to='contact@example.org'
       type='unsubscribed'/>

   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='user@example.com'
           subscription='from'
           name='SomeUser'>
         <group>SomeGroup</group>
       </item>
     </query>
   </iq>

   As resources.

   For a result message stanza of this activity, there has been no change in type "chat", "error", "groupchat", or
   "normal", the
   subscription state; i.e., server SHOULD deliver the contact is in stanza to the user's roster with a
   subscription state of "to" and highest-
   priority available resource.  If two or more available resources have
   the user is in same priority, the contact's roster
   with a subscription state server MAY use some other rule (e.g., most
   recent connect time, most recent activity time, or highest
   availability as determined by some hierarchy of "from".

A.4.  Unsubscribing

   At any time after subscribing <show/> values) to a contact's presence information, a
   user
   choose between them or MAY unsubscribe.  While the XML that deliver the user sends message to make this
   happen is the same in all instances, the subsequent subscription
   state is different depending on the subscription state obtaining when
   the unsubscribe "command" is sent.  Both possible scenarios are
   described in such resources.

   However, for any message type the text that follows.





Saint-Andre             Expires October 19, 2007               [Page 51]

Internet-Draft                   XMPP IM                      April 2007


A.4.1.  Case #1: Unsubscribing When Subscription is Not Mutual

   In server MUST NOT deliver the first case, stanza
   to any available resource with a negative priority; if the user only
   available resource has a subscription to the contact's
   presence information but negative priority, the contact does not have a subscription to server SHOULD handle
   the user's presence information (i.e., message as if there were no available resources as described
   under Section 8.3.2.

   In all cases, the subscription is not yet
   mutual).

   1.  If server MUST NOT rewrite the user wants 'to' attribute (i.e.,
   it MUST leave it as <user@domain> rather than change it to unsubscribe from the contact's
   <user@domain/resource>).

8.3.1.2.  Presence

   For a presence
       information, stanza of type "probe", the user server MUST send handle it
   directly as described under Section 4.3.

   For a presence stanza with no type or of type
       "unsubscribe" to "unavailable", the contact:

   <presence to='contact@example.org' type='unsubscribe'/>

   2.  As
   server MUST deliver the stanza to all available resources.

   For a result, presence stanza of type "subscribe", "subscribed",
   "unsubscribe", or "unsubscribed", the user's server (1) MUST send a roster push adhere to the rules
   defined under Section 3 and summarized under Appendix A.

   In all
       of cases, the user's interested resources, containing server MUST NOT rewrite the 'to' attribute (i.e.,
   it MUST leave it as <user@domain> rather than change it to
   <user@domain/resource>).





Saint-Andre             Expires January 18, 2008               [Page 54]

Internet-Draft                   XMPP IM                       July 2007


8.3.1.3.  IQ

   For an updated roster
       item for IQ stanza, the contact server itself MUST reply on behalf of the user
   with either an IQ result or an IQ error, and MUST NOT deliver the 'subscription' attribute set IQ
   stanza to a
       value any of the user's available resources.  Specifically, if
   the semantics of "none"; and (2) MUST route the presence stanza qualifying namespace define a reply that the
   server can provide on behalf of type
       "unsubscribe" to the contact, first stamping user, the 'from' address
       as server MUST reply to
   the bare JID (<user@example.com>) stanza on behalf of the user:

   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='contact@example.org'
           subscription='none'
           name='MyContact'>
         <group>MyBuddies</group>
       </item>
     </query>
   </iq>

   <presence
       from='user@example.com'
       to='contact@example.org'
       type='unsubscribe'/>

   3.  Upon receiving the presence user by returning either an IQ stanza of
   type "unsubscribe"
       addressed "result" or an IQ stanza of type "error" that is appropriate to
   the contact, original payload; if not, the contact's server (1) MUST initiate reply with a roster push to all <service-
   unavailable/> stanza error.

8.3.2.  No Available Resources

   If there are no available resources associated with the
       contact that have requested the roster, containing an updated
       roster item for user, how the user with
   stanza shall be processed depends on the 'subscription' attribute set to stanza type.

8.3.2.1.  Message

   For a value of "none" (if the contact is unavailable or has not
       requested the roster, message stanza, the contact's server MUST modify MAY choose to store the roster
       item stanza on
   behalf of the user and send that modified item deliver it when the user next time the contact
       requests becomes
   available, or forward the roster); and (2) MUST deliver message to the "unsubscribe"
       state change notification user via some other means
   (e.g., to the contact:





Saint-Andre             Expires October 19, 2007               [Page 52]

Internet-Draft                   XMPP IM                      April 2007


   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='user@example.com'
           subscription='none'
           name='SomeUser'>
         <group>SomeGroup</group>
       </item>
     </query>
   </iq>

   <presence
       from='user@example.com'
       to='contact@example.org'
       type='unsubscribe'/>

   4.  The contact's user's email account).  However, if offline message
   storage or message forwarding is not enabled, the server then (1) MUST send return
   to the sender a <service-unavailable/> stanza error.  (Note: Offline
   message storage and message forwarding are not defined in XMPP, since
   they are strictly a matter of implementation and service
   provisioning.)

8.3.2.2.  Presence

   For a presence stanza with no type or of type
       "unsubscribed" to "unavailable" or
   "probe", the user; and (2) server SHOULD send unavailable
       presence from all of silently ignore the contact's available resources stanza by not storing
   it for later delivery or replying to it on behalf of the
       user:

   <presence
       from='contact@example.org'
       to='user@example.com'
       type='unsubscribed'/>

   <presence
       from='contact@example.org/resource'
       to='user@example.com'
       type='unavailable'/>

   5.  When the user's server receives the user.

   For a presence stanzas stanza of type
       "unsubscribed" and "unavailable", it "subscribe", "subscribed",
   "unsubscribe", or "unsubscribed", the server MUST deliver them adhere to the
       user:

   <presence
       from='contact@example.org'
       to='user@example.com'
       type='unsubscribed'/>

   <presence
       from='contact@example.org/resource'
       to='user@example.com'
       type='unavailable'/>







Saint-Andre             Expires October 19, 2007               [Page 53]

Internet-Draft                   XMPP IM                      April 2007


A.4.2.  Case #2: Unsubscribing When Subscription is Mutual

   In rules
   defined under Section 3 and summarized under Appendix A.

8.3.2.3.  IQ

   For an IQ stanza, the second case, server itself MUST reply on behalf of the user has a subscription to the contact's
   presence information
   with either an IQ result or an IQ error, and MUST NOT deliver the contact also has a subscription IQ
   stanza to the
   user's presence information (i.e., the subscription is mutual).

   1.  If the user wants to unsubscribe from available resources.  Specifically, if the contact's presence
       information, semantics of
   the user MUST send qualifying namespace define a presence stanza reply that the server can provide
   on behalf of type
       "unsubscribe" to the contact:

   <presence to='contact@example.org' type='unsubscribe'/>

   2.  As a result, user, the user's server (1) MUST send a roster push reply to all the stanza on behalf
   of the user's interested resources, containing user by returning either an updated roster
       item for the contact with the 'subscription' attribute set to a
       value IQ stanza of "from"; and (2) MUST route type "result" or an
   IQ stanza of type "error" that is appropriate to the original



Saint-Andre             Expires January 18, 2008               [Page 55]

Internet-Draft                   XMPP IM                       July 2007


   payload; if not, the presence server MUST reply with a <service-unavailable/>
   stanza error.

8.4.  Foreign Domain

   If the hostname of type
       "unsubscribe" to the contact, first stamping domain identifier portion of the 'from' address
       as
   contained in the bare JID (<user@example.com>) 'to' attribute of the user:

   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='contact@example.org'
           subscription='from'
           name='MyContact'>
         <group>MyBuddies</group>
       </item>
     </query>
   </iq>

   <presence
       from='user@example.com'
       to='contact@example.org'
       type='unsubscribe'/>

   3.  Upon receiving the presence an outbound stanza does not match
   a configured hostname of type "unsubscribe"
       addressed to the contact, server itself, the contact's server (1) MUST initiate
       a roster push attempt
   to all available resources associated with route the
       contact that have requested stanza to the roster, containing foreign domain.  If there exists an updated
       roster item for active
   stream between the user with two peers, the 'subscription' attribute set to
       a value of "to" (if server shall route the contact is unavailable or has not
       requested stanza over
   that stream for processing by the roster, peer server.  If not, the contact's server
   MUST modify the roster
       item and send that modified item do the next time following.

   First, resolve the contact
       requests hostname of the roster); and (2) MUST deliver foreign domain (or used a cached
   resolution of the "unsubscribe"
       state change notification foreign domain to the contact:






Saint-Andre             Expires October 19, 2007               [Page 54]

Internet-Draft                   XMPP IM                      April 2007


   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='user@example.com'
           subscription='to'
           name='SomeUser'>
         <group>SomeGroup</group>
       </item>
     </query>
   </iq>

   <presence
       from='user@example.com'
       to='contact@example.org'
       type='unsubscribe'/>

   4. an IP address).  The contact's server then (1) MUST send a presence stanza recommended
   order of type
       "unsubscribed" attempted resolutions is as follows:

   1.  Attempt to resolve the user; foreign hostname using a DNS [SRV] Service
       of "xmpp-server" and (2) SHOULD send unavailable
       presence from all Proto of "tcp", resulting in resource
       records such as "_xmpp-server._tcp.example.com.", as specified in
       [XMPP-CORE].
   2.  If the contact's available resources to the
       user:

   <presence
       from='contact@example.org'
       to='user@example.com'
       type='unsubscribed'/>

   <presence
       from='contact@example.org/resource'
       to='user@example.com'
       type='unavailable'/>

   5.  When "xmpp-server" address record resolution fails, attempt to
       resolve the user's server receives "_im" or "_pres" [SRV] Service as specified in
       [IMP-SRV], using the presence "_im" Service for <message/> stanzas of type
       "unsubscribed" and "unavailable", it MUST deliver them the
       "_pres" Service for <presence/> stanzas (it is up to the
       user:

   <presence
       from='contact@example.org'
       to='user@example.com'
       type='unsubscribed'/>

   <presence
       from='contact@example.org/resource'
       to='user@example.com'
       type='unavailable'/>

   Note: Obviously this does not
       implementation how to handle <iq/> stanzas).  This will result in removal
       one or more resolutions of the roster item
   from form "_im.<proto>.example.com." or
       "_pres.<proto>.example.com.", where "<proto>" would be a label
       registered in the user's roster, and Instant Messaging SRV Protocol Label registry
       or the contact still has Presence SRV Protocol Label registry: either "_xmpp" for
       an XMPP-aware domain or some other IANA-registered label (e.g.,
       "_simple") for a subscription to
   the user's presence information.  In order to non-XMPP-aware domain.
   3.  If both completely cancel



Saint-Andre             Expires October 19, 2007               [Page 55]

Internet-Draft                   XMPP IM                      April 2007 SRV address record resolutions fail, attempt to perform a mutual subscription and fully remove the roster item from the
   user's roster,
       normal IPv4/IPv6 address record resolution to determine the user SHOULD update IP
       address using the roster item "xmpp-server" port of 5269 registered with
   subscription='remove' the
       IANA, as defined under Removing a Roster Item specified in [XMPP-CORE].

   Note: Administrators of server deployments are strongly encouraged to
   keep the _im._xmpp, _pres._xmpp, and
   Cancelling All Subscriptions (Appendix A.6).

A.5.  Cancelling a Subscription

   At any time after approving a subscription request from a user, a
   contact MAY cancel that subscription.  While _xmpp._tcp SRV records properly
   synchronized, since different implementations might perform the XML that "_im"
   and "_pres" lookups before the contact
   sends to make this happen is "xmpp-server" lookup.  If the foreign
   domain cannot be resolved, the server SHOULD return a <remote-server-
   not-found/> stanza error.

   Second, negotiate XML streams with the same foreign domain by following
   the process defined in all instances, [XMPP-CORE].  If the
   subsequent subscription state is different depending on server cannot establish
   streams with the
   subscription state obtaining when foreign domain, it SHOULD return a <remote-server-
   timeout/> stanza error.



Saint-Andre             Expires January 18, 2008               [Page 56]

Internet-Draft                   XMPP IM                       July 2007


   Third, route the cancellation was sent.  Both
   possible scenarios are described in stanza to the text that follows.

A.5.1.  Case #1: Cancelling When Subscription is Not Mutual

   In foreign domain for processing by the first case,
   peer server.


9.  IM and Presence Compliance Requirements

   This section summarizes the user has a subscription specific aspects of the Extensible
   Messaging and Presence Protocol that MUST be supported by instant
   messaging and presence servers and clients in order to be considered
   compliant implementations.  All such applications MUST comply with
   the contact's requirements specified in [XMPP-CORE].  The text in this section
   specifies additional compliance requirements for instant messaging
   and presence information servers and clients (the requirements described here
   supplement but the contact does do not have a subscription to supersede the user's core requirements).

   Note: A server or client MAY support only presence information (i.e., the subscription or instant
   messaging, and is not yet
   mutual).

   1.  If the contact wants required to support both if only a presence
   service or an instant messaging service is desired.

9.1.  Servers

   In addition to core server compliance requirements, an instant
   messaging and presence server MUST additionally support all server-
   related instant messaging and presence syntax and semantics defined
   in this document, including:

   o  Presence broadcast on behalf of clients as specified under
      Section 4
   o  Presence subscriptions as specified under Section 3
   o  Roster storage and management as specified under Section 2
   o  IM-specific routing and delivery rules as specified under
      Section 8

9.2.  Clients

   In addition to cancel the user's subscription, the
       contact MUST send a core client compliance requirements, an instant
   messaging and presence stanza of type "unsubscribed" to the
       user:

   <presence to='user@example.com' type='unsubscribed'/>

   2.  As a result, the contact's server (1) client MUST send a roster push to
       all additionally support the following
   protocols:

   o  Generation and processing of the contact's interested resources, containing an updated
       roster item for IM-specific semantics of XML
      stanzas as defined by the user with XML schemas, including the 'subscription' 'type'
      attribute set to
       a value of "none"; (2) MUST route the message and presence stanza of type
       "unsubscribed" to the user, first stamping the 'from' address stanzas as
       the bare JID (<contact@example.org>) of the contact; well as their child
      elements (see Section 5 and (3)
       SHOULD send unavailable Section 4)
   o  All client-related instant messaging syntax and semantics defined
      in this document, including presence from all of the contact's
       available resources to the user: subscriptions and roster
      management (see Section 3 and Section 2)





Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 56] 57]

Internet-Draft                   XMPP IM                      April                       July 2007


   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='user@example.com'
           subscription='none'
           name='SomeUser'>
         <group>SomeGroup</group>
       </item>
     </query>
   </iq>

   <presence
       from='contact@example.org'
       to='user@example.com'
       type='unsubscribed'/>

   <presence
       from='contact@example.org/resource'
       to='user@example.com'
       type='unavailable'/>

   3.  Upon receiving the presence stanza of type "unsubscribed"
       addressed to the user, the user's server (1) MUST initiate a
       roster push to all of the user's interested resources, containing
       an updated roster item for the contact with the 'subscription'
       attribute set to a value of "none" (if the user is unavailable or
       has not requested the roster, the user's server MUST modify the
       roster item


   o  End-to-end object signing and send encryption as defined in [XMPP-E2E]

   A client MUST also handle addresses that modified item the next time the user
       requests are encoded as "im:" URIs as
   specified in [CPIM], and MAY do so by removing the roster); (2) MUST deliver "im:" scheme and
   entrusting address resolution to the "unsubscribed" state
       change notification server as specified under
   Section 8.4.


10.  Internationalization Considerations

   For internationalization considerations, refer to all the relevant
   section of [XMPP-CORE].


11.  Security Considerations

   Core security considerations for XMPP are defined in the user's available resources; relevant
   section of [XMPP-CORE].

   Additional considerations that apply only to instant messaging and
       (3) MUST deliver the unavailable
   presence to all applications of the user's
       available resources:



















Saint-Andre             Expires October 19, 2007               [Page 57]

Internet-Draft XMPP IM                      April 2007


   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='contact@example.org'
           subscription='none'
           name='MyContact'>
         <group>MyBuddies</group>
       </item>
     </query>
   </iq>

   <presence
       from='contact@example.org'
       to='user@example.com'
       type='unsubscribed'/>

   <presence
       from='contact@example.org/resource'
       to='user@example.com'
       type='unavailable'/>

A.5.2.  Case #2: Cancelling are defined in several places within
   this document; specifically:

   o  When Subscription a server processes an inbound presence stanza of type "probe"
      whose intended recipient is Mutual

   In the second case, the user has a subscription to user associated with one of the contact's
   presence information and
      server's hostnames, the contact also has a subscription to server MUST NOT reveal the user's presence
      information (i.e., if the subscription sender is mutual).

   1.  If the contact wants an entity that is not authorized to cancel the user's subscription, the
       contact MUST send a
      receive that information as determined by presence stanza of type "unsubscribed" to the
       user:

   <presence to='user@example.com' type='unsubscribed'/>

   2.  As a result, the contact's subscriptions
      (see Exchanging Presence Information (Section 4)).
   o  A user's server (1) MUST send a roster push NOT leak the user's network availability to
       all of
      entities who are not authorized to know the contact's interested resources, containing user's presence,
      either via an explicit subscription as described herein or via an updated
       roster item for the
      existing trust relationship (such as presence-enabled user with the 'subscription' attribute set to
      directories within organizations).
   o  When a value server processes an outbound presence stanza with no type
      or of "to"; (2) type "unavailable", it MUST route follow the rules defined under
      Exchanging Presence Information (Section 4) in order to ensure
      that such presence information is not broadcasted to entities that
      are not authorized to know such information.
   o  When a server generates an error stanza of type
       "unsubscribed" in response to receiving a
      stanza for a user who does not exist, the user, first stamping the 'from' address as
       the bare JID (<contact@example.org>) use of the contact; and (3)
       SHOULD send unavailable presence from all of <service-
      unavailable/> error condition helps protect against well-known
      dictionary attacks, since this is the contact's
       available resources to all of same error condition that is
      returned if, for instance, the user's available resources: namespace of an IQ child element is
      not understood, or if offline message storage or message
      forwarding is not enabled for a domain.





Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 58]

Internet-Draft                   XMPP IM                      April                       July 2007


   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='user@example.com'
           subscription='to'
           name='SomeUser'>
         <group>SomeGroup</group>
       </item>
     </query>
   </iq>

   <presence
       from='contact@example.org'
       to='user@example.com'
       type='unsubscribed'/>

   <presence
       from='contact@example.org/resource'
       to='user@example.com'
       type='unavailable'/>

   3.  Upon receiving


   o  A client MAY ignore the <status/> element when contained in a
      presence stanza of type "subscribe", "unsubscribe", "subscribed",
      or "unsubscribed"
       addressed in order to help prevent "presence subscription
      spam".


12.  IANA Considerations

   The following sections update the user, the user's server (1) MUST initiate registrations provided in
   [RFC3921].

   For a
       roster push to all number of related IANA considerations, refer to the user's interested resources, containing
       an updated roster item relevant
   section of [XMPP-CORE].

12.1.  Instant Messaging SRV Protocol Label Registration

   Address Resolution for Instant Messaging and Presence [IMP-SRV]
   defines an Instant Messaging SRV Protocol Label registry for the contact with the 'subscription'
       attribute set
   protocols that can provide services that conform to a value of "from" (if the user "_im" SRV
   Service label.  Because XMPP is unavailable or
       has not requested one such protocol, the roster, IANA registers
   the user's server MUST modify "_xmpp" protocol label in the
       roster item appropriate registry, as follows:

   Protocol label:  _xmpp
   Specification:  XXXX
   Description:  Instant messaging protocol label for the Extensible
      Messaging and send Presence Protocol (XMPP) as defined by XXXX.
   Registrant Contact:  IETF, XMPP Working Group, <xmppwg@jabber.org>

12.2.  Presence SRV Protocol Label Registration

   Address Resolution for Instant Messaging and Presence [IMP-SRV]
   defines a Presence SRV Protocol Label registry for protocols that modified item can
   provide services that conform to the next time "_pres" SRV Service label.
   Because XMPP is one such protocol, the user
       requests IANA registers the roster); and (2) MUST deliver "_xmpp"
   protocol label in the "unsubscribed"
       state change notification to all of appropriate registry, as follows:

   Protocol label:  _xmpp
   Specification:  XXXX
   Description:  Presence protocol label for the user's available
       resources; Extensible Messaging
      and (3) MUST deliver the unavailable presence to all
       of the user's available resources: Presence Protocol (XMPP) as defined by XXXX.
   Registrant Contact:  IETF, XMPP Working Group, <xmppwg@jabber.org>


13.  References







Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 59]

Internet-Draft                   XMPP IM                      April                       July 2007


   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='contact@example.org'
           subscription='from'
           name='MyContact'>
         <group>MyBuddies</group>
       </item>
     </query>
   </iq>

   <presence
       from='contact@example.org'
       to='user@example.com'
       type='unsubscribed'/>

   <presence
       from='contact@example.org/resource'
       to='user@example.com'
       type='unavailable'/>

   Note: Obviously this does not result in removal of the roster item
   from the contact's roster,


13.1.  Normative References

   [IMP-REQS]
              Day, M., Aggarwal, S., and J. Vincent, "Instant Messaging
              / Presence Protocol Requirements", RFC 2779,
              February 2000.

   [IMP-SRV]  Peterson, J., "Address Resolution for Instant Messaging
              and Presence", RFC 3861, August 2004.

   [SRV]      Gulbrandsen, A., Vixie, P., and L. Esibov, "A DNS RR for
              specifying the contact still has a subscription
   to the user's presence information.  In order location of services (DNS SRV)", RFC 2782,
              February 2000.

   [TERMS]    Bradner, S., "Key words for use in RFCs to both completely
   cancel a mutual subscription Indicate
              Requirement Levels", BCP 14, RFC 2119, March 1997.

   [UUID]     Leach, P., Mealling, M., and fully remove the roster item from
   the contact's roster, the contact should update the roster item with
   subscription='remove' as defined under Removing a Roster Item R. Salz, "A Universally
              Unique IDentifier (UUID) URN Namespace", RFC 4122,
              July 2005.

   [XML]      Paoli, J., Maler, E., Sperberg-McQueen, C., Yergeau, F.,
              and
   Cancelling All Subscriptions (Appendix A.6).

A.6.  Removing a Roster Item T. Bray, "Extensible Markup Language (XML) 1.0 (Fourth
              Edition)", World Wide Web Consortium Recommendation REC-
              xml-20060816, August 2006,
              <http://www.w3.org/TR/2006/REC-xml-20060816>.

   [XML-NAMES]
              Bray, T., Hollander, D., and Cancelling All Subscriptions

   Because there may be many steps involved A. Layman, "Namespaces in completely removing a
   roster item
              XML", W3C REC-xml-names, January 1999,
              <http://www.w3.org/TR/REC-xml-names>.

   [XMPP-CORE]
              Saint-Andre, P., "Extensible Messaging and cancelling subscriptions Presence
              Protocol (XMPP): Core", draft-saintandre-rfc3920bis-03
              (work in both directions, the
   roster management protocol includes a "shortcut" method progress), July 2007.

   [XMPP-E2E]
              Saint-Andre, P., "End-to-End Signing and Object Encryption
              for doing so.
   The process may be initiated no matter what the current subscription
   state is by sending a roster set containing an item Extensible Messaging and Presence Protocol
              (XMPP)", RFC 3923, October 2004.

13.2.  Informative References

   [CPIM]     Peterson, J., "Common Profile for the contact
   with the 'subscription' attribute set to a value of "remove":

   <iq type='set' id='remove1'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='contact@example.org'
           subscription='remove'/>
     </query>
   </iq>

   When the user removes a contact from his or her roster by setting the
   'subscription' attribute to a value of "remove", the user's server Instant Messaging
              (CPIM)", RFC 3860, August 2004.

   [IMP-MODEL]



Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 60]

Internet-Draft                   XMPP IM                      April                       July 2007


   (1) MUST automatically cancel any existing presence subscription
   between the user


              Day, M., Rosenberg, J., and the contact (both 'to' H. Sugano, "A Model for
              Presence and 'from' as
   appropriate); (2) MUST remove the roster item from the user's roster Instant Messaging", RFC 2778, February 2000.

   [IRC]      Kalt, C., "Internet Relay Chat: Architecture", RFC 2810,
              April 2000.

   [RFC3921]  Saint-Andre, P., "Extensible Messaging and inform all of the user's interested resources of the roster item
   removal; (3) MUST inform the resource that initiated the removal of
   success; Presence
              Protocol (XMPP): Instant Messaging and (4) SHOULD send unavailable presence from all of the
   user's available resources to the contact:

   <presence
       from='user@example.com'
       to='contact@example.org'
       type='unsubscribe'/>

   <presence
       from='user@example.com'
       to='contact@example.org'
       type='unsubscribed'/>

   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='contact@example.org'
           subscription='remove'/>
     </query>
   </iq>

   <iq type='result' id='remove1'/>

   <presence
       from='user@example.com/resource'
       to='contact@example.org'
       type='unavailable'/>

   Upon receiving the presence stanza of type "unsubscribe", the
   contact's server (1) MUST initiate a roster push to all available
   resources associated with the contact that have requested the roster,
   containing an updated roster item for the user with the
   'subscription' attribute set to a value of "to" (if the contact is
   unavailable or has not requested the roster, the contact's server
   MUST modify the roster item Presence",
              RFC 3921, October 2004.

   [SASL]     Melnikov, A. and send that modified item the next time
   the contact requests the roster); K. Zeilenga, "Simple Authentication and
              Security Layer (SASL)", RFC 4422, June 2006.

   [TLS]      Dierks, T. and E. Rescorla, "The Transport Layer Security
              (TLS) Protocol Version 1.1", RFC 4346, April 2006.

   [XEP-0016]
              Millard, P. and P. Saint-Andre, "Privacy Lists", XSF
              XEP 0016, February 2007.

   [XEP-0045]
              Saint-Andre, P., "Multi-User Chat", XSF XEP 0045,
              April 2007.

   [XEP-0054]
              Saint-Andre, P., "vcard-temp", XSF XEP 0054, March 2003.

   [XML-SCHEMA]
              Thompson, H., Maloney, M., Mendelsohn, N., and D. Beech,
              "XML Schema Part 1: Structures Second Edition", World Wide
              Web Consortium Recommendation REC-xmlschema-1-20041028,
              October 2004,
              <http://www.w3.org/TR/2004/REC-xmlschema-1-20041028>.

   [VCARD]    Dawson, F. and T. Howes, "vCard MIME Directory Profile",
              RFC 2426, September 1998.


Appendix A.  Subscription States

   This section provides detailed information about subscription states
   and (2) MUST also deliver the
   "unsubscribe" state change notification to all server processing of the contact's
   available resources: subscription-related presence stanzas (i.e.,
   presence stanzas of type "subscribe", "subscribed", "unsubscribe",
   and "unsubscribed").







Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 61]

Internet-Draft                   XMPP IM                      April                       July 2007


   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='user@example.com'
           subscription='to'
           name='SomeUser'>
         <group>SomeGroup</group>
       </item>
     </query>
   </iq>

   <presence
       from='user@example.com'
       to='contact@example.org'
       type='unsubscribe'/>

   Upon receiving the presence stanza of type "unsubscribed", the
   contact's server (1) MUST initiate a roster push to all available
   resources associated with the contact that have requested the roster,
   containing an updated roster item for


A.1.  Defined States

   There are four primary subscription states:

   o  None -- the user with the
   'subscription' attribute set to a value of "none" (if the contact is
   unavailable or has does not requested the roster, have a subscription to the contact's server
   MUST modify the roster item
      presence information, and send that modified item the next time the contact requests the roster); and (2) MUST also deliver the
   "unsubscribe" state change notification does not have a subscription
      to all of the contact's
   available resources:

   <iq type='set'>
     <query xmlns='jabber:iq:roster'>
       <item
           jid='user@example.com'
           subscription='none'
           name='SomeUser'>
         <group>SomeGroup</group>
       </item>
     </query>
   </iq>

   <presence
       from='user@example.com'
       to='contact@example.org'
       type='unsubscribed'/>

   Upon receiving the user's presence stanza of type "unavailable" addressed to information
   o  To -- the contact, user has a subscription to the contact's server MUST deliver the unavailable presence to all of the user's available resources:





Saint-Andre             Expires October 19, 2007               [Page 62]

Internet-Draft                   XMPP IM                      April 2007


   <presence
       from='user@example.com/resource'
       to='contact@example.org'
       type='unavailable'/>

   Note: When the user removes
      information, but the contact from does not have a subscription to the
      user's roster, presence information
   o  From -- the
   end state of contact has a subscription to the contact's roster is that user's presence
      information, but the user is still in the
   contact's roster with does not have a subscription state of "none"; in order to
   completely remove the roster item for
      contact's presence information
   o  Both -- both the user, user and the contact needs have subscriptions to
   also send a roster removal request.


Appendix B.  Subscription States

   This section provides detailed information about subscription states
   and server handling of subscription-related each
      other's presence stanzas information (i.e.,
   presence stanzas the union of type "subscribe", "subscribed", "unsubscribe", 'from' and "unsubscribed").

B.1.  Defined States

   There 'to')

   These states are supplemented by various pending sub-states to yield
   nine possible subscription states, which are described here
   from the user's (not contact's) perspective: states:

   1.  "None" = contact and user are not subscribed to each other, and
       neither has requested a subscription from the other; this is
       reflected in the roster by subscription='none'
   2.  "None + Pending Out" = contact and user are not subscribed to
       each other, and user has sent contact a subscription request but
       contact has not replied yet; this is reflected in the roster by
       subscription='none' and ask='subscribe'
   3.  "None + Pending In" = contact and user are not subscribed to each
       other, and contact has sent user a subscription request but user
       has not replied yet (note: contact's server SHOULD NOT push or
       deliver roster items in this state, but instead SHOULD wait until
       user has approved subscription request from contact); this is
       reflected in the roster by subscription='none'
   4.  "None + Pending Out+In" = contact and user are not subscribed to
       each other, contact has sent user a subscription request but user
       has not replied yet, and user has sent contact a subscription
       request but contact has not replied yet; this is reflected in the
       roster by subscription='none' and ask='subscribe'
   5.  "To" = user is subscribed to contact (one-way); this is reflected
       in the roster by subscription='to'
   6.  "To + Pending In" = user is subscribed to contact, and contact
       has sent user a subscription request but user has not replied
       yet; this is reflected in the roster by subscription='to'




Saint-Andre             Expires October 19, 2007               [Page 63]

Internet-Draft                   XMPP IM                      April 2007
   7.  "From" = contact is subscribed to user (one-way); this is
       reflected in the roster by subscription='from'
   8.  "From + Pending Out" = contact is subscribed to user, and user
       has sent contact a subscription request but contact has not
       replied yet; this is reflected in the roster by
       subscription='none' and ask='subscribe'



Saint-Andre             Expires January 18, 2008               [Page 62]

Internet-Draft                   XMPP IM                       July 2007


   9.  "Both" = user and contact are subscribed to each other (two-way);
       this is reflected in the roster by subscription='both'

B.2.

A.2.  Server Handling Processing of Outbound Presence Subscription Stanzas

   Outbound presence subscription stanzas enable the user to manage his
   or her subscription to the contact's presence information (via the
   "subscribe" and "unsubscribe" types), and to manage the contact's
   access to the user's presence information (via the "subscribed" and
   "unsubscribed" types).

   The following rules apply:

   1.  Regarding outbound presence stanzas of type "subscribe", the
       user's server MUST without exception route the stanza to the
       contact.
   2.  Regarding outbound presence stanzas of type "unsubscribe", the
       user's server MUST without exception route the stanza to the
       contact.
   3.  Regarding outbound presence stanzas of type "subscribed", if the
       stanza does not result in a subscription state change from the
       user's perspective then the user's server SHOULD NOT route the
       stanza to the contact; however, if the stanza results in a
       subscription state change, the user's server MUST route the
       stanza to the contact.
   4.  Regarding outbound Subscription Stanzas

   Outbound presence subscription stanzas of type "unsubscribed", if enable the stanza does not result in a user to manage his
   or her subscription state change from
       the user's perspective then to the user's server SHOULD NOT route contact's presence information (via the stanza
   "subscribe" and "unsubscribe" types), and to manage the contact; however, if the stanza results in a
       subscription state change, contact's
   access to the user's server MUST route presence information (via the
       stanza "subscribed" and
   "unsubscribed" types).

   The following rules apply to outbound routing of the contact.

   The tables shown that follow summarize stanza as well
   as changes to the state transitions
   associated with user's roster.

   Note: In the handling of outbound presence subscription
   stanzas.










Saint-Andre             Expires October 19, 2007               [Page 64]

Internet-Draft                   XMPP IM                      April 2007 following tables, "S.N." stand for SHOULD NOT.

A.2.1.  Subscribe

   Table 1: Recommended handling Processing of outbound "subscribe" stanzas

   +----------------------------------------------------------------+
   |  EXISTING STATE          |  ROUTE?  |  NEW STATE               |
   +----------------------------------------------------------------+
   |  "None"                  |  yes  MUST    |  "None + Pending Out"    |
   |  "None + Pending Out"    |  yes  MUST    |  no state change         |
   |  "None + Pending In"     |  yes  MUST    |  "None + Pending Out+In" |
   |  "None + Pending Out+In" |  yes  MUST    |  no state change         |
   |  "To"                    |  yes  MUST    |  no state change         |
   |  "To + Pending In"       |  yes  MUST    |  no state change         |
   |  "From"                  |  yes  MUST    |  "From + Pending Out"    |
   |  "From + Pending Out"    |  yes  MUST    |  no state change         |
   |  "Both"                  |  yes  MUST    |  no state change         |
   +----------------------------------------------------------------+


















Saint-Andre             Expires January 18, 2008               [Page 63]

Internet-Draft                   XMPP IM                       July 2007


A.2.2.  Unsubscribe

   Table 2: Recommended handling Processing of outbound "unsubscribe" stanzas

   +----------------------------------------------------------------+
   |  EXISTING STATE          |  ROUTE?  |  NEW STATE               |
   +----------------------------------------------------------------+
   |  "None"                  |  yes  MUST    |  no state change         |
   |  "None + Pending Out"    |  yes  MUST    |  "None"                  |
   |  "None + Pending In"     |  yes  MUST    |  no state change         |
   |  "None + Pending Out+In" |  yes  MUST    |  "None + Pending In"     |
   |  "To"                    |  yes  MUST    |  "None"                  |
   |  "To + Pending In"       |  yes  MUST    |  "Pending In"            |
   |  "From"                  |  yes     |  no state change         |
   |  "From + Pending Out"    |  yes     |  "From"                  |
   |  "Both"                  |  yes     |  "From"                  |
   +----------------------------------------------------------------+

   Table 3: Recommended handling of outbound "subscribed" stanzas

   +----------------------------------------------------------------+
   |  EXISTING STATE          |  ROUTE?  |  NEW STATE               |
   +----------------------------------------------------------------+
   |  "None"                  |  no      |  no state change         |
   |  "None + Pending Out"    |  no  MUST    |  no state change         |
   |  "None + Pending In"     |  yes     |  "From"                  |
   |  "None + Pending Out+In" |  yes     |  "From + Pending Out"    |
   |  "To"                    |  no      |  no state change         |
   |  "To + Pending In"       |  yes     |  "Both"                  |  MUST    |  "From"                  |  no      |  no state change         |
   |  "From + Pending Out"    |  no      |  no state change         |
   |  "Both"                  |  no      |  no state change  MUST    |  "From"                  |
   +----------------------------------------------------------------+




Saint-Andre             Expires October 19, 2007               [Page 65]

Internet-Draft                   XMPP IM                      April 2007

A.2.3.  Subscribed

   Table 4: Recommended handling 3: Processing of outbound "unsubscribed" "subscribed" stanzas

   +----------------------------------------------------------------+
   |  EXISTING STATE          |  ROUTE?  |  NEW STATE               |
   +----------------------------------------------------------------+
   |  "None"                  |  no  S.N.    |  no state change         |
   |  "None + Pending Out"    |  no  S.N.    |  no state change         |
   |  "None + Pending In"     |  yes  MUST    |  "None"  "From"                  |
   |  "None + Pending Out+In" |  yes  MUST    |  "None  "From + Pending Out"    |
   |  "To"                    |  no  S.N.    |  no state change         |
   |  "To + Pending In"       |  yes     |  "To"                    |
   |  "From"                  |  yes     |  "None"                  |
   |  "From + Pending Out"    |  yes     |  "None + Pending Out"    |  MUST    |  "Both"                  |  yes     |  "To"
   |
   +----------------------------------------------------------------+

B.3.  Server Handling of Inbound Presence Subscription Stanzas

   Inbound presence subscription stanzas request a subscription-related
   action from the user (via the "subscribe" type), inform the user of
   subscription-related actions taken by the contact (via the
   "unsubscribe" type), or enable the contact to manage the user's
   access to the contact's presence information (via the "subscribed"
   and "unsubscribed" types).

   The following rules apply:

   1.  Regarding inbound presence stanzas of type "subscribe", if the
       user has not already granted the contact access to the user's
       presence information and if there is no pending inbound
       subscription request then the user's server MUST route the stanza
       to the user; however, if there is a pending inbound subscription
       request then the user's server SHOULD NOT deliver the new
       request.  If the user has already granted the contact access to
       the user's presence information, the user's server SHOULD auto-
       reply by sending a presence stanza of type "subscribed" to the
       contact on behalf of the user; this rule enables the contact to
       resynchronize the subscription state if needed.
   2.  Regarding inbound presence stanzas of type "unsubscribe", if the
       stanza does not result in a subscription state change from the
       user's perspective then the user's server SHOULD NOT route the
       stanza to the contact; however, if the stanza results in a
       subscription  "From"                  |  S.N.    |  no state change, the user's server MUST route the
       stanza to the contact.
   3.  Regarding inbound presence stanzas of type "subscribed", if the
       stanza does not result in a subscription change         |
   |  "From + Pending Out"    |  S.N.    |  no state change from the
       user's perspective then the user's server SHOULD NOT route the
       stanza to the contact; however, if the stanza results in a         |
   |  "Both"                  |  S.N.    |  no state change         |
   +----------------------------------------------------------------+
















Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 66] 64]

Internet-Draft                   XMPP IM                      April                       July 2007


       subscription


A.2.4.  Unsubscribed

   Table 4: Processing of outbound "unsubscribed" stanzas

   +----------------------------------------------------------------+
   |  EXISTING STATE          |  ROUTE?  |  NEW STATE               |
   +----------------------------------------------------------------+
   |  "None"                  |  S.N.    |  no state change, the user's server change         |
   |  "None + Pending Out"    |  S.N.    |  no state change         |
   |  "None + Pending In"     |  MUST route the
       stanza to the contact.
   4.  Regarding inbound    |  "None"                  |
   |  "None + Pending Out+In" |  MUST    |  "None + Pending Out"    |
   |  "To"                    |  S.N.    |  no state change         |
   |  "To + Pending In"       |  MUST    |  "To"                    |
   |  "From"                  |  MUST    |  "None"                  |
   |  "From + Pending Out"    |  MUST    |  "None + Pending Out"    |
   |  "Both"                  |  MUST    |  "To"                    |
   +----------------------------------------------------------------+

A.3.  Server Processing of Inbound Presence Subscription Stanzas

   Inbound presence subscription stanzas of type "unsubscribed", if the
       stanza does not result in request a subscription state change subscription-related
   action from the
       user's perspective then the user's server SHOULD NOT route the
       stanza to user (via the contact; however, if "subscribe" type), inform the stanza results in a
       subscription state change, user of
   subscription-related actions taken by the user's server MUST route contact (via the
       stanza
   "unsubscribe" type), or enable the contact to manage the contact.

   The tables shown that follow summarize user's
   access to the state transitions
   associated with contact's presence information (via the handling "subscribed"
   and "unsubscribed" types).

   The following rules apply to delivery of the inbound presence subscription
   stanzas. stanza as well
   as changes to the contact's roster.

   Note: In the following tables, "S.N." stand for SHOULD NOT.




















Saint-Andre             Expires January 18, 2008               [Page 65]

Internet-Draft                   XMPP IM                       July 2007


A.3.1.  Subscribe

   Table 5: Recommended handling Processing of inbound "subscribe" stanzas

   +------------------------------------------------------------------+
   |  EXISTING STATE          |  DELIVER?  |  NEW STATE               |
   +------------------------------------------------------------------+
   |  "None"                  |  yes  MUST      |  "None + Pending In"     |
   |  "None + Pending Out"    |  yes  MUST      |  "None + Pending Out+In" |
   |  "None + Pending In"     |  no  S.N.      |  no state change         |
   |  "None + Pending Out+In" |  no  S.N.      |  no state change         |
   |  "To"                    |  yes  MUST      |  "To + Pending In"       |
   |  "To + Pending In"       |  no  S.N.      |  no state change         |
   |  "From"                  |  no  S.N. *    |  no state change         |
   |  "From + Pending Out"    |  no  S.N. *    |  no state change         |
   |  "Both"                  |  no  S.N. *    |  no state change         |
   +------------------------------------------------------------------+

   * Server SHOULD auto-reply with "subscribed" stanza

A.3.2.  Unsubscribe

   When the user's server receives a presence stanza of type
   "unsubscribe" for the user from the contact, if the stanza results in
   a subscription state change from the user's perspective then the
   user's server MUST change the state and SHOULD auto-reply by sending
   a presence stanza of type "unsubscribed" to the contact on behalf of
   the user, MUST deliver the
   "unsubscribe" stanza to user.  Otherwise the user, and user's server MUST NOT change the state.  If no
   subscription state change results, the user's server and
   SHOULD NOT deliver the stanza and MUST NOT change the state. stanza.  These rules are summarized in the
   following table.











Saint-Andre             Expires October 19, 2007               [Page 67]

Internet-Draft                   XMPP IM                      April 2007

   Table 6: Recommended handling Processing of inbound "unsubscribe" stanzas

   +------------------------------------------------------------------+
   |  EXISTING STATE          |  DELIVER?  |  NEW STATE               |
   +------------------------------------------------------------------+
   |  "None"                  |  no  S.N.      |  no state change         |
   |  "None + Pending Out"    |  no  S.N.      |  no state change         |
   |  "None + Pending In"     |  yes  S.N. *    |  "None"                  |
   |  "None + Pending Out+In" |  yes  S.N. *    |  "None + Pending Out"    |
   |  "To"                    |  no  S.N.      |  no state change         |
   |  "To + Pending In"       |  yes  S.N. *    |  "To"                    |
   |  "From"                  |  yes  S.N. *    |  "None"                  |
   |  "From + Pending Out"    |  yes  S.N. *    |  "None + Pending Out     |
   |  "Both"                  |  yes  S.N. *    |  "To"                    |
   +------------------------------------------------------------------+

   * Server SHOULD auto-reply with "unsubscribed" stanza



Saint-Andre             Expires January 18, 2008               [Page 66]

Internet-Draft                   XMPP IM                       July 2007


A.3.3.  Subscribed

   When the user's server receives a presence stanza of type
   "subscribed" for the user from the contact, it MUST NOT deliver the
   stanza to the user and MUST NOT change the subscription state if there is no pending
   outbound request for access to the contact's presence information. information,
   then it MUST NOT change the subscription state and SHOULD NOT deliver
   the stanza to the user.  If there is a pending outbound request for
   access to the contact's presence information and the inbound presence
   stanza of type "subscribed" results in a subscription state change,
   then the user's server MUST change the subscription state but SHOULD
   NOT deliver the stanza to the user and MUST change
   the subscription state. user.  If the user already has access
   to the contact's presence information, the inbound presence stanza of
   type "subscribed" does not result in a subscription state change;
   therefore the user's server MUST NOT change the subscription state
   and SHOULD NOT deliver the stanza to the user
   and MUST NOT change the subscription state. user.  These rules are
   summarized in the following table.

   Table 7: Recommended handling Processing of inbound "subscribed" stanzas

   +------------------------------------------------------------------+
   |  EXISTING STATE          |  DELIVER?  |  NEW STATE               |
   +------------------------------------------------------------------+
   |  "None"                  |  no  S.N.      |  no state change         |
   |  "None + Pending Out"    |  yes  S.N.      |  "To"                    |
   |  "None + Pending In"     |  no  S.N.      |  no state change         |
   |  "None + Pending Out+In" |  yes  S.N.      |  "To + Pending In"       |
   |  "To"                    |  no  S.N.      |  no state change         |
   |  "To + Pending In"       |  no  S.N.      |  no state change         |
   |  "From"                  |  no  S.N.      |  no state change         |
   |  "From + Pending Out"    |  yes  S.N.      |  "Both"                  |
   |  "Both"                  |  no  S.N.      |  no state change         |
   +------------------------------------------------------------------+



Saint-Andre             Expires October 19, 2007               [Page 68]

Internet-Draft                   XMPP IM                      April 2007

A.3.4.  Unsubscribed

   When the user's server receives a presence stanza of type
   "unsubscribed" for the user from the contact, it MUST deliver the
   stanza to the user and MUST change the subscription state if there is a pending
   outbound request for access to the contact's presence information or
   if the user currently has access to the contact's presence information.  Otherwise,
   information, then the user's server MUST change the subscription
   state but SHOULD NOT deliver the stanza and to the user.  Otherwise, the
   user's server MUST NOT change the subscription state. subscription state and SHOULD NOT
   deliver the stanza.  These rules are summarized in the following
   table.







Saint-Andre             Expires January 18, 2008               [Page 67]

Internet-Draft                   XMPP IM                       July 2007


   Table 8: Recommended handling Processing of inbound "unsubscribed" stanzas

   +------------------------------------------------------------------+
   |  EXISTING STATE          |  DELIVER?  |  NEW STATE               |
   +------------------------------------------------------------------+
   |  "None"                  |  no  S.N.      |  no state change         |
   |  "None + Pending Out"    |  yes  S.N.      |  "None"                  |
   |  "None + Pending In"     |  no  S.N.      |  no state change         |
   |  "None + Pending Out+In" |  yes  S.N.      |  "None + Pending In"     |
   |  "To"                    |  yes  S.N.      |  "None"                  |
   |  "To + Pending In"       |  yes  S.N.      |  "None + Pending In"     |
   |  "From"                  |  no  S.N.      |  no state change         |
   |  "From + Pending Out"    |  yes  S.N.      |  "From"                  |
   |  "Both"                  |  yes  S.N.      |  "From"                  |
   +------------------------------------------------------------------+


Appendix C. B.  Blocking Communication

   Sections 2.3.5 and 5.4.10 of [IMP-REQS] requires require that a compliant
   instant messaging and presence technology must enable a user to block
   communications from selected users.  A protocol for doing so is
   specified in [XEP-0016] and a simplified "front-end" to that protocol
   is specified in [XEP-0191]. [XEP-0016].


Appendix D. C.  vCards

   Sections 3.1.3 and 4.1.4 of [IMP-REQS] require that it be possible to
   retrieve out-of-band contact information for other users (e.g.,
   telephone number or email address).  An XML representation of the
   vCard specification defined in RFC 2426 [VCARD] is in common use
   within the Jabber community to provide such information but is out of
   scope for XMPP (documentation of this protocol is contained in
   [XEP-0054]).







Saint-Andre             Expires October 19, 2007               [Page 69]

Internet-Draft                   XMPP IM                      April 2007


Appendix E. D.  XML Schemas

   The

   Because validation of XML streams and stanzas is optional, the
   following XML schemas are descriptive, provided for descriptive purposes only.
   These schemas are not normative.

   The following schemas formally define various XML namespaces used in
   the core XMPP protocols, in conformance with [XML-SCHEMA].  For
   schemas defining stream-related features namespaces for XML streams and other core aspects of
   XMPP, refer to [XMPP-CORE].

E.1.

D.1.  jabber:client



Saint-Andre             Expires January 18, 2008               [Page 68]

Internet-Draft                   XMPP IM                       July 2007


<?xml version='1.0' encoding='UTF-8'?>

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

  <xs:import namespace='urn:ietf:params:xml:ns:xmpp-stanzas'/>

  <xs:element name='message'>
     <xs:complexType>
        <xs:sequence>
          <xs:choice minOccurs='0' maxOccurs='unbounded'>
            <xs:element ref='subject'/>
            <xs:element ref='body'/>
            <xs:element ref='thread'/>
          </xs:choice>
          <xs:any     namespace='##other'
                      minOccurs='0'
                      maxOccurs='unbounded'/>
          <xs:element ref='error'
                      minOccurs='0'/>
        </xs:sequence>
        <xs:attribute name='from'
                      type='xs:string'
                      use='optional'/>
        <xs:attribute name='id'
                      type='xs:NMTOKEN'
                      use='optional'/>
        <xs:attribute name='to'
                      type='xs:string'
                      use='optional'/>
        <xs:attribute name='type' use='optional' default='normal'>
          <xs:simpleType>
            <xs:restriction base='xs:NCName'>
              <xs:enumeration value='chat'/>
              <xs:enumeration value='error'/>
              <xs:enumeration value='groupchat'/>
              <xs:enumeration value='headline'/>



Saint-Andre             Expires October 19, 2007               [Page 70]

Internet-Draft                   XMPP IM                      April 2007
              <xs:enumeration value='normal'/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>
        <xs:attribute ref='xml:lang' use='optional'/>
     </xs:complexType>
  </xs:element>




Saint-Andre             Expires January 18, 2008               [Page 69]

Internet-Draft                   XMPP IM                       July 2007


  <xs:element name='body'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='xs:string'>
          <xs:attribute ref='xml:lang' use='optional'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

  <xs:element name='subject'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='xs:string'>
          <xs:attribute ref='xml:lang' use='optional'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

  <xs:element name='thread' type='xs:NMTOKEN'/>

  <xs:element name='presence'>
    <xs:complexType>
      <xs:sequence>
        <xs:choice minOccurs='0' maxOccurs='unbounded'>
          <xs:element ref='show'/>
          <xs:element ref='status'/>
          <xs:element ref='priority'/>
        </xs:choice>
        <xs:any     namespace='##other'
                    minOccurs='0'
                    maxOccurs='unbounded'/>
        <xs:element ref='error'
                    minOccurs='0'/>
      </xs:sequence>
      <xs:attribute name='from'
                    type='xs:string'
                    use='optional'/>
      <xs:attribute name='id'



Saint-Andre             Expires October 19, 2007               [Page 71]

Internet-Draft                   XMPP IM                      April 2007
                    type='xs:NMTOKEN'
                    use='optional'/>
      <xs:attribute name='to'
                    type='xs:string'
                    use='optional'/>
      <xs:attribute name='type' use='optional'>
        <xs:simpleType>
          <xs:restriction base='xs:NCName'>



Saint-Andre             Expires January 18, 2008               [Page 70]

Internet-Draft                   XMPP IM                       July 2007


            <xs:enumeration value='error'/>
            <xs:enumeration value='probe'/>
            <xs:enumeration value='subscribe'/>
            <xs:enumeration value='subscribed'/>
            <xs:enumeration value='unavailable'/>
            <xs:enumeration value='unsubscribe'/>
            <xs:enumeration value='unsubscribed'/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute ref='xml:lang' use='optional'/>
    </xs:complexType>
  </xs:element>

  <xs:element name='show'>
    <xs:simpleType>
      <xs:restriction base='xs:NCName'>
        <xs:enumeration value='away'/>
        <xs:enumeration value='chat'/>
        <xs:enumeration value='dnd'/>
        <xs:enumeration value='xa'/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name='status'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='string1024'>
          <xs:attribute ref='xml:lang' use='optional'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name='string1024'>
    <xs:restriction base='xs:string'>
      <xs:minLength value='1'/>
      <xs:maxLength value='1024'/>
    </xs:restriction>



Saint-Andre             Expires October 19, 2007               [Page 72]

Internet-Draft                   XMPP IM                      April 2007
  </xs:simpleType>

  <xs:element name='priority' type='xs:byte'/>

  <xs:element name='iq'>
    <xs:complexType>
      <xs:sequence>
        <xs:any     namespace='##other'



Saint-Andre             Expires January 18, 2008               [Page 71]

Internet-Draft                   XMPP IM                       July 2007


                    minOccurs='0'/>
        <xs:element ref='error'
                    minOccurs='0'/>
      </xs:sequence>
      <xs:attribute name='from'
                    type='xs:string'
                    use='optional'/>
      <xs:attribute name='id'
                    type='xs:NMTOKEN'
                    use='required'/>
      <xs:attribute name='to'
                    type='xs:string'
                    use='optional'/>
      <xs:attribute name='type' use='required'>
        <xs:simpleType>
          <xs:restriction base='xs:NCName'>
            <xs:enumeration value='error'/>
            <xs:enumeration value='get'/>
            <xs:enumeration value='result'/>
            <xs:enumeration value='set'/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute ref='xml:lang' use='optional'/>
    </xs:complexType>
  </xs:element>

  <xs:element name='error'>
    <xs:complexType>
      <xs:sequence  xmlns:err='urn:ietf:params:xml:ns:xmpp-stanzas'>
        <xs:group   ref='err:stanzaErrorGroup'/>
        <xs:element ref='err:text'
                    minOccurs='0'/>
      </xs:sequence>
      <xs:attribute name='code' type='xs:unsignedShort' use='optional'/>
      <xs:attribute name='type' use='required'>
        <xs:simpleType>
          <xs:restriction base='xs:NCName'>
            <xs:enumeration value='auth'/>
            <xs:enumeration value='cancel'/>



Saint-Andre             Expires October 19, 2007               [Page 73]

Internet-Draft                   XMPP IM                      April 2007
            <xs:enumeration value='continue'/>
            <xs:enumeration value='modify'/>
            <xs:enumeration value='wait'/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>



Saint-Andre             Expires January 18, 2008               [Page 72]

Internet-Draft                   XMPP IM                       July 2007


</xs:schema>

E.2.

D.2.  jabber:server

<?xml version='1.0' encoding='UTF-8'?>

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

  <xs:import namespace='urn:ietf:params:xml:ns:xmpp-stanzas'/>

  <xs:element name='message'>
     <xs:complexType>
        <xs:sequence>
          <xs:choice minOccurs='0' maxOccurs='unbounded'>
            <xs:element ref='subject'/>
            <xs:element ref='body'/>
            <xs:element ref='thread'/>
          </xs:choice>
          <xs:any     namespace='##other'
                      minOccurs='0'
                      maxOccurs='unbounded'/>
          <xs:element ref='error'
                      minOccurs='0'/>
        </xs:sequence>
        <xs:attribute name='from'
                      type='xs:string'
                      use='required'/>
        <xs:attribute name='id'
                      type='xs:NMTOKEN'
                      use='optional'/>
        <xs:attribute name='to'
                      type='xs:string'
                      use='required'/>
        <xs:attribute name='type' use='optional' default='normal'>
          <xs:simpleType>



Saint-Andre             Expires October 19, 2007               [Page 74]

Internet-Draft                   XMPP IM                      April 2007
            <xs:restriction base='xs:NCName'>
              <xs:enumeration value='chat'/>
              <xs:enumeration value='error'/>
              <xs:enumeration value='groupchat'/>
              <xs:enumeration value='headline'/>
              <xs:enumeration value='normal'/>
            </xs:restriction>
          </xs:simpleType>
        </xs:attribute>



Saint-Andre             Expires January 18, 2008               [Page 73]

Internet-Draft                   XMPP IM                       July 2007


        <xs:attribute ref='xml:lang' use='optional'/>
     </xs:complexType>
  </xs:element>

  <xs:element name='body'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='xs:string'>
          <xs:attribute ref='xml:lang' use='optional'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

  <xs:element name='subject'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='xs:string'>
          <xs:attribute ref='xml:lang' use='optional'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>

  <xs:element name='thread' type='xs:NMTOKEN'/>

  <xs:element name='presence'>
    <xs:complexType>
      <xs:sequence>
        <xs:choice minOccurs='0' maxOccurs='unbounded'>
          <xs:element ref='show'/>
          <xs:element ref='status'/>
          <xs:element ref='priority'/>
        </xs:choice>
        <xs:any     namespace='##other'
                    minOccurs='0'
                    maxOccurs='unbounded'/>
        <xs:element ref='error'
                    minOccurs='0'/>



Saint-Andre             Expires October 19, 2007               [Page 75]

Internet-Draft                   XMPP IM                      April 2007
      </xs:sequence>
      <xs:attribute name='from'
                    type='xs:string'
                    use='required'/>
      <xs:attribute name='id'
                    type='xs:NMTOKEN'
                    use='optional'/>
      <xs:attribute name='to'
                    type='xs:string'



Saint-Andre             Expires January 18, 2008               [Page 74]

Internet-Draft                   XMPP IM                       July 2007


                    use='required'/>
      <xs:attribute name='type' use='optional'>
        <xs:simpleType>
          <xs:restriction base='xs:NCName'>
            <xs:enumeration value='error'/>
            <xs:enumeration value='probe'/>
            <xs:enumeration value='subscribe'/>
            <xs:enumeration value='subscribed'/>
            <xs:enumeration value='unavailable'/>
            <xs:enumeration value='unsubscribe'/>
            <xs:enumeration value='unsubscribed'/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute ref='xml:lang' use='optional'/>
    </xs:complexType>
  </xs:element>

  <xs:element name='show'>
    <xs:simpleType>
      <xs:restriction base='xs:NCName'>
        <xs:enumeration value='away'/>
        <xs:enumeration value='chat'/>
        <xs:enumeration value='dnd'/>
        <xs:enumeration value='xa'/>
      </xs:restriction>
    </xs:simpleType>
  </xs:element>

  <xs:element name='status'>
    <xs:complexType>
      <xs:simpleContent>
        <xs:extension base='string1024'>
          <xs:attribute ref='xml:lang' use='optional'/>
        </xs:extension>
      </xs:simpleContent>
    </xs:complexType>
  </xs:element>




Saint-Andre             Expires October 19, 2007               [Page 76]

Internet-Draft                   XMPP IM                      April 2007

  <xs:simpleType name='string1024'>
    <xs:restriction base='xs:string'>
      <xs:minLength value='1'/>
      <xs:maxLength value='1024'/>
    </xs:restriction>
  </xs:simpleType>

  <xs:element name='priority' type='xs:byte'/>




Saint-Andre             Expires January 18, 2008               [Page 75]

Internet-Draft                   XMPP IM                       July 2007


  <xs:element name='iq'>
    <xs:complexType>
      <xs:sequence>
        <xs:any     namespace='##other'
                    minOccurs='0'/>
        <xs:element ref='error'
                    minOccurs='0'/>
      </xs:sequence>
      <xs:attribute name='from'
                    type='xs:string'
                    use='required'/>
      <xs:attribute name='id'
                    type='xs:NMTOKEN'
                    use='required'/>
      <xs:attribute name='to'
                    type='xs:string'
                    use='required'/>
      <xs:attribute name='type' use='required'>
        <xs:simpleType>
          <xs:restriction base='xs:NCName'>
            <xs:enumeration value='error'/>
            <xs:enumeration value='get'/>
            <xs:enumeration value='result'/>
            <xs:enumeration value='set'/>
          </xs:restriction>
        </xs:simpleType>
      </xs:attribute>
      <xs:attribute ref='xml:lang' use='optional'/>
    </xs:complexType>
  </xs:element>

  <xs:element name='error'>
    <xs:complexType>
      <xs:sequence  xmlns:err='urn:ietf:params:xml:ns:xmpp-stanzas'>
        <xs:group   ref='err:stanzaErrorGroup'/>
        <xs:element ref='err:text'
                    minOccurs='0'/>
      </xs:sequence>
      <xs:attribute name='code' type='xs:unsignedShort' use='optional'/>



Saint-Andre             Expires October 19, 2007               [Page 77]

Internet-Draft                   XMPP IM                      April 2007
      <xs:attribute name='type' use='required'>
        <xs:simpleType>
          <xs:restriction base='xs:NCName'>
            <xs:enumeration value='auth'/>
            <xs:enumeration value='cancel'/>
            <xs:enumeration value='continue'/>
            <xs:enumeration value='modify'/>
            <xs:enumeration value='wait'/>
          </xs:restriction>



Saint-Andre             Expires January 18, 2008               [Page 76]

Internet-Draft                   XMPP IM                       July 2007


        </xs:simpleType>
      </xs:attribute>
    </xs:complexType>
  </xs:element>

</xs:schema>

E.3.

D.3.  jabber:iq:roster

   <?xml version='1.0' encoding='UTF-8'?>

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

     <xs:element name='query'>
       <xs:complexType>
         <xs:sequence>
           <xs:element ref='item'
                       minOccurs='0'
                       maxOccurs='unbounded'/>
         </xs:sequence>
       </xs:complexType>
     </xs:element>

     <xs:element name='item'>
       <xs:complexType>
         <xs:sequence>
           <xs:element ref='group'
                       minOccurs='0'
                       maxOccurs='unbounded'/>
         </xs:sequence>
         <xs:attribute name='ask' use='optional'>
           <xs:simpleType>
             <xs:restriction base='xs:NCName'>
               <xs:enumeration value='subscribe'/>
             </xs:restriction>



Saint-Andre             Expires October 19, 2007               [Page 78]

Internet-Draft                   XMPP IM                      April 2007
           </xs:simpleType>
         </xs:attribute>
         <xs:attribute name='jid' type='xs:string' use='required'/>
         <xs:attribute name='name' type='xs:string' use='optional'/>
         <xs:attribute name='subscription' use='optional'>
           <xs:simpleType>
             <xs:restriction base='xs:NCName'>
               <xs:enumeration value='both'/>
               <xs:enumeration value='from'/>



Saint-Andre             Expires January 18, 2008               [Page 77]

Internet-Draft                   XMPP IM                       July 2007


               <xs:enumeration value='none'/>
               <xs:enumeration value='remove'/>
               <xs:enumeration value='to'/>
             </xs:restriction>
           </xs:simpleType>
         </xs:attribute>
       </xs:complexType>
     </xs:element>

     <xs:element name='group' type='xs:string'/>

   </xs:schema>


Appendix F. E.  Differences From RFC 3921

   This section is informative.

   Based on consensus derived from interoperability testing and implementation experience, and deployment
   experience as well as formal interoperability testing, the following
   substantive modifications were made from RFC 3921.  In addition, several smaller changes were made to more
   clearly specify and explain the protocols.

   o  The protocol for session establishment was determined to be
      unnecessary and therefore the content previously defined in
      Section 3 of RFC 3921 was removed.  However, server
      implementations may still want to advertise support for the
      feature in order to ensure backwards-compatibility, backward-compatibility, even though it
      session establishment is a "no-op".
   o  The protocol for communications blocking specified in Section 10
      of RFC 3921 has been moved to [XEP-0016] and a simplified "front-
      end" to that functionality has been defined in [XEP-0191] to ease
      the task of implementing communications blocking in servers and
      clients. [XEP-0016].
   o  In order to more seamlessly repair lack of synchronization in
      subscription states between rosters located at different servers,
      error handling related to presence probes and presence
      notifications was modified to return presence stanzas of type "unbsubscribe"
      "unsubscribe" or "unsubscribed" rather than error stanzas.

   In addition, numerous changes of an editorial nature were made in
   order to more fully specify and clearly explain the protocols.


Appendix F.  Copying Conditions

   The Contributor grants third parties the irrevocable right to copy,
   use and distribute the Contribution, with or without modification, in
   any medium, without royalty, provided that, unless separate
   permission is granted, redistributed modified works:

   1.  do not contain misleading author, version, name of work, or
       endorsement information, and




Saint-Andre             Expires October 19, January 18, 2008               [Page 78]

Internet-Draft                   XMPP IM                       July 2007


   2.  do not claim endorsement of the modified work by the Contributor,
       or any organization the Contributor belongs to, the Internet
       Engineering Task Force (IETF), Internet Research Task Force
       (IRTF), Internet Engineering Steering Group (IESG), Internet
       Architecture Board (IAB), Internet Assigned Numbers Authority
       (IANA), Internet Society (ISOC), Request For Comments (RFC)
       Editor, or any combination or variation of such terms (including
       without limitation the IETF "4 diamonds" logo), or any terms that
       are confusingly similar thereto, and
   3.  remove any claims of status as an Internet Standard, including
       without limitation removing the RFC boilerplate.

   The IETF suggests that any citation or excerpt of unmodified text
   reference the RFC or other document from which the text is derived.


Index

   A
      Available Resource  29

   B
      Broadcasted Presence  28

   C
      Contact  18

   D
      Directed Presence  28

   I
      Initial Presence  29
      Interested Resource  9

   P
      Presence Probe  30
      Presence Session  28
      Presence Subscription  18
      Presence  4

   R
      Roster Get  7
      Roster Push  8
      Roster Result  8
      Roster Set  7
      Roster  4

   S



Saint-Andre             Expires January 18, 2008               [Page 79]

Internet-Draft                   XMPP IM                      April                       July 2007


      Subscription Request  18

   U
      Unavailable Presence  34


Author's Address

   Peter Saint-Andre (editor)
   XMPP Standards Foundation
   P.O. Box 1641
   Denver, CO  80201
   US

   Email: stpeter@jabber.org
   URI:   xmpp:stpeter@jabber.org



































Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 80]

Internet-Draft                   XMPP IM                      April                       July 2007


Full Copyright Statement

   Copyright (C) The IETF Trust (2007).

   This document is subject to the rights, licenses and restrictions
   contained in BCP 78, and except as set forth therein, the authors
   retain all their rights.

   This document and the information contained herein are provided on an
   "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS
   OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND
   THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS
   OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
   THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
   WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.


Intellectual Property

   The IETF takes no position regarding the validity or scope of any
   Intellectual Property Rights or other rights that might be claimed to
   pertain to the implementation or use of the technology described in
   this document or the extent to which any license under such rights
   might or might not be available; nor does it represent that it has
   made any independent effort to identify any such rights.  Information
   on the procedures with respect to rights in RFC documents can be
   found in BCP 78 and BCP 79.

   Copies of IPR disclosures made to the IETF Secretariat and any
   assurances of licenses to be made available, or the result of an
   attempt made to obtain a general license or permission for the use of
   such proprietary rights by implementers or users of this
   specification can be obtained from the IETF on-line IPR repository at
   http://www.ietf.org/ipr.

   The IETF invites any interested party to bring to its attention any
   copyrights, patents or patent applications, or other proprietary
   rights that may cover technology that may be required to implement
   this standard.  Please address the information to the IETF at
   ietf-ipr@ietf.org.


Acknowledgment

   Funding for the RFC Editor function is provided by the IETF
   Administrative Support Activity (IASA).





Saint-Andre             Expires October 19, 2007 January 18, 2008               [Page 81]

----