view Side-By-Side changes
Network Working Group P. Saint-Andre Internet-Draft J. Miller Expires:December 28, 2003January 26, 2004 Jabber Software FoundationJune 29,July 28, 2003 XMPP Instant Messagingdraft-ietf-xmpp-im-14draft-ietf-xmpp-im-15 Status of this Memo This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC2026. 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 onDecember 28, 2003.January 26, 2004. Copyright Notice Copyright (C) The Internet Society (2003). All Rights Reserved. Abstract This document describes specific extensions to and applications of the Extensible Messaging and Presence Protocol (XMPP) that provide the basic instant messaging and presence functionality defined in RFC 2779. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page 1] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . .. 45 1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . .. 45 1.2 Requirements . . . . . . . . . . . . . . . . . . . . . . .. 45 1.3 Terminology . . . . . . . . . . . . . . . . . . . . . . .. 45 1.4 Discussion Venue . . . . . . . . . . . . . . . . . . . . .. 56 1.5 Intellectual Property Notice . . . . . . . . . . . . . . .. 56 2. Establishing a Session . . . . . . . . . . . . . . . . . .. 67 3. Exchanging Messages . . . . . . . . . . . . . . . . . . .. 89 3.1 Specifying an Intended Recipient . . . . . . . . . . . . .. 89 3.2 Specifying a Message Type . . . . . . . . . . . . . . . .. 89 3.3 Specifying a Message Body . . . . . . . . . . . . . . . .. 910 3.4 Specifying a Message Subject . . . . . . . . . . . . . . .. 1011 3.5 Specifying a Conversation Thread . . . . . . . . . . . . .. 1011 4. Exchanging Presence Information . . . . . . . . . . . . .. 1213 4.1 Client and Server Responsibilities . . . . . . . . . . . .. 1213 4.2 Specifying Availability Status . . . . . . . . . . . . . .. 1416 4.3 Specifying Detailed Status Information . . . . . . . . . .. 1516 4.4 Specifying Presence Priority . . . . . . . . . . . . . . .. 1516 4.5 Determining When a Contact Went Offline . . . . . . . . .. 1617 4.6 Presence Examples . . . . . . . . . . . . . . . . . . . .. 1718 5. Managing Subscriptions . . . . . . . . . . . . . . . . . .. 2223 5.1 Requesting a Subscription . . . . . . . . . . . . . . . .. 2223 5.2 Handling a Subscription Request . . . . . . . . . . . . .. 2223 5.3 Cancelling a Subscription from Another Entity . . . . . .. 2324 5.4 Unsubscribing from Another Entity's Presence . . . . . . .. 2324 6. Managing One's Roster . . . . . . . . . . . . . . . . . .. 2425 6.1 Retrieving One's Roster on Login . . . . . . . . . . . . .. 2425 6.2 Adding a Roster Item . . . . . . . . . . . . . . . . . . .. 2526 6.3 Updating a Roster Item . . . . . . . . . . . . . . . . . .. 2627 6.4 Deleting a Roster Item . . . . . . . . . . . . . . . . . .. 2728 7. Integration of Roster Items and Presence Subscriptions . .. 2829 7.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . .. 2829 7.2 User Subscribes to Contact . . . . . . . . . . . . . . . .. 2829 7.2.1 Alternate Flow: Contact Declines Subscription Request . .. 3234 7.3 Creating a Mutual Subscription . . . . . . . . . . . . . .. 3335 7.3.1 Alternate Flow: User Declines Subscription Request . . . .. 3638 7.4 Unsubscribing . . . . . . . . . . . . . . . . . . . . . .. 3740 7.4.1 Case #1: Unsubscribing When Subscription is Not Mutual . .. 3840 7.4.2 Case #2: Unsubscribing When Subscription is Mutual . . . .. 3942 7.5 Cancelling a Subscription . . . . . . . . . . . . . . . .. 4245 7.5.1 Case #1: Cancelling When Subscription is Not Mutual . . .. 4245 7.5.2 Case #2: Cancelling When Subscription is Mutual . . . . .. 4447 7.6 Removing a Roster Item and Cancelling All Subscriptions .. 4649 8.Blocking CommunicationSubscription States . . . . . . . . . . . . . . . . . . .4953 8.1SyntaxDefined States . . . . . . . . . . . . . . . . . . . . . . 53 8.2 Server Handling of Outbound Presence, Categorized by Saint-Andre & Miller Expires January 26, 2004 [Page 2] Internet-Draft XMPP Instant Messaging July 2003 Subscription State . . . . . .49 8.2 Business Rules. . . . . . . . . . . . . . 53 8.2.1 Subscription State = None . . . . . . . . .51 Saint-Andre & Miller Expires December 28, 2003 [Page 2] Internet-Draft XMPP Instant Messaging June 2003 8.3 Retrieving One's Privacy Lists. . . . . . . 54 8.2.2 Subscription State = None + Pending Out . . . . . . . .52 8.4 Managing Active Lists. 54 8.2.3 Subscription State = None + Pending In . . . . . . . . . . 54 8.2.4 Subscription State = None + Pending Out/In . . . . . . . . 558.5 Managing the Default List8.2.5 Subscription State = To . . . . . . . . . . . . . . . . .56 8.6 Editing a Privacy List55 8.2.6 Subscription State = To + Pending In . . . . . . . . . . . 55 8.2.7 Subscription State = From . . . . . . . .57 8.7 Adding a New Privacy List. . . . . . . . 56 8.2.8 Subscription State = From + Pending Out . . . . . . . . .58 8.8 Removing a Privacy List56 8.2.9 Subscription State = Both . . . . . . . . . . . . . . . . 56 8.3 Server Handling of Outbound Presence, Categorized by Presence Type . .58 8.9 Blocking Messages. . . . . . . . . . . . . . . . . . . . 56 8.3.1 Subscribe .59 8.10 Blocking Inbound Presence Notifications. . . . . . . . . .60 8.11 Blocking Outbound Presence Notifications. . . . . . . . . .62 8.12 Blocking IQs. . . 57 8.3.2 Subscribed . . . . . . . . . . . . . . . . . . . . .64 8.13 Blocking All Communication. . . 57 8.3.3 Unsubscribe . . . . . . . . . . . . . .65 8.14 Blocked Entity Attempts to Communicate with User. . . . . .67 8.15 Higher-Level Heuristics. . . 58 8.3.4 Unsubscribed . . . . . . . . . . . . . . .68 9. Server Rules for Handling XML Stanzas. . . . . . . . 58 8.4 Server Handling of Inbound Presence, Categorized by Subscription State . . .70 9.1 No 'to' Address. . . . . . . . . . . . . . . . . 58 8.4.1 Subscription State = None . . . . .70 9.2 Foreign Domain. . . . . . . . . . . 59 8.4.2 Subscription State = None + Pending Out . . . . . . . . . 59 8.4.3 Subscription State = None + Pending In . . .70 9.3 Subdomain. . . . . . . 59 8.4.4 Subscription State = None + Pending Out/In . . . . . . . . 60 8.4.5 Subscription State = To . . . . . . . . . .70 9.4 Bare Domain or Specific Resource. . . . . . . 60 8.4.6 Subscription State = To + Pending In . . . . . . .70 9.5 User in Same Domain. . . . 60 8.4.7 Subscription State = From . . . . . . . . . . . . . . . .71 10. IANA Considerations61 8.4.8 Subscription State = From + Pending Out . . . . . . . . . 61 8.4.9 Subscription State = Both . . . . . . . . . . .73 10.1 XML Namespace Name for Session Data. . . . . 61 8.5 Server Handling of Inbound Presence, Categorized by Presence Type . . . . . . .73 11. Security Considerations. . . . . . . . . . . . . . . 61 8.5.1 Subscribe . . .74 Normative References. . . . . . . . . . . . . . . . . . . .75 Informative References. 62 8.5.2 Subscribed . . . . . . . . . . . . . . . . . .76 Authors' Addresses. . . . . . 62 8.5.3 Unsubscribe . . . . . . . . . . . . . . .76 A. vCards. . . . . . . . 63 8.5.4 Unsubscribed . . . . . . . . . . . . . . . . . . .77 B. XML Schemas. . . . 63 8.6 Server Delivery and Client Acknowledgement of Subscription State Change Notifications . . . . . . . . . 63 9. Blocking Communication . . . . . . . . . . .78 B.1 session. . . . . . . 65 9.1 Syntax . . . . . . . . . . . . . . . . . . .78 B.2 jabber:iq:last. . . . . . . 65 9.2 Business Rules . . . . . . . . . . . . . . . .78 B.3 jabber:iq:privacy. . . . . . 67 9.3 Retrieving One's Privacy Lists . . . . . . . . . . . . . . 68 9.4 Managing Active Lists .78 B.4 jabber:iq:roster. . . . . . . . . . . . . . . . . 71 9.5 Managing the Default List . . . . .81 C. Revision History. . . . . . . . . . . 72 9.6 Editing a Privacy List . . . . . . . . . . .83 C.1 Changes from draft-ietf-xmpp-im-13. . . . . . . 73 9.7 Adding a New Privacy List . . . . . .83 C.2 Changes from draft-ietf-xmpp-im-12. . . . . . . . . . 74 9.8 Removing a Privacy List . . .83 C.3 Changes from draft-ietf-xmpp-im-11. . . . . . . . . . . . .83 C.4 Changes from draft-ietf-xmpp-im-10. 74 9.9 Blocking Messages . . . . . . . . . . . .83 C.5 Changes from draft-ietf-xmpp-im-09. . . . . . . . 75 9.10 Blocking Inbound Presence Notifications . . . . .84 C.6 Changes from draft-ietf-xmpp-im-08. . . . 76 9.11 Blocking Outbound Presence Notifications . . . . . . . . .84 C.7 Changes from draft-ietf-xmpp-im-0778 9.12 Blocking IQs . . . . . . . . . . . . .84 C.8 Changes from draft-ietf-xmpp-im-06. . . . . . . . . . 80 Saint-Andre & Miller Expires January 26, 2004 [Page 3] Internet-Draft XMPP Instant Messaging July 2003 9.13 Blocking All Communication . . .84 C.9 Changes from draft-ietf-xmpp-im-05. . . . . . . . . . . . .85 C.10 Changes from draft-ietf-xmpp-im-0481 9.14 Blocked Entity Attempts to Communicate with User . . . . . 83 9.15 Higher-Level Heuristics . . . . . . . .85 C.11 Changes from draft-ietf-xmpp-im-03. . . . . . . . . 84 10. Server Rules for Handling XML Stanzas . . . .85 C.12 Changes from draft-ietf-xmpp-im-02. . . . . . 86 10.1 No 'to' Address . . . . . . . .85 C.13 Changes from draft-ietf-xmpp-im-01. . . . . . . . . . . . . 86C.14 Changes from draft-ietf-xmpp-im-0010.2 Foreign Domain . . . . . . . . . . . . . . . . . . . . . . 86C.15 Changes from draft-miller-xmpp-im-0210.3 Subdomain . . . . . . . . . . . . . . . . . . . . . . . . 86Intellectual Property and Copyright Statements10.4 Bare Domain or Specific Resource . . . . . . .87 Saint-Andre & Miller Expires December 28, 2003 [Page 3] Internet-Draft XMPP Instant Messaging June 2003 1. Introduction 1.1 Overview The core features of the Extensible Messaging and Presence Protocol are defined. . . . . . 86 10.5 User inXMPP Core [1]. These features -- specificallySame Domain . . . . . . . . . . . . . . . . . . . 87 11. IANA Considerations . . . . . . . . . . . . . . . . . . . 89 11.1 XMLstreams, stream authentication and encryption, and the <message/>, <presence/>, and <iq/> children of the stream root -- provide the building blocksNamespace Name formany types of near-real-time applications, which may be layered on top of the core by sending application-specific data qualified by particular XML namespaces. This document describes extensions to and applications of XMPP Core that provide the basic functionality expected of an instant messaging (IM) and presence application as defined in RFC 2779 [2]. 1.2 Requirements For the purposes of this document, the requirementsSession Data . . . . . . . . . . . 89 12. Security Considerations . . . . . . . . . . . . . . . . . 90 Normative References . . . . . . . . . . . . . . . . . . . 91 Informative References . . . . . . . . . . . . . . . . . . 92 Authors' Addresses . . . . . . . . . . . . . . . . . . . . 92 A. vCards . . . . . . . . . . . . . . . . . . . . . . . . . . 93 B. XML Schemas . . . . . . . . . . . . . . . . . . . . . . . 94 B.1 session . . . . . . . . . . . . . . . . . . . . . . . . . 94 B.2 jabber:iq:last . . . . . . . . . . . . . . . . . . . . . . 94 B.3 jabber:iq:privacy . . . . . . . . . . . . . . . . . . . . 94 B.4 jabber:iq:roster . . . . . . . . . . . . . . . . . . . . . 97 C. Revision History . . . . . . . . . . . . . . . . . . . . . 99 C.1 Changes from draft-ietf-xmpp-im-14 . . . . . . . . . . . . 99 C.2 Changes from draft-ietf-xmpp-im-13 . . . . . . . . . . . . 99 C.3 Changes from draft-ietf-xmpp-im-12 . . . . . . . . . . . . 99 C.4 Changes from draft-ietf-xmpp-im-11 . . . . . . . . . . . . 99 C.5 Changes from draft-ietf-xmpp-im-10 . . . . . . . . . . . . 100 C.6 Changes from draft-ietf-xmpp-im-09 . . . . . . . . . . . . 100 C.7 Changes from draft-ietf-xmpp-im-08 . . . . . . . . . . . . 100 C.8 Changes from draft-ietf-xmpp-im-07 . . . . . . . . . . . . 100 C.9 Changes from draft-ietf-xmpp-im-06 . . . . . . . . . . . . 101 C.10 Changes from draft-ietf-xmpp-im-05 . . . . . . . . . . . . 101 C.11 Changes from draft-ietf-xmpp-im-04 . . . . . . . . . . . . 101 C.12 Changes from draft-ietf-xmpp-im-03 . . . . . . . . . . . . 101 C.13 Changes from draft-ietf-xmpp-im-02 . . . . . . . . . . . . 102 C.14 Changes from draft-ietf-xmpp-im-01 . . . . . . . . . . . . 102 C.15 Changes from draft-ietf-xmpp-im-00 . . . . . . . . . . . . 102 C.16 Changes from draft-miller-xmpp-im-02 . . . . . . . . . . . 102 Intellectual Property and Copyright Statements . . . . . . 104 Saint-Andre & Miller Expires January 26, 2004 [Page 4] Internet-Draft XMPP Instant Messaging July 2003 1. Introduction 1.1 Overview The core features of the Extensible Messaging and Presence Protocol are defined in XMPP Core [1]. These features -- specifically XML streams, stream authentication and encryption, and the <message/>, <presence/>, and <iq/> children of the stream root -- provide the building blocks for many types of near-real-time applications, which may be layered on top of the core by sending application-specific data qualified by particular XML namespaces. This document describes extensions to and applications of XMPP Core that provide the basic functionality expected of an instant messaging (IM) and presence application as defined in RFC 2779 [2]. 1.2 Requirements For the purposes of this document, the requirements of a basic instant messaging and presence application are defined by RFC 2779 [2]. At a high level, RFC 2779 stipulates that a user must be able to complete the following use cases: o Exchange messages with other users o Exchange presence information with other users o Manage subscriptions to and from other users o Manage items in a contact list (in XMPP this is called a "roster") o Block communications to or from specific other users Detailed definitions of these functionality areas are contained in RFC 2779, and the interested reader is directed to that document regarding the requirements addressed herein. Note: while XMPP-based instant messaging and presence meets the requirements of RFC 2779, it was not designed explicitly with RFC 2779 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 protocols addressing many other functionality areas have been defined in the Jabber community, such protocols are not included in this document because they are not required by RFC 2779 [2]. 1.3 Terminology This document inherits the terminology defined in XMPP Core [1]. Saint-Andre & Miller Expires January 26, 2004 [Page 5] Internet-Draft XMPP Instant Messaging July 2003 The capitalized key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [3]. 1.4 Discussion Venue The authors welcome discussion and comments related to the topics presented in this document. The preferred forum is the <xmppwg@jabber.org> mailing list, for which archives and subscription information are available at <http://www.jabber.org/cgi-bin/mailman/ listinfo/xmppwg/>. 1.5 Intellectual Property Notice This document is in full compliance with all provisions of Section 10 of RFC 2026. Parts of this specification use the term "jabber" for identifying namespaces and other protocol syntax. Jabber[tm] is a registered trademark of Jabber, Inc. Jabber, Inc. grants permission to the IETF for use of the Jabber trademark in association with this specification and its successors, if any. Saint-Andre & Miller Expires January 26, 2004 [Page 6] Internet-Draft XMPP Instant Messaging July 2003 2. Establishing a Session Most instant messaging and presence applications based on XMPP are implemented via a client-server architecture that requires a user to establish a session on a server in order to engage in the expected instant messaging and presence activities. However, there are several pre-conditions that must be met before a user may establish such a session. These include: 1. Account Provisioning -- methods for account provisioning include account creation by a server administrator as well as in-band account registration using the 'jabber:iq:register' namespace; the latter method is documented by the Jabber Software Foundation [4] at <http://www.jabber.org/protocol/> but is out of scope for this document. 2. Authentication and Resource Authorization -- methods for completing these pre-conditions are documented in XMPP Core [1]; note that client authentication with a server MUST include an authorization identity that specifies the full JID (<user@somedomain/resource>) associated with the connection for addressing purposes. Once a client has authenticated with a server and has authorized a full JID, it SHOULD request that the server activate an instant messaging session for the client. This is accomplished by means of the 'urn:ietf:params:xml:ns:xmpp-session' namespace: Step 1: Client requests session with server: <iq type='set' id='sess_1'> <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/> </iq> Step 2: Server informs client that session has been created: <iq type='result' id='sess_1'/> Several error conditions are possible. For example, the server may encounter an internal condition that prevents it from creating the session, the username or authorization identity may lack permissions to create a session, or there may already be an active session associated with an authzid of the same name. If the server encounters an internal condition that prevents it from creating the session, it MUST return an error. Saint-Andre & Miller Expires January 26, 2004 [Page 7] Internet-Draft XMPP Instant Messaging July 2003 Step 2 (alt): Server responds with error (internal server error): <iq type='error' id='sess_1'> <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/> <error type='wait'> <internal-server-error xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq> If the username or authorization identity is not allowed to create a session, the server MUST return an error. Step 2 (alt): Server responds with error (username or authzid not allowed to create session): <iq type='error' id='sess_1'> <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/> <error type='auth'> <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq> If there is already an active session associated with an authzid of the same name, the server MUST either (1) terminate the active session and allow the newly-requested session, or (2) disallow the newly-requested session and maintain the existing session. Which of these the server does is up to the implementation, although it is RECOMMENDED to implement (1). Step 2 (alt): Server informs client of resource conflict (the desired resource name is already in use by another active connection): <iq type='error' id='sess_1'> <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/> <error type='cancel'> <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq> After establishing a session, a client SHOULD send initial presence and request its roster as described below, although these actions are NOT REQUIRED. Saint-Andre & Miller Expires January 26, 2004 [Page 8] Internet-Draft XMPP Instant Messaging July 2003 3. Exchanging Messages Exchanging messages is a basic use of XMPP and is effected when a user generates a message stanza that is addressed to another user (or, more generally, another entity). As defined under Section 10, the sender's server is responsible for delivering the message to the intended recipient (if the recipient is on the same server) or for routing the message to the recipient's server (if the recipient is on a different server). For information regarding the syntax of message stanzas as well as their defined attributes and child elements, refer to XMPP Core [1]. 3.1 Specifying an Intended Recipient An instant messaging client SHOULD specify an intended recipient for a message by providing the JID of an entity other than the sender in the 'to' attribute of the <message/> stanza. If the message is being sent in reply to a message previously received from an address of the form <user@somedomain/resource> (e.g., within the context of a chat session), the value of the 'to' address SHOULD be the full JID (<user@somedomain/resource>) rather than merely <user@somedomain> unless the sender has knowledge (via presence) that the intended recipient's resource is no longer available. If the message is being sent outside the context of any existing chat session or received message, the value of the 'to' address SHOULD be of the form <user@somedomain> rather than <user@somedomain/resource>. 3.2 Specifying a Message Type As mentioned in XMPP Core [1], there are several defined types of messages (specified by means of a 'type' attribute within the <message/> element). In the context of an instant messaging application, a client SHOULD include a message type in order to capture the conversational context of the message, thus providing a hint regarding presentation (e.g., in a GUI). If the 'type' attribute is included, it SHOULD have one of the following values (any other value MAY be ignored): o chat -- The message is sent in the context of a one-to-one chat conversation. A compliant client SHOULD present an interface enabling one-to-one chat between the two parties, including an appropriate conversation history. o error -- An error has occurred related to a previous message sent by the sender (for details regarding stanza error syntax, refer to XMPP Core [1]). A compliant client SHOULD present an appropriate interface informing the sender of the nature of the error. Saint-Andre & Miller Expires January 26, 2004 [Page 9] Internet-Draft XMPP Instant Messaging July 2003 o groupchat -- The message is sent in the context of a multi-user chat environment. A compliant client SHOULD present an interface enabling many-to-many chat between the parties, including a roster of parties in the chatroom and an appropriate conversation history. o headline -- The message is probably generated by an automated service that delivers or broadcasts content (news, sports, market information, RSS feeds, etc.). No reply to the message is expected, and a compliant client SHOULD present an interface that appropriately differentiates the message from standalone messages, chat sessions, or groupchat sessions (e.g., by not providing the recipient with the ability to reply). o normal -- The message is a standalone message to which the recipient MAY reply if desired. This is the default type. An IM application SHOULD support all of the foregoing message types; if an application receives abasic instant messaging and presencemessage with no 'type' attribute or the applicationare defined by RFC 2779 [2]. Atdoes not understand the value of the 'type' attribute provided, it MUST consider the message to be of type "normal". Although the 'type' attribute is NOT REQUIRED, it is considered polite to mirror the type in any replies to ahigh level, RFC 2779 stipulates thatmessage; furthermore, some specialized applications (e.g., auser mustmulti-user chat service) MAY at their discretion enforce the use of a particular message type (e.g., type='groupchat'). 3.3 Specifying a Message Body A message stanza MAY (and often will) contain a child <body/> element specifying the primary meaning of the message. The content of the body element MUST be XML character data and the element MUST NOT contain mixed content. If it is necessary to provide the primary meaning in an alternate form (e.g., formatted using XHTML), the alternate form MUST be contained in some other child of the message stanza. However, multiple <body/> elements MAY beableincluded tocompleteprovide thefollowing use cases: o Exchange messages with other users o Exchange presence information with other users o Manage subscriptions to and from other users o Manage itemsprimary meaning in different languages, as long as each such element possesses an 'xml:lang' attribute with acontact list (indistinct value. Saint-Andre & Miller Expires January 26, 2004 [Page 10] Internet-Draft XMPPthis is calledInstant Messaging July 2003 Example: A message with a"roster") o Block communications tobody: <message to='romeo@example.net' from='juliet@example.com/balcony' xml:lang='en'> <body>Wherefore art thou, Romeo?</body> <body xml:lang='cz'>PročeŽ jsi ty, Romeo?</body> </message> 3.4 Specifying a Message Subject A message stanza MAY contain one orfrom specific other users Detailed definitionsmore child <subject/> elements specifying the topic ofthese functionality areas are contained in RFC 2779, andtheinterested reader is directed to that document regardingmessage. The content of therequirements addressed herein. Note: while XMPP-based instant messagingsubject element MUST be XML character data andpresence meetstherequirements of RFC 2779, it was not designed explicitlyelement MUST NOT contain mixed content. Multiple <subject/> elements MAY be included, as long as each such element possesses an 'xml:lang' attribute withRFC 2779a distinct value. Example: A message with a subject: <message to='romeo@example.net' from='juliet@example.com/balcony' xml:lang='en'> <subject>I implore you!</subject> <subject xml:lang='cz'> Úpěnlivě prosim! </subject> <body>Wherefore art thou, Romeo?</body> <body xml:lang='cz'> PročeŽ jsi ty, Romeo? </body> </message> 3.5 Specifying a Conversation Thread A message stanza MAY contain a child <thread/> element specifying the conversation thread inmind, sincewhich thebase protocol evolved through an open development process withinmessage is situated, for theJabber open-source community before RFC 2779 was written. Note alsopurpose of tracking the conversation. The content of the <thread/> element is a random string thatalthough protocols addressing many other functionality areas have been defined inis generated by theJabber community, such protocols are not includedsender inthis document because they are not required by RFC 2779 [2]. 1.3 Terminology This document inheritsaccordance with theterminology definedalgorithm specified in XMPP Core[1].[1]; this string SHOULD be copied back to the sender in subsequent replies. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page4]11] Internet-Draft XMPP Instant MessagingJuneJuly 2003The capitalized key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [3]. 1.4 Discussion Venue The authors welcome discussion and comments related to the topics presented in this document. The preferred forum is the <xmppwg@jabber.org> mailing list, for which archives and subscription information are available at <http://www.jabber.org/cgi-bin/mailman/ listinfo/xmppwg/>. 1.5 Intellectual Property Notice This document is in full compliance with all provisions of Section 10 of RFC 2026. Parts of this specification use the term "jabber" for identifying namespacesExample: A threaded conversation: <message to='romeo@example.net/orchard' from='juliet@example.com/balcony' type='chat'> <body>Art thou not Romeo, andother protocol syntax. Jabber[tm] isaregistered trademark of Jabber, Inc. Jabber, Inc. grants permission to the IETF for use of the Jabber trademark in association with this specification and its successors,Montague?</body> <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread> </message> <message to='juliet@example.com/balcony' from='romeo@example.net/orchard' type='chat'> <body>Neither, fair saint, ifany.either thee dislike.</body> <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread> </message> <message to='romeo@example.net/orchard' from='juliet@example.com/balcony' type='chat'> <body>How cam'st thou hither, tell me, and wherefore?</body> <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread> </message> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page5]12] Internet-Draft XMPP Instant MessagingJuneJuly 20032. Establishing a Session Most instant messaging and4. Exchanging Presence Information Exchanging presenceapplications based oninformation is made relatively straightforward within XMPPare implemented via a client-server architecture that requiresby using presence stanzas. However, we see here ausercontrast toestablish a session onthe handling of messages: although aserver in orderclient MAY send directed presence information toengage in the expected instant messaging andanother entity, normally presenceactivities. However, there are several pre-conditions that must be met before a user may establish suchinformation is sent from asession. These include: 1. Account Provisioning -- methods for account provisioning include account creationclient to its server (with no 'to' address) and then broadcasted byathe serveradministrator as well as in-band account registration usingto any entities that are subscribed to the'jabber:iq:register' namespace;presence of thelatter method is documented bysending entity. (Note: in theJabber Software Foundation [4] at <http://www.jabber.org/protocol/> but is outterminology ofscope for this document. 2. Authentication and Resource Authorization -- methods for completing these pre-conditions are documentedRFC 2778 [5], the only watchers in XMPPCore [1]; note that client authentication with a server MUST include an authorization identity that specifies the full JID (<user@domain/ resource>) associated withare subscribers.) For information regarding theconnection for addressing purposes. Once a client has authenticated with a serversyntax of presence stanzas as well as their defined attributes andhas authorizedchild elements, refer to XMPP Core [1]. 4.1 Client and Server Responsibilities When afull JID,client connects to its server, it SHOULDrequest that(but is NOT REQUIRED to) send initial presence to the serveractivate an instant messaging sessionin order to signal its availability for communications. As defined herein, theclient. Thisinitial presence stanza (1) MUST possess no 'to' address (signalling that it isaccomplishedmeant to be handled bymeansthe server on behalf of the'urn:ietf:params:xml:ns:xmpp-session' namespace: Step 1: Client requests session with server: <iq type='set' id='sess_1'> <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/> </iq> Step 2: Server informs client that session has been created: <iq type='result' id='sess_1'/> Several error conditions are possible. For example,user) and (2) MUST possess no 'type' attribute (signalling theserver may encounter an internal condition that prevents ituser's availability). Upon receiving initial presence fromcreatinga client, thesession,user's server MUST do theusername or authorization identity may lack permissionsfollowing: 1. Send presence probes (i.e., presence stanzas whose 'type' attribute is set tocreateasession, or there may already be an active session associated with an authzidvalue of "probe") from thesame name. Iffull JID (<user@somedomain/resource>) of theserver encounters an internal condition that prevents it from creatinguser to thesession, it MUST return an error. Saint-Andre & Miller Expires December 28, 2003 [Page 6] Internet-Draft XMPP Instant Messaging June 2003 Step 2 (alt): Server respondsbare JID (<contact@otherdomain>) of any contacts to which the user is subscribed in order to determine if they are available; such contacts are those which are present in the user's roster witherror (internal server error): <iq type='error' id='sess_1'> <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/> <error type='wait'> <internal-server-error xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq> Iftheusername or authorization identity is not allowed'subscription' attribute set to a value of "to" or "both". (Note: a user or client SHOULD NOT send presence probes.) 2. Broadcast initial presence from the full JID (<user@somedomain/ resource>) of the user tocreate a session,theserver MUST return an error. Step 2 (alt): Server responds with error (username or authzid not allowedbare JID (<contact@otherdomain>) of any contacts that are subscribed tocreate session): <iq type='error' id='sess_1'> <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/> <error type='auth'> <not-allowed xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq> If there is already an active session associatedthe user's presence; such contacts are those which are present in the user's roster withan authzidthe 'subscription' attribute set to a value of "from" or "both". Upon receiving a presence probe from thesame name,user, the contact's server MUSTeither (1) terminatesend to theactive session and allowuser thenewly-requested session, or (2) disallowlast known availability information (i.e., thenewly-requested session and maintainfull XML of theexisting session. Whichlast presence stanza) provided by each ofthesethe contact's active sessions (if there exist no active sessions, the serverdoes is upSHOULD NOT reply to theimplementation, although it is RECOMMENDED to implement (1). Step 2 (alt): Server informs client of resource conflict (the desired resource name is already in use by another active connection): <iq type='error' id='sess_1'> <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/> <error type='cancel'> <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq> After establishing a session, a client SHOULD send initialpresenceand request its roster as described below, although these actions are NOT REQUIRED.probe). The server MUST send Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page7]13] Internet-Draft XMPP Instant MessagingJuneJuly 20033. Exchanging Messages Exchanging messagesthis information subject to domain-specific access rules, and only if the user is in the contact's roster with abasic usesubscription state ofXMPP"from" or "both" andis effected whenthe contact has not blocked outbound presence notifications to the user's bare or full JID (as defined in Section 9.11). (Note: if the server receives auser generatespresence probe from amessage stanza that is addressed tosubdomain of the server's hostname or another such trusted service, it MAY provide presence information about the user(or, more generally, another entity). As defined under Section 9,to that entity.) Upon receiving initial presence from thesender'suser, the contact's serveris responsible for deliveringMUST deliver themessageuser's presence stanza to theintended recipient (iffull JIDs (<contact@otherdomain/resource>) associated with all of therecipientcontact's active sessions, but only if the user isonin thesame server)contact's roster with a subscription state of "to" orfor routing"both" and themessage tocontact has not blocked inbound presence notifications from therecipient'suser's bare or full JID (as defined in Section 9.10). If the user's server(ifreceives a presence stanza of type "error" in response to therecipient isinitial presence that it forwarded to a contact on behalf of the user, it SHOULD NOT send further presence updates to that contact (until and unless it receives adifferent server). For information regardingpresence probe from thesyntax of message stanzas as well as their defined attributescontact). After sending initial presence, the user MAY update andchild elements, refer to XMPP Core [1]. 3.1 Specifying an Intended Recipient An instant messagingbroadcast its presence information at any time during its active session by sending a presence stanza with no 'to' address and either no 'type' attribute or a 'type' attribute with a value of "unavailable". (Note: a user's client SHOULDspecify an intended recipient forNOT send amessage by providing the JIDpresence update to broadcast information that changes independently ofan entity other thanthesender inuser's presence and availability.) If the'to'presence stanza lacks a 'type' attributeof(i.e., expresses availability), the<message/> stanza. Ifuser's server MUST broadcast themessage is being sent in replyfull XML of that presence stanza to all contacts (1) that are in the user's roster with amessage previously received from an addresssubscription type of "from" or "both", (2) to whom theform <user@domain/resource> (e.g., withinuser has not blocked outbound presence, and (3) from whom thecontext ofserver has not received achat session),presence error during the user's session. If the presence stanza has a 'type' attribute set to a value of "unavailable", the'to' address SHOULD beuser's server MUST broadcast the fullJID (<user@domain/resource>) rather than merely <user@domain> unless the sender has knowledge (via presence)XML of that presence stanza to all contacts meeting theintended recipient's resource is no longer available. Ifthree conditions just mentioned, as well as to any entities to which themessage is beinguser has sentoutsidedirected available presence during thecontext of any existing chatuser's sessionor received message, the value of the 'to' address SHOULD be of(if theform <user@domain> rather than <user@domain/resource>. 3.2 Specifyinguser has not yet sent directed unavailable presence to that entity). A user MAY send directed presence to another entity (i.e., aMessage Type As mentioned in XMPP Core [1], there are several defined types of messages (specified by meanspresence stanza with a 'to' attribute whose value is the JID of the other entity and with either no 'type' attribute or a 'type' attributewithin the <message/> element). Inwhose value is "unavailable"). There are three possible cases: 1. If thecontext of an instant messaging application,user sends directed presence to aclient SHOULD includecontact that is in the user's roster with amessagesubscription typein order to captureof "from" or "both" after Saint-Andre & Miller Expires January 26, 2004 [Page 14] Internet-Draft XMPP Instant Messaging July 2003 having sent initial presence and before sending unavailable presence broadcast, theconversational contextuser's server MUST route or deliver the full XML of that presence stanza (subject to privacy rules) but SHOULD NOT otherwise modify themessage, thus providing a hintcontact's status regardingpresentation (e.g., in a GUI). If the 'type' attribute is included,presence broadcast (i.e., it SHOULDhave one ofinclude thefollowing values (any other value MAY be ignored): o chat -- The message is sentcontact's JID in any subsequent presence broadcasts initiated by thecontext of a one-to-one chat conversation. A compliant client SHOULD present an interface enabling one-to-one chat betweenuser). 2. If thetwo parties, including an appropriate conversation history. o error -- An error has occurred relateduser sends directed presence to an entity that is not in the user's roster with aprevious messagesubscription type of "from" or "both" after having sentbyinitial presence and before sending unavailable presence broadcast, thesender (for details regarding stanza error syntax, refer to XMPP Core [1]). A compliant client SHOULD present an appropriate interface informinguser's server MUST route or deliver the full XML of that presence stanza to thesender ofentity but MUST NOT modify thenature ofcontact's status regarding available presence broadcast (i.e., it MUST NOT include theerror. Saint-Andre & Miller Expires December 28, 2003 [Page 8] Internet-Draft XMPP Instant Messaging June 2003 o groupchat -- The message is sententity's JID inthe contextany subsequent broadcasts ofa multi-user chat environment. A compliant client SHOULD present an interface enabling many-to-many chat betweenavailable presence initiated by theparties, including a roster of parties inuser); however, if thechatroom and an appropriate conversation history. o headline -- The message is probably generated by an automated serviceconnected resource from which the user sent the directed presence become unavailable, the user's server MUST broadcast thatdelivers or broadcasts content (news, sports, market information, RSS feeds, etc.). No replyunavailable presence to themessage is expected, and a compliant client SHOULD present an interfaceentity (if the user has not yet sent directed unavailable presence to thatappropriately differentiatesentity). 3. If themessage from standalone messages, chat sessions,user sends directed presence without first sending initial presence orgroupchat sessions (e.g., by not providingafter having sent unavailable presence broadcast, therecipient withuser's server MUST treat theability to reply). o normal -- The message is a standalone messageentities to which therecipient MAY reply if desired. This isuser sends directed presence in thedefault type. An IM application SHOULD support all ofsame way that it treats theforegoing message types; if an application receivesentities listed in Case 2 above. Before ending its session with a server, a client SHOULD gracefully become unavailable by sending amessage withfinal presence stanza that possesses no 'to' attribute and that possesses a 'type' attribute whose value is "unavailable" (optionally, the final presence stanza MAY contain one or more <status/> elements specifying theapplication does not understandreason why thevalue ofuser is no longer available). However, the'type' attribute provided, ituser's server MUSTconsiderNOT depend on receiving final presence from an available resource, since themessage to beresource may become unavailable unexpectedly. If the user's server detects that one oftype "normal". Althoughthe'type' attribute is NOT REQUIRED,user's resources has become unavailable for any reason (either gracefully or ungracefully), itis considered politeMUST broadcast unavailable presence tomirror the typeall contacts (1) that are inany replies to a message; furthermore, some specialized applications (e.g., a multi-user chat service) MAY at their discretion enforcetheuse ofuser's roster with aparticular messagesubscription type(e.g., type='groupchat'). 3.3 Specifyingof "from" or "both", (2) to whom the user has not blocked outbound presence, and (3) from whom the server has not received aMessage Body A messagepresence error during the user's session; the user's server MUST also send that unavailable presence stanzaMAY (and often will) contain a child <body/> element specifyingto any entities to which theprimary meaning ofuser has sent directed presence during themessage. The content ofuser's session for that resource (if thebody element MUST be XML character datauser has not yet sent directed unavailable presence to that entity). Any presence stanza with no 'type' attribute andthe element MUST NOT contain mixed content. If itno 'to' attribute that isnecessary to provide the primary meaning in an alternate form (e.g., formatted using XHTML), the alternate formsent after sending directed unavailable presence or broadcasted unavailable presence MUST becontained in some other child ofbroadcasted by themessage stanza. However, multiple <body/> elements MAY be includedserver toprovide the primary meaning in different languages, as long as each such element possesses an 'xml:lang' attribute with a distinct value.all subscribers. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page9]15] Internet-Draft XMPP Instant MessagingJuneJuly 2003Example: A message with a body: <message to='romeo@montague.net' from='juliet@capulet.com/balcony' xml:lang='en'> <body>Wherefore art thou, Romeo?</body> <body xml:lang='cz'>PročeŽ jsi ty, Romeo?</body> </message> 3.44.2 Specifyinga Message SubjectAvailability Status Amessage stanzaclient MAYcontain oneprovide further information about its availability status by using the <show/> element. As mentioned in XMPP Core [1], the recognized values for the show element are: o away -- The entity ormore child <subject/> elements specifyingresource is temporarily away. o chat -- The entity or resource is actively interested in chatting. o xa -- The entity or resource is away for an extended period (xa = "eXtended Away"). o dnd -- The entity or resource is busy (dnd = "Do Not Disturb"). Example: Availability status: <presence> <show>dnd</show> </presence> If no <show/> element is provided, thetopicentity is assumed to be online and available. 4.3 Specifying Detailed Status Information In conjunction with the <show/> element, a client MAY provide detailed status information by using the <status/> element. The content of this element is a natural-language description of themessage.user's current availability status. The content of thesubjectstatus element MUST be XML character data and the element MUST NOT contain mixed content. Multiple<subject/><status/> elements MAY be included, as long as each such element possesses an 'xml:lang' attribute with a distinct value.Example: A message with a subject: <message to='romeo@montague.net' from='juliet@capulet.com/balcony'Example: Detailed status information: <presence xml:lang='en'><subject>I implore you!</subject> <subject xml:lang='cz'> Úpěnlivě prosim! </subject> <body>Wherefore art thou, Romeo?</body> <body xml:lang='cz'> PročeŽ jsi ty, Romeo? </body> </message> 3.5<show>dnd</show> <status>Wooing Juliet</status> <status xml:lang='cz'>Ja dvořím Juliet</status> </presence> 4.4 Specifyinga Conversation ThreadPresence Priority Amessage stanzaclient MAYcontainprovide achild <thread/> element specifying the conversation thread in which the message is situated,priority for its resource by using thepurpose of tracking the conversation.<priority/> element. The content ofthe <thread/>this element isa random string thatan integer whose value isgenerated by the sender in accordance with the algorithm specified in XMPP Core [1]; this string SHOULD be copied back to the sender in subsequent replies. Saint-Andre & Miller Expires December 28, 2003 [Page 10] Internet-Draft XMPP Instant Messaging June 2003 Example: A threaded conversation: <message to='romeo@montague.net/orchard' from='juliet@capulet.com/balcony' type='chat'> <body>Art thou not Romeo,between -128 and +127. If aMontague?</body> <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread> </message> <message to='juliet@capulet.com/balcony' from='romeo@montague.net/orchard' type='chat'> <body>Neither, fair saint, if either thee dislike.</body> <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread> </message> <message to='romeo@montague.net/orchard' from='juliet@capulet.com/balcony' type='chat'> <body>How cam'st thou hither, tell me, and wherefore?</body> <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread> </message>client does not provide the Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page11]16] Internet-Draft XMPP Instant MessagingJuneJuly 20034. Exchanging Presence Information Exchangingpriority element in a presenceinformationstanza, its server SHOULD assume that the priority value ismade relatively straightforward within XMPP by using presence stanzas. However, we see herezero. Example: Presence priority: <presence xml:lang='en'> <show>dnd</show> <status>Wooing Juliet</status> <status xml:lang='cz'>Ja dvořím Juliet</status> <priority>1</priority> </presence> 4.5 Determining When acontrast to the handlingContact Went Offline The server MUST maintain a record ofmessages: althoughthe time at which aclient MAY send directed presence informationuser became unavailable (whether gracefully or ungracefully). An authorized subscriber toanother entity, normallythat user's presenceinformation is sent from a clientMAY request the time of last activity by sending an IQ stanza toits server (with no 'to' address) and then broadcastedthe user's bare JID (<user@somedomain>) containing an empty <query/> element qualified by theserver to any entities that are subscribed to'jabber:iq:last' namespace: Example: Requesting thepresencelast active time of an offline user: <iq type='get' to='user@somedomain'> <query xmlns='jabber:iq:last'/> </iq> If thesending entity. (Note: inentity requesting theterminologytime ofRFC 2778 [5],last activity is an authorized subscriber to theonly watchersuser's presence (i.e., exists inXMPP are subscribers.) For information regardingthesyntax of presence stanzas as well as their defined attributes and child elements, referuser's roster with the 'subscription' attribute set toXMPP Core [1]. 4.1 Client and Server Responsibilities Whenaclient connects to its server, it SHOULD (butvalue of "from" or "both") and the user isNOT REQUIRED to) send initial presencenot blocking IQ stanzas to and from theserver in order to signal its availability for communications. Asentity (as definedherein,in Section 9.12), theinitial presenceserver SHOULD return an IQ stanza(1) MUST possess no 'to' address (signalling that it is meant to be handled byof type "result" with theserver on behalfnumber of seconds since theuser) and (2) MUST possess no 'type' attribute (signallinguser was last active: Example: Returning the last active time of an offline user: <iq from='user@somedomain' type='result' to='contact@otherdomain/resource'> <query seconds='76490' xmlns='jabber:iq:last'/> </iq> If the entity requesting the time of last activity is not an authorized subscriber to the user'savailability). Upon receiving initialpresencefrom a client,(i.e., does not exist in the user'sserver MUST doroster with thefollowing: 1. Send presence probes (i.e., presence stanzas whose 'type''subscription' attributeisset to a value of"probe") from"from" or "both"), thefull JID (<user@domain/resource>)server MUST return an IQ stanza ofthe usertype "error" with an error condition of forbidden: Saint-Andre & Miller Expires January 26, 2004 [Page 17] Internet-Draft XMPP Instant Messaging July 2003 Example: Requester is forbidden to view thebare JID (<user@domain>)last active time ofany contactsan offline user: <iq from='user@somedomain' type='error' to='contact@otherdomain/resource'> <query xmlns='jabber:iq:last'/> <error type='auth'> <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq> Note: this document defines responses towhich the user is subscribed in orderrequests for last active time only with regard todetermine if they are available; such contacts are those which are present inJIDs of theuser's rosterform <user@somedomain>, and only withthe 'subscription' attribute setregard toa valueJIDs that correspond to an (offline) instant messaging user. The behavior of"to"other JID forms (e.g., <user@somedomain/ resource> or"both". (Note: a<somedomain>) and entity types (e.g., online user orclient SHOULD NOT send presence probes.) 2. Broadcast initial presence from the full JID (<user@domain/ resource>)host) is out of scope and undefined. 4.6 Presence Examples The examples in this section illustrate the presence-related protocols described above. The usertois romeo@example.net, he has authorized a resource "orchard", and he has thebare JID (<user@domain>) of any contacts that are subscribedfollowing individuals in his roster: o juliet@example.com (subscription="both" and she has two active sessions, one whose resource is "chamber" and another whose resource is "balcony") o benvolio@example.org (subscription="to") o mercutio@shakespeare.lit (subscription="from") Example 1: User sends initial presence: <presence/> Saint-Andre & Miller Expires January 26, 2004 [Page 18] Internet-Draft XMPP Instant Messaging July 2003 Example 2: User's server sends presence probe tothe user's presence; suchcontactsare those which are present inwith subscription="to" and subscription="both" on behalf of the user'srosterconnected 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'/> Example 3: User's server sends initial presence to contacts with subscription="from" and subscription="both" on behalf of the'subscription' attribute setuser's connected resource: <presence from='romeo@example.net/orchard' to='juliet@example.com'/> <presence from='romeo@example.net/orchard' to='mercutio@shakespeare.lit'/> Saint-Andre & Miller Expires January 26, 2004 [Page 19] Internet-Draft XMPP Instant Messaging July 2003 Example 4: Contacts' server replies toa value of "from" or "both". Upon receiving apresence probefrom the user,on behalf of all of the contact's 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> Example 5: Contact's serverMUST senddelivers user's initial presence to all of the contact's available resources or returns 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@shakespeare.lit' to='romeo@example.net/orchard'> <error type='cancel'> <remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </presence> Saint-Andre & Miller Expires January 26, 2004 [Page 20] Internet-Draft XMPP Instant Messaging July 2003 Example 6: User sends directed presence to another userthe last known availabilitynot 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> Example 7: User sends updated available presence information(i.e.,for broadcasting: <presence xml:lang='en'> <show>away</show> <status>I shall return!</status> <priority>1</priority> </presence> Example 8: Updated presence information is delivered only to one contact (not those from whom an error was received or to whom thefull XMLuser sent directed presence): <presence from='romeo@example.net/orchard' to='juliet@example.com/chamber' xml:lang='en'> <show>away</show> <status>I shall return!</status> <priority>1</priority> </presence> <presence from='romeo@example.net/orchard' to='juliet@example.com/balcony' xml:lang='en'> <show>away</show> <status>I shall return!</status> <priority>1</priority> </presence> Example 9: One of thelastcontact's resources sends final presence: <presence type='unavailable'/> Saint-Andre & Miller Expires January 26, 2004 [Page 21] Internet-Draft XMPP Instant Messaging July 2003 Example 10: Contact's server sends unavailable presence information to user: <presence type='unavailable' from='juliet@example.com/balcony' to='romeo@example.net/orchard'/> Example 11: User sends final presence: <presence type='unavailable' xml:lang='en'> <status>gone home</status> </presence> Example 12: Unavailable presencestanza) provided by each of theinformation is delivered to contact'sactive sessions (if there exist no active sessions,one remaining resource as well as to theserver SHOULD NOT replyperson to whom thepresence probe). The server MUST senduser sent directed presence: <presence type='unavailable' from='romeo@example.net/orchard' to='juliet@example.com/chamber' xml:lang='en'> <status>gone home</status> </presence> <presence from='romeo@example.net/orchard' to='nurse@example.com' xml:lang='en'> <status>gone home</status> </presence> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page12]22] Internet-Draft XMPP Instant MessagingJuneJuly 2003this information subject5. Managing Subscriptions In order todomain-specific access rules, and only if the user is inprotect thecontact's roster with a subscription stateprivacy of"from" or "both"instant messaging users andthe contact has not blocked outboundany other entities, presencenotificationsand availability information is disclosed only to other entities that theuser's bare or full JID (as defined in Section 8.11). (Note: if the server receives a presence probe fromuser has approved. When asubdomain of the server's hostname or another such trusted service, it MAY provide presence information about theusertohas agreed thatentity.) Upon receiving initial presence from the user,another entity may view its presence, thecontact's server MUST deliverentity is said to have a subscription to the user's presencestanza to the full JIDs (<contact@domain/resource>) associated with all ofinformation. A subscription lasts across sessions; indeed, it lasts until thecontact's active sessions, but only ifsubscriber unsubscribes or theuser is insubscribee cancels thecontact's roster with a subscription state of "to" or "both"previously-granted subscription. Subscriptions are managed within XMPP by sending presence stanzas containing specially-defined attributes. Note: there are important interactions between subscriptions andthe contact has not blocked inbound presence notifications from the user's bare or full JID (asrosters; these are definedin Section 8.10). If the user's server receives a presence stanzaunder Integration oftype "error" in response toRoster Items and Presence Subscriptions (Section 7), and theinitial presence that it forwardedreader must refer to that section for acontact on behalfcomplete understanding ofthe user, it SHOULD NOT send furtherpresenceupdates to that contact (until and unless it receivessubscriptions. 5.1 Requesting a Subscription A request to subscribe to another entity's presenceprobe from the contact). After sending initial presence, the user MAY update and broadcast its presence information at any time during its active sessionis made by sending a presence stanzawith no 'to' address and either no 'type' attribute or a 'type' attribute with a valueof"unavailable". (Note: a user's client SHOULD NOT sendtype "subscribe". Example: Sending apresence updatesubscription request: <presence to='juliet@example.com' type='subscribe'/> If the subscription request is being sent tobroadcast information that changes independently ofanother instant messaging user, theuser's presence and availability.) IfJID supplied in thepresence stanza lacks a 'type''to' attribute(i.e., expresses availability),SHOULD be of the form <contact@otherdomain> rather than <contact@otherdomain/ resource>. A user's server MUSTbroadcast the full XML of that presence stanza to all contacts (1) that are inNOT automatically accept subscription requests on the user'sroster with abehalf. All subscriptiontype of "from" or "both", (2)requests MUST be directed towhom the user has not blocked outbound presence, and (3) from whom the server has not received a presence error duringthe user'ssession.client. If there is no available resource associated with the user when thepresence stanza has a 'type' attribute set to a value of "unavailable",subscription request is received by the server, the user's server MUSTbroadcast the full XML of that presence stanza to all contacts meetingstore thethree conditions just mentioned, as well as to any entities to whichsubscription request offline for delivery when the user next becomes available. (Note: if a resource hassent directed available presence during the user'sauthorized a session(if the userbut has notyet sent directed unavailable presenceprovided initial presence, the server SHOULD NOT consider it tothat entity). A user MAYbe available and therefore SHOULD NOT senddirected presencesubscription requests to it.) 5.2 Handling a Subscription Request When a client receives a subscription request from anotherentity (i.e.,entity, it MUST either accept the request by sending a presence stanzawith a 'to' attribute whose value is the JIDofthe other entity and with either no 'type' attributetype "subscribed" or decline the request by sending a'type' attribute whose value is "unavailable"). There are three possible cases: 1.presence stanza of type "unsubscribed". Saint-Andre & Miller Expires January 26, 2004 [Page 23] Internet-Draft XMPP Instant Messaging July 2003 Example: Accepting a subscription request: <presence to='romeo@example.net' type='subscribed'/> Example: Denying a presence subscription request: <presence to='romeo@example.net' type='unsubscribed'/> 5.3 Cancelling a Subscription from Another Entity Ifthea user would like to cancel a previously-granted subscription request, it sendsdirecteda presencetostanza of type "unsubscribed". Example: Cancelling acontact that is inpreviously granted subscription request: <presence to='romeo@example.net' type='unsubscribed'/> 5.4 Unsubscribing from Another Entity's Presence If a user would like to unsubscribe from theuser's roster withpresence of another entity, it sends asubscription typepresence stanza of"from" or "both" aftertype "unsubscribe". Example: Unsubscribing from an entity's presence: <presence to='juliet@example.com' type='unsubscribe'/> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page13]24] Internet-Draft XMPP Instant MessagingJuneJuly 2003having sent initial presence and before sending unavailable presence broadcast, the user's server MUST route or deliver the full XML6. Managing One's Roster In XMPP, one's contact list is called a roster, which consists ofthat presence stanza (subject to privacy rules) but SHOULD NOT otherwise modify the contact's status regarding presence broadcast (i.e., it SHOULD include the contact's JID inanysubsequent presence broadcasts initiated by the user). 2. If the user sends directed presence to an entity that is not in the user'snumber of specific rosterwithitems, each roster item being identified by asubscription typeunique JID (usually of"from" or "both" after having sent initial presence and before sending unavailable presence broadcast,the form <contact@otherdomain>). A user'sserver MUST route or deliver the full XML of that presence stanza to the entity but MUST NOT modify the contact's status regarding available presence broadcast (i.e., it MUST NOT include the entity's JID in any subsequent broadcasts of available presence initiatedroster is stored by theuser); however, if the connected resource from which the user sent the directed presence become unavailable, theuser's serverMUST broadcast that unavailable presence to the entity (ifon theuser has not yet sent directed unavailable presence touser's behalf so thatentity). 3. Ifthe usersends directed presence without ever first sending initial presence or after having sent unavailable presence broadcast,may access roster information from any available resource. Note: there are important interactions between rosters and subscriptions; these are defined under Integration of Roster Items and Presence Subscriptions (Section 7), and theuser'sreader must refer to that section for a complete understanding of roster management. Note: a server MUST ignore any 'to' address on a roster "set", and MUST treatthe entitiesany roster "set" as applying towhich the user sends directed presence in the same way that it treatstheentities listed in Case 2 above. Before ending its session with a server,sender. For added safety, a client SHOULDgracefully become unavailable by sendingcheck the "from" address of afinal presence stanza that possesses no 'to' attribute androster "push" to ensure thatpossesses a 'type' attribute whose valueit is"unavailable" (optionally,from a trusted source; specifically, thefinal presencestanzaMAY contain oneshould have no 'from' attribute (i.e., implicitly from the server) ormore <status/> elements specifyingthereason whyJID contained in theuser is no longer available). However,'from' attribute should match the user'sserver MUST NOT dependbare JID or full JID; otherwise, the client SHOULD ignore the roster "push". 6.1 Retrieving One's Roster onreceiving final presence from an available resource, sinceLogin Upon connecting to theresource may become unavailable unexpectedly. Ifserver, a client SHOULD request theuser's server detects that one ofroster (however, because receiving theuser's resources has become unavailableroster may not be desirable forany reason (either gracefully or ungracefully), it MUST broadcast unavailable presence toallcontacts (1) that are in the user's roster withresources, e.g., asubscription type of "from" or "both", (2) to whomconnection with limited bandwidth, theuser has not blocked outbound presence, and (3) from whomclient's request for theserver hasroster is NOT REQUIRED). If an available resource does notreceived a presence error duringrequest theuser's session;roster during a session, theuser'sserverMUST alsoSHOULD NOT sendthat unavailable presence stanza to any entities to which the user has sent directed presence during the user's session for that resource (if the user has not yet sent directed unavailableit presenceto that entity). 4.2 Specifying Availability Statussubscriptions and associated "roster pushes". Example: Client requests current roster from server: <iq type='get' id='roster_1'> <query xmlns='jabber:iq:roster'/> </iq> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page14]25] Internet-Draft XMPP Instant MessagingJuneJuly 2003A client MAY provide further information about its availability status by using the <show/> element. As mentioned in XMPP Core [1], the recognized values forExample: Client receives roster from theshow element are: o away -- The entity or resource is temporarily away. o chat -- The entity or resource is actively interested in chatting. o xa -- The entity or resource is away forserver: <iq id='roster_1' type='result'> <query xmlns='jabber:iq:roster'> <item jid='romeo@example.net' name='Romeo' subscription='both'> <group>Friends</group> </item> <item jid='mercutio@shakespeare.lit' name='Mercutio' subscription='both'> <group>Friends</group> </item> <item jid='benvolio@example.org' name='Benvolio' subscription='both'> <group>Friends</group> </item> </query> </iq> 6.2 Adding a Roster Item At any time, a user MAY add anextended period (xa = "eXtended Away"). o dnd -- The entityitem to his orresource is busy (dnd = "Do Not Disturb").her roster. Example:Availability status: <presence> <show>dnd</show> </presence> If no <show/> element is provided,Client adds a new item: <iq type='set' id='roster_2'> <query xmlns='jabber:iq:roster'> <item name='Nurse' jid='nurse@example.com'> <group>Servants</group> </item> </query> </iq> The value of theentity is assumed to'jid' attribute SHOULD beonline and available. 4.3 Specifying Detailed Status Information In conjunctionof the form <user@somedomain>, especially if the item is associated with another (human) instant messaging user. The server MUST update the<show/> element, a client MAY provide detailed statusroster informationby usingin persistent storage, and also push the<status/> element. The content of this element is a natural-language descriptionchange out to all of the user'scurrent availability status. The contentavailable resources Saint-Andre & Miller Expires January 26, 2004 [Page 26] Internet-Draft XMPP Instant Messaging July 2003 that have requested the roster. This "roster push" consists of an IQ set from thestatus element MUST be XML character data andserver to theelement MUST NOT contain mixed content. Multiple <status/> elements MAY be included, as long as each such element possesses an 'xml:lang' attributeclient and enables all available resources to remain in sync witha distinct value.the server-based roster information. Example:Detailed status information: <presence xml:lang='en'> <show>dnd</show> <status>Wooing Juliet</status> <status xml:lang='cz'>Ja dvořím Juliet</status> </presence> 4.4 Specifying Presence Priority A client MAY provide a priority for its resource by usingServer (1) pushes the<priority/> element. The content of this element is an integer whose value is between -128updated roster information to all available resources and+127. If(2) replies with an IQ result to the sending resource: <iq type='set'> <query xmlns='jabber:iq:roster'> <item name='Nurse' jid='nurse@example.com' subscription='none'> <group>Servants</group> </item> </query> </iq> <iq type='set'> <query xmlns='jabber:iq:roster'> <item name='Nurse' jid='nurse@example.com' subscription='none'> <group>Servants</group> </item> </query> </iq> <iq type='result' id='roster_2'/> Example: Connected resources reply with an IQ result to the server: <iq from='juliet@example.com/balcony' to='example.com' type='result'/> <iq from='juliet@example.com/chamber' to='example.com' type='result'/> 6.3 Updating aclient does not provideRoster Item Updating an existing roster item (e.g., changing thepriority elementgroup) is done in the same way as adding apresence stanza, its server SHOULD assume thatnew roster item, i.e., by sending thepriority value is zero.Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page15]27] Internet-Draft XMPP Instant MessagingJuneJuly 2003 roster item in an IQ set to the server. Example:Presence priority: <presence xml:lang='en'> <show>dnd</show> <status>Wooing Juliet</status> <status xml:lang='cz'>Ja dvořím Juliet</status> <priority>1</priority> </presence> 4.5 Determining WhenUser updates roster item (added group): <iq type='set' id='roster_3'> <query xmlns='jabber:iq:roster'> <item jid='romeo@example.net' name='Romeo' subscription='both'> <group>Friends</group> <group>Lovers</group> </item> </query> </iq> As with adding aContact Went Offline Theroster item, when updating a roster item the server MUSTmaintainupdate the roster information in persistent storage, and also initiate arecord"roster push" to all of thetime at whichuser's available resources that have requested the roster. 6.4 Deleting a Roster Item At any time, a userbecame unavailable (whether gracefully or ungracefully). An authorized subscriber toMAY delete an item from its roster by doing an IQ set and making sure that the value of the 'subscription' attribute is "remove" (a compliant server MUST ignore any other values of the 'subscription' attribute when received from a client). Example: Client removes an item: <iq type='set' id='roster_4'> <query xmlns='jabber:iq:roster'> <item jid='nurse@example.com' subscription='remove'/> </query> </iq> As with adding a roster item, when deleting a roster item the server MUST update the roster information in persistent storage, initiate a "roster push" to all of the user'spresence MAY requestavailable resources that have requested thetimeroster (with the 'subscription' attribute set to a value of "remove"), and send an IQ result to the initiating resource. For further information about the implications of this command, see Section 7.6. Saint-Andre & Miller Expires January 26, 2004 [Page 28] Internet-Draft XMPP Instant Messaging July 2003 7. Integration oflast activityRoster Items and Presence Subscriptions 7.1 Overview Some level of integration between roster items and presence subscriptions is normally expected bysendinganIQ stanza toinstant messaging user regarding the user'sbare JID (<user@domain>) containing an empty <query/> element qualified by the 'jabber:iq:last' namespace: Example: Requestingsubscriptions to and from other contacts. This section describes thelast active timelevel ofan offline user: <iq type='get' to='user@domain'> <query xmlns='jabber:iq:last'/> </iq> Ifintegration that must be supported within XMPP IM. There are four primary subscription states: o None -- Neither theentity requestinguser nor thetime of last activitycontact isan authorized subscribersubscribed to theuser'sother's presence(i.e., exists ino To -- The user is subscribed to theuser's roster withcontact's presence but there is no subscription from the'subscription' attribute setcontact toa value of "from" or "both") andthe user o From -- There is a subscription from the contact to the user, but the user has notblocking IQ stanzassubscribed to the contact's presence o Both -- Both the user andfromtheentity (as defined in Section 8.12),contact are subscribed to each other's presence (i.e., theserver SHOULD return an IQ stanzaunion oftype "result" with the number'from' and 'to') Each ofseconds since the user was last active: Example: Returningthese states is reflected in thelast active timeroster ofan offline user: <iq from='user@domain' type='result' to='subscriber@domain/resource'> <query seconds='76490' xmlns='jabber:iq:last'/> </iq> Ifboth theentity requestinguser and thetimecontact, thus resulting in durable subscription states. A detailed explanation oflast activity is not an authorized subscriber tohow these subscription states interact with roster items is provided in theuser's presence (i.e.,following sub-sections. If a connected resource does notexist inboth send initial presence and request theuser'sroster, the server SHOULD NOT send it presence subscription requests or "roster pushes". The 'from' and 'to' addresess are OPTIONAL in rosterwithpushes; if included, their values SHOULD be the'subscription' attribute set to a valuefull JID of"from" or "both"),theserverresource for that session. A client MUSTreturnacknowledge each "roster push" with an IQ stanza of type"error" with an error condition of forbidden: Saint-Andre & Miller Expires December 28, 2003 [Page 16] Internet-Draft XMPP Instant Messaging June 2003 Example: Requester is forbidden to view the last active time of an offline user: <iq from='user@domain' type='error' to='subscriber@domain/resource'> <query xmlns='jabber:iq:last'/> <error type='auth'> <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq> Note: this document defines responses to requests for last active time only with regard to JIDs of"result" (for theform <user@domain>, and only with regard to JIDs that correspond to an (offline) instant messaging user. The behavior of other JID forms (e.g., <user@domain/resource> or <domain>) and entity types (e.g., online user or host) is outsake ofscope and undefined. 4.6 Presence Examples The examplesbrevity, these stanzas are not shown inthis section illustratethepresence-related protocols described above.following examples but are required by XMPP Core [1]). 7.2 User Subscribes to Contact The process by which a useris romeo@montague.net, he has authorizedsubscribes to aresource "orchard", and he hascontact, including thefollowing individuals in his roster: o juliet@capulet (subscription="both"interaction between roster items andshe has two active sessions, one whose resourcesubscription states, is"chamber"defined below. 1. In preparation for being able to render the contact in the user's client interface andanother whose resource is "balcony") o benvolio@shakespeare.lit (subscription="to") o mercutio@verona.it (subscription="from") Example 1: User sends initial presence: <presence/>for the server to keep track of the Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page17]29] Internet-Draft XMPP Instant MessagingJuneJuly 2003Example 2: User's server sends presence probe to contacts with subscription="to" and subscription="both" on behalfsubscription, the user's client SHOULD perform a "roster set" for the new roster item. This request consists of an IQ stanza of type='set' containing a <query/> element in the 'jabber:iq:roster' namespace, which in turn contains an <item/> element that defines the new roster item; 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='int1'> <query xmlns='jabber:iq:roster'> <item jid='contact@otherdomain' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> 2. As a result, the user'sconnected resource: <presence type='probe' from='romeo@montague.net/orchard' to='juliet@capulet.com'/> <presence type='probe' from='romeo@montague.net/orchard' to='benvolio@shakespeare.lit'/> Example 3: User'sserversends initial presence(1) MUST initiate a "roster push" for the new roster item tocontactsall available resources associated withsubscription="from"this user that have requested the roster, setting the 'subscription' attribute to a value of "none"; andsubscription="both" on behalf(2) MUST reply with an IQ stanza of type='result': <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='contact@otherdomain' subscription='none' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> <iq type='result' id='int1'/> 3. If theuser's connected resource: <presence from='romeo@montague.net/orchard' to='juliet@capulet.com'/> <presence from='romeo@montague.net/orchard' to='mercutio@verona.it'/> Saint-Andre & Miller Expires December 28, 2003 [Page 18] Internet-Draft XMPP Instant Messaging June 2003 Example 4: Contacts' server repliesuser wants to request a subscription to the contact's presence, the user's client MUST send a presenceprobe on behalf of allstanza of type='subscribe' to thecontact's available resources: <presence from='juliet@capulet.com/balcony' to='romeo@montague.net/orchard' xml:lang='en'> <show>away</show> <status>be right back</status> <priority>0</priority> </presence> <presence from='juliet@capulet.com/chamber' to='romeo@montague.net/orchard'> <priority>1</priority> </presence>contact: <presencefrom='benvolio@shakespeare.lit/pda' to='romeo@montague.net/orchard' xml:lang='en'> <show>dnd</show> <status>gallivanting</status> </presence> Example 5: Contact's server deliversto='contact@otherdomain' type='subscribe'/> 4. As a result, the user'sinitial presenceserver MUST initiate a second "roster push" to all of thecontact'suser's available resourcesor returns errorthat have requested the roster, setting the contact touser: <presence from='romeo@montague.net/orchard' to='juliet@capulet.com/chamber'/> <presence from='romeo@montague.net/orchard' to='juliet@capulet.com/balcony'/> <presence type='error' from='mercutio@verona.it' to='romeo@montague.net/orchard'> <error type='cancel'> <remote-server-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </presence>the pending sub-state of the 'none' subscription state; this pending Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page19]30] Internet-Draft XMPP Instant MessagingJuneJuly 2003Example 6: User sends directed presence to anothersub-state is denoted by the inclusion of the ask='subscribe' attribute in the roster item: <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='contact@otherdomain' subscription='none' ask='subscribe' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> Note: if the user did notin his roster: <presence from='romeo@montague.net/orchard' to='nurse@capulet.com' xml:lang='en'> <show>dnd</show> <status>courting Juliet</status> <priority>0</priority> </presence> Example 7: User sends updated available presence information for broadcasting: <presence xml:lang='en'> <show>away</show> <status>I shall return!</status> <priority>1</priority> </presence> Example 8: Updated presence information is delivered only tocreate a roster item before sending the subscription request, the server MUST now create onecontact (not those from whom an error was received orand send a "roster push" towhomall of theuser sent directed presence): <presence from='romeo@montague.net/orchard' to='juliet@capulet.com/chamber' xml:lang='en'> <show>away</show> <status>I shall return!</status> <priority>1</priority> </presence> <presence from='romeo@montague.net/orchard' to='juliet@capulet.com/balcony' xml:lang='en'> <show>away</show> <status>I shall return!</status> <priority>1</priority> </presence> Example 9: Oneuser's available resources that have requested the roster, absent the 'name' attribute and the <group/ > child. 5. The user's server MUST also stamp the presence stanza of type "subscribe" with the user's bare JID (i.e., <user@somedomain>) as the 'from' address. If the contact is served by a different host than thecontact's resources sends final presence: <presence type='unavailable'/> Saint-Andre & Miller Expires December 28, 2003 [Page 20] Internet-Draft XMPP Instant Messaging June 2003 Example 10: Contact'suser, the user's serversends unavailable presence information to user: <presence type='unavailable' from='juliet@capulet.com/balcony' to='romeo@montague.net/orchard'/> Example 11: User sends final presence: <presence type='unavailable' xml:lang='en'> <status>gone home</status> </presence> Example 12: UnavailableMUST route the presenceinformation is deliveredstanza to the contact'sone remaining resource as well asserver for delivery to theperson to whomcontact (this case is assumed throughout; however, if theuser sent directed presence: <presence type='unavailable' from='romeo@montague.net/orchard' to='juliet@capulet.com/chamber' xml:lang='en'> <status>gone home</status> </presence>contact is served by the same host, then the server can simply deliver the presence stanza directly): <presencefrom='romeo@montague.net/orchard' to='nurse@capulet.com' xml:lang='en'> <status>gone home</status> </presence> Saint-Andre & Miller Expires December 28, 2003 [Page 21] Internet-Draft XMPP Instant Messaging June 2003 5. Managing Subscriptions In order to protectfrom='user@somedomain' to='contact@otherdomain' type='subscribe'/> 6. Upon receiving theprivacypresence stanza ofinstant messaging users and any other entities,type "subscribe" addressed to the contact, the contact's server must determine if there is at least one active session in which the contact has sent available presence andavailability informationhas 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 isdisclosed onlynext met). No matter when the subscription request is delivered, the contact must decide whether or not toother entities thataccept it (subject to configured preferences, theuser has approved. When a user has agreed that another entity may view its presence,contact's client MAY accept or deny theentity is said to have asubscription request without presenting it to theuser's presence information. A subscription lasts across sessions; indeed, it lasts untilcontact). Here we assume thesubscriber unsubscribes or"happy path" that thesubscribee cancelscontact accepts thepreviously-granted subscription. Subscriptions are managed within XMPP by sending presence stanzas containing specially-defined attributes. Note: there are important interactions between subscriptions and rosters; these are defined under Integrationsubscription request (the alternate flow ofRoster Items and Presence Subscriptions (Section 7), anddeclining thereader must refer to that section for a complete understanding of presence subscriptions. 5.1 Requesting a Subscription Asubscription requestto subscribe to another entity's presenceismade by sendingdefined Saint-Andre & Miller Expires January 26, 2004 [Page 31] Internet-Draft XMPP Instant Messaging July 2003 in Section 7.2.1). In this case, the contact's client (1) SHOULD perform a roster set specifying the desired nickname and group for the user; and (2) MUST send a presence stanza of type"subscribe". Example: Sending a subscription request: <presence to='juliet@capulet.com' type='subscribe'/> If the subscription request is being sent"subscribed" toanother instant messaging user,theJID supplieduser inthe 'to' attribute SHOULD be of the form <user@domain> rather than <user@domain/resource>. A user's server MUST NOT automaticallyorder to acceptsubscription requests ontheuser's behalf. Allsubscriptionrequestsrequest. <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='user@somedomain' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> <presence to='user@somedomain' type='subscribed'/> 7. As a result, the contact's server (1) MUSTbe directedinitiate a "roster push" tothe user's client. If there is noall availableresourceresources associated with theuser when the subscription request is received by the server, the user's server MUST storecontact that have requested thesubscription request offlineroster, containing a roster item fordelivery whenthe usernext becomes available. (Note: if a resource has authorized a session but has not provided initial presence,with theserver SHOULD NOT consider it to be available and therefore SHOULD NOT sendsubscriptionrequestsstate set toit.) 5.2 Handling a Subscription Request When a client receives a subscription request from another entity, it'from'; (2) MUSTeither acceptroute therequest by sending apresence stanza of type "subscribed"or declineto the user; and (3) MUST send available presence from all of the contact's available resources to the user: <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='user@somedomain' subscription='from' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> <presence from='contact@otherdomain/resource' to='user@somedomain' type='subscribed'/> <presence from='contact@otherdomain/resource' to='user@somedomain'/> 8. Upon receiving therequest by sending apresence stanza of type"unsubscribed"."subscribed" addressed to the user, the user's server MUST first verify that the contact Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page22]32] Internet-Draft XMPP Instant MessagingJuneJuly 2003Example: Accepting a subscription request: <presence to='romeo@montague.net' type='subscribed'/> Example: Denying a presence subscription request: <presence to='romeo@montague.net' type='unsubscribed'/> 5.3 Cancelling a Subscription from Another Entityis in the user's roster with either of the following states: (a) subscription='none', ask='subscribe' or (b) subscription='from', ask='subscribe'. Ifa user would like to cancel a previously-granted subscription request, it sends athe contact is not in the user's roster with either of those states, the user's server MUST silently ignore the presence stanza of type"unsubscribed". Example: Cancelling a previously granted subscription request: <presence to='romeo@montague.net' type='unsubscribed'/> 5.4 Unsubscribing from Another Entity's Presence If"subscribed" (i.e., it MUST NOT route it to the user, modify the user's roster, or generate auser would likeroster push tounsubscribe fromthepresence of another entity, it sends auser's available resources). If the contact is in the user's roster with either of those states, the user's server (1) MUST deliver the presence stanza of type"unsubscribe". Example: Unsubscribing"subscribed" froman entity's presence: <presence to='juliet@capulet.com' type='unsubscribe'/> Saint-Andre & Miller Expires December 28, 2003 [Page 23] Internet-Draft XMPP Instant Messaging June 2003 6. Managing One's Roster In XMPP, one'sthe contactlist is calledto the user; (2) MUST initiate aroster, which consists of any number"roster push" to all ofspecific roster items, eachthe user's available resources that have requested the roster, containing an updated roster itembeing identified byfor the contact with the 'subscription' attribute set to aunique JID (usuallyvalue of "to"; and (3) MUST deliver theform <contact@domain>). A user's roster is stored byavailable presence stanza received from each of theuser's server oncontact's available resources to each of the user'sbehalf so that the user may access roster information from anyavailableresource. Note: there are important interactions between rosters and subscriptions; these are defined under Integrationresources: <presence to='user@somedomain' from='contact@otherdomain' type='subscribed'/> <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='contact@otherdomain' subscription='to' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> <presence from='contact@otherdomain/resource' to='user@somedomain/resource'/> 9. Upon receiving the presence stanza ofRoster Items and Presence Subscriptions (Section 7), andtype "subscribed", thereader must refer touser SHOULD acknowledge receipt of thatsection forsubscription state notification through either accepting it by sending acomplete understandingpresence stanza ofroster management. 6.1 Retrieving One's Roster on Login Upon connectingtype "subscribe" to theserver,contact or denying it by sending aclient SHOULD requestpresence stanza of type "unsubscribe" to theroster (however, because receivingcontact; this step lets theroster may not be desirable for all resources, e.g., a connection with limited bandwidth,user's server know that it must no longer send notification of theclient's request forsubscription state change to theroster is NOT REQUIRED). If an available resource does not requestuser (see Section 8.6). From theroster duringperspective of the user, there now exists asession,subscription to theserver SHOULD NOT send it presence subscriptions and associated "roster pushes". Example: Client requests current rostercontact; fromserver: <iq type='get' id='roster_1'> <query xmlns='jabber:iq:roster'/> </iq>the perspective of the contact, there now exists a Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page24]33] Internet-Draft XMPP Instant MessagingJuneJuly 2003Example: Client receives rostersubscription from theserver: <iq id='roster_1' type='result'> <query xmlns='jabber:iq:roster'> <item jid='romeo@montague.net' name='Romeo' subscription='both'> <group>Friends</group> </item> <item jid='mercutio@verona.it' name='Mercutio' subscription='both'> <group>Friends</group> </item> <item jid='benvolio@shakespeare.lit' name='Benvolio' subscription='both'> <group>Friends</group> </item> </query> </iq> 6.2 Adding a Roster Item At any time, auser. (Note: If at this point the userMAY add an itemsends another subscription request tohis or her roster. Example: Client adds a new item: <iq type='set' id='roster_2'> <query xmlns='jabber:iq:roster'> <item name='Nurse' jid='nurse@capulet.com'> <group>Servants</group> </item> </query> </iq>the contact, the user's server MUST silently ignore that request.) 7.2.1 Alternate Flow: Contact Declines Subscription Request Thevalueabove activity flow represents the "happy path" related to the user's subscription request to the contact. The main alternate flow occurs if the contact denies the user's subscription request. 1. If the contact wants to deny the request, the contact's client MUST send a presence stanza of type "unsubscribed" to the user (instead of the presence stanza of type "subscribed" sent in Step 6 of Section 7.2): <presence to='user@somedomain' type='unsubscribed'/> 2. As a result, the contact's server MUST route the presence stanza of type "unsubscribed" to the user, first stamping the 'from' address as the bare JID (<contact@otherdomain>) of the'jid' attribute SHOULD becontact: <presence from='contact@otherdomain' to='user@somedomain' type='unsubscribed'/> 3. Upon receiving the presence stanza of type "unsubscribed" addressed to theform <user@domain>, especially ifuser, theitem is associated with another (human) instant messaging user. Theuser's server (1) MUSTupdatedeliver that presence stanza to theroster information in persistent storage,user andalso push the change out(2) MUST initiate a "roster push" to all of the user's available resourcesSaint-Andre & Miller Expires December 28, 2003 [Page 25] Internet-Draft XMPP Instant Messaging June 2003that have requested theroster. This "roster push" consists ofroster, containing anIQ set from the server toupdated roster item for theclient and enables all available resources to remain in synccontact with theserver-based roster information. Example: Server (1) pushes the updated roster information'subscription' attribute set toall available resourcesa value of "none" and(2) replieswithan IQ result to the sending resource: <iq type='set'> <query xmlns='jabber:iq:roster'> <item name='Nurse' jid='nurse@capulet.com' subscription='none'> <group>Servants</group> </item> </query> </iq>no 'ask' attribute: <presence from='contact@otherdomain' to='user@somedomain' type='unsubscribed'/> <iq type='set'> <query xmlns='jabber:iq:roster'> <itemname='Nurse' jid='nurse@capulet.com' subscription='none'> <group>Servants</group>jid='contact@otherdomain' subscription='none' name='MyContact'> <group>MyBuddies</group> </item> </query> Saint-Andre & Miller Expires January 26, 2004 [Page 34] Internet-Draft XMPP Instant Messaging July 2003 </iq><iq type='result' id='roster_2'/> Example: Connected resources reply with an IQ result to the server: <iq from='juliet@capulet.com/balcony' to='capulet.com' type='result'/> <iq from='juliet@capulet.com/chamber' to='capulet.com' type='result'/> 6.3 Updating a Roster Item Updating an existing roster item (e.g., changing4. Upon receiving thegroup) is done inpresence stanza of type "unsubscribed", thesame way as addinguser SHOULD acknowledge receipt of that subscription state notification through either accepting it by sending anew roster item, i.e.,presence stanza of type "unsubscribe" to the contact or denying it by sending a presence stanza of type "subscribe" to the contact; this step lets the user's server know that it must no longer send notification of theSaint-Andre & Miller Expires December 28, 2003 [Page 26] Internet-Draft XMPP Instant Messaging June 2003 roster item in an IQ setsubscription state change to theserver. Example: User updates roster item (added group): <iq type='set' id='roster_3'> <query xmlns='jabber:iq:roster'> <item jid='romeo@montague.net' name='Romeo' subscription='both'> <group>Friends</group> <group>Lovers</group> </item> </query> </iq>user (see Section 8.6). Aswith adding a roster item, when updatingaroster itemresult of this activity, theserver MUST updatecontact is now in the user's rosterinformation in persistent storage, and also initiatewith a"roster push" to allsubscription state of "none", whereas theuser's available resources that have requesteduser is not in theroster. 6.4 Deleting a Roster Item At any time,contact's roster at all. 7.3 Creating a Mutual Subscription The userMAY delete an item from its roster by doing an IQ setandmaking sure thatcontact can build on thevalueforegoing to create a mutual subscription (i.e., a subscription ofthe 'subscription' attributetype "both"). The process is"remove" (a compliant server MUST ignore any other values ofdefined below. 1. If the'subscription' attribute when received fromcontact wants to create aclient). Example: Client removes an item: <iq type='set' id='roster_4'> <query xmlns='jabber:iq:roster'> <item jid='nurse@capulet.com' subscription='remove'/> </query> </iq> As with addingmutual subscription, the contact MUST send aroster item, when deletingsubscription request to the user (subject to configured preferences, the contact's client MAY send this automatically): <presence to='user@somedomain' type='subscribe'/> 2. As aroster itemresult, the contact's server (1) MUSTupdate the roster information in persistent storage,initiate a "roster push" to all available resources associated with the contact that have requested the roster, with the user still in the 'from' subscription state but with a pending 'to' subscription denoted by the inclusion of theuser's available resources that have requestedask='subscribe' attribute in the roster(withitem; and (2) MUST route the'subscription' attribute set to a valuepresence stanza of"remove"), and send an IQ resulttype "subscribe" to theinitiating resource. For further information aboutuser, first stamping theimplications'from' address as the bare JID (<contact@otherdomain>) ofthis command, see Section 7.6.the contact: Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page27]35] Internet-Draft XMPP Instant MessagingJuneJuly 20037. Integration of Roster Items and Presence Subscriptions 7.1 Overview Some level of integration between roster items and presence subscriptions is normally expected by an instant messaging user regarding<iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='user@somedomain' subscription='from' ask='subscribe' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> <presence from='contact@otherdomain' to='user@somedomain' type='subscribe'/> 3. Upon receiving theuser's subscriptionspresence stanza of type "subscribe" addressed toand from other contacts. This section describesthelevel of integration thatuser, the user's server mustbe supported within XMPP IM. There are four primary subscription states: o None -- Neitherdetermine if there is at least one active session in which the usernorhas sent available presence and has requested thecontact is subscribed toroster. If so, theother's presence o To -- The user is subscribed touser's server MUST deliver thecontact's presence but there is nosubscriptionfrom the contactrequest to the usero From -- There is a subscription from(if not, it MUST store thecontact tosubscription request offline for delivery when this condition is next met). No matter when theuser, butsubscription request is delivered, the userhasmust then decide whether or notsubscribedto accept it (subject to configured preferences, thecontact's presence o Both -- Both the user anduser's client MAY accept or deny thecontact are subscribedsubscription request without presenting it toeach other's presence (i.e.,theunion of 'from' and 'to') Each of these states is reflected inuser). Here we assume theroster of both"happy path" that the userandaccepts thecontact, thus resulting in durablesubscriptionstates. A detailed explanationrequest (the alternate flow ofhow thesedeclining the subscriptionstates interact with roster itemsrequest isprovideddefined in Section 7.3.1). In this case, thefollowing sub-sections. If a connected resource does not bothuser's client MUST sendinitiala presenceand request the roster,stanza of type "subscribed" to theserver SHOULD NOT send it presence subscription requests or "roster pushes". The 'from' and 'to' addresess are OPTIONALcontact inroster pushes; if included, their values SHOULD beorder to accept thefull JID ofsubscription request. <presence to='contact@otherdomain' type='subscribed'/> 4. As a result, theresource for that session. A clientuser's server (1) MUSTacknowledge eachinitiate a "roster push"with an IQ stanzato all oftype "result" (forthesake of brevity, these stanzas are not shown inuser's available resources that have requested thefollowing examples but are required by XMPP Core [1]). 7.2 User Subscribes to Contact The process by whichroster, containing auser subscribesroster item for the contact with the 'subscription' attribute set to acontact, includingvalue of "both"; (2) MUST route theinteraction between roster items and subscription states, is defined below. 1. In preparation for being ablepresence stanza of type "subscribed" torenderthecontact incontact, first stamping the 'from' address as the bare JID (<user@somedomain>) of the user; and (3) MUST send available presence from each of the user'sclient interface and for the serveravailable resources tokeep track ofthe contact: Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page28]36] Internet-Draft XMPP Instant MessagingJuneJuly 2003subscription, the user's client SHOULD perform a "roster set" for<iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='contact@otherdomain' subscription='both' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> <presence from='user@somedomain' to='contact@otherdomain' type='subscribed'/> <presence from='user@somedomain/resource' to='contact@otherdomain'/> 5. Upon receiving thenew roster item. This request consists of an IQpresence stanza oftype='set' containing a <query/> elementtype "subscribed" addressed to the contact, the contact's server MUST first verify that the user is in the'jabber:iq:roster' namespace, whichcontact's roster with either of the following states: (a) subscription='none', ask='subscribe' or (b) subscription='from', ask='subscribe'. If the user is not inturn contains an <item/> element that definesthenewcontact's rosteritem;with either of those states, the<item/> elementcontact's server MUSTpossess a 'jid' attribute, MAY possess a 'name' attribute,silently ignore the presence stanza of type "subscribed" (i.e., it MUST NOTpossess a 'subscription' attribute, and MAY contain oneroute it to the contact, modify the contact's roster, ormore <group/> child elements: <iq type='set' id='int1'> <query xmlns='jabber:iq:roster'> <item jid='contact@domain' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> 2. Asgenerate aresult,roster push to theuser'scontact's available resources). If the user is in the contact's roster with either of those states, the contact's server (1) MUST deliver the presence stanza of type "subscribed" from the user to the contact; (2) MUST initiate a "roster push"for the new roster itemto all available resources associated withthis userthe contact that have requested the roster,settingcontaining an updated roster item for the user with the 'subscription' attribute set to a value of"none";"both"; and(2)(3) MUSTreply with an IQdeliver the available presence stanza received from each oftype='result':the user's available resources to each of the contact's available resources: Saint-Andre & Miller Expires January 26, 2004 [Page 37] Internet-Draft XMPP Instant Messaging July 2003 <presence from='user@somedomain' to='contact@otherdomain' type='subscribed'/> <iq type='set'> <query xmlns='jabber:iq:roster'> <itemjid='contact@domain' subscription='none' name='MyContact'> <group>MyBuddies</group>jid='user@somedomain' subscription='both' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq><iq type='result' id='int1'/> 3. If<presence from='user@somedomain/resource' to='contact@otherdomain/resource'/> 6. Upon receiving theuser wants to request apresence stanza of type "subscribed", the contact SHOULD acknowledge receipt of that subscription state notification through either accepting it by sending a presence stanza of type "subscribe" to thecontact's presence, the user's client MUST senduser or denying it by sending a presence stanza oftype='subscribe'type "unsubscribe" to thecontact: <presence to='contact@domain' type='subscribe'/> 4. Asuser; this step lets the contact's server know that it must no longer send notification of the subscription state change to the contact (see Section 8.6). The user and the contact now have aresult,mutual subscription to each other's presence -- i.e., the subscription is of type "both". The user's server MUSTinitiatenow send the user's current presence information to the contact. (Note: If at this point the user sends asecond "roster push"subscription request toall ofthe contact or the contact sends a subscription request to the user, the sending user'savailable resourcesserver MUST silently ignore thathave requestedrequest and not route it to theroster, settingintended recipient.) 7.3.1 Alternate Flow: User Declines Subscription Request The above activity flow represents thecontact"happy path" related to thepending sub-state of the 'none'contact's subscriptionstate; this pending Saint-Andre & Miller Expires December 28, 2003 [Page 29] Internet-Draft XMPP Instant Messaging June 2003 sub-state is denoted byrequest to theinclusion ofuser. The main alternate flow occurs if theask='subscribe' attribute inuser denies theroster item: <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='contact@domain' subscription='none' ask='subscribe' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> Note: ifcontact's subscription request. 1. If the userdid not create a roster item before sendingwants to deny thesubscriptionrequest, theserveruser's client MUSTnow create one andsend a"roster push" to allpresence stanza of type "unsubscribed" to theuser's available resources that have requested the roster, absent the 'name' attribute and the <group/ > child. 5. The user's server MUST also stampcontact (instead of the presence stanza of type"subscribe" with the user's bare JID (i.e., <user@domain>) as the 'from' address. If the contact is served by"subscribed" sent in Step 3 of Section 7.3): Saint-Andre & Miller Expires January 26, 2004 [Page 38] Internet-Draft XMPP Instant Messaging July 2003 <presence to='contact@otherdomain' type='unsubscribed'/> 2. As adifferent host than the user,result, the user's server MUST route the presence stanza of type "unsubscribed" to thecontact's server for delivery to the contact (this case is assumed throughout; however, if the contact is served bycontact, first stamping thesame host, then'from' address as theserver can simply deliverbare JID (<user@somedomain>) of thepresence stanza directly):user: <presencefrom='user@domain' to='contact@domain' type='subscribe'/> 6.from='user@somedomain' to='contact@otherdomain' type='unsubscribed'/> 3. Upon receiving the presence stanza of type"subscribe""unsubscribed" addressed to the contact, the contact's servermust determine if there is at least one active session in which the contact has sent available presence and has requested the roster. If so, it(1) MUST deliver that presence stanza to thesubscription requestcontact; and (2) MUST initiate a "roster push" to all available resources associated with the contact(if not, the contact's server MUST storethat have requested thesubscription request offlineroster, containing an updated roster item fordelivery when this condition is next met). No matter whenthesubscription request is delivered,user with the 'subscription' attribute set to a value of "from" and with no 'ask' attribute: <presence from='user@somedomain' to='contact@otherdomain' type='unsubscribed'/> <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='user@somedomain' subscription='from' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> 4. Upon receiving the presence stanza of type "unsubscribed", the contactmust decide whether or notSHOULD acknowledge receipt of that subscription state notification through either accepting it by sending a presence stanza of type "unsubscribe" toacceptthe user or denying it(subjectby sending a presence stanza of type "subscribe" toconfigured preferences,the user; this step lets the contact'sclient MAY accept or denyserver know that it must no longer send notification of the subscriptionrequest without presenting itstate change to thecontact). Here we assumecontact (see Section 8.6). As a result of this activity, there has been no change in the"happy path" thatsubscription state; i.e., the contactacceptsis in the user's roster with a subscriptionrequest (the alternate flowstate ofdeclining"to" and thesubscription requestuser isdefinedin the contact's roster with a subscription state of "from". Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page30]39] Internet-Draft XMPP Instant MessagingJuneJuly 2003 7.4 Unsubscribing At any time after subscribing to a contact's presence, a user MAY unsubscribe. While the XML that the user sends to make this happen is the same inSection 7.2.1).all instances, the subsequent subscription state is different depending on the subscription state obtaining when the unsubscribe "command" was sent. Both possible scenarios are defined below. 7.4.1 Case #1: Unsubscribing When Subscription is Not Mutual Inthisthe first case, thecontact's client (1) SHOULD performuser has aroster set specifyingsubscription to thedesired nickname and group forcontact but theuser; and (2)contact does not have a subscription to the user (i.e., the subscription is not yet mutual). 1. If the user wants to unsubscribe from the contact's presence, the user MUST send a presence stanza of type"subscribed" to the user in order"unsubscribe" toacceptthesubscription request. <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='user@domain' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq>contact: <presenceto='user@domain' type='subscribed'/> 7.to='contact@otherdomain' type='unsubscribe'/> 2. As a result, thecontact'suser's server (1) MUSTinitiatesend a "roster push" to all of the user's available resourcesassociated with the contactthat have requested the roster, containingaan updated roster item for theusercontact with thesubscription state'subscription' attribute set to'from';a value of "none"; and (2) MUST route the presence stanza of type"subscribed""unsubscribe" to theuser; and (3) MUST send available presence from all ofcontact, first stamping thecontact's available resources to'from' address as the bare JID (<user@somedomain>) of the user: <iq type='set'> <query xmlns='jabber:iq:roster'> <itemjid='user@domain' subscription='from' name='SomeUser'> <group>SomeGroup</group>jid='contact@otherdomain' subscription='none' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> <presencefrom='contact@domain/resource' to='user@domain' type='subscribed'/> <presence from='contact@domain/resource' to='user@domain'/> 8.from='user@somedomain' to='contact@otherdomain' type='unsubscribe'/> 3. Upon receiving the presence stanza of type"subscribed""unsubscribe" addressed to theuser,contact, theuser'scontact's server (1) MUSTfirst verify thatinitiate a "roster push" to all available resources associated with thecontactSaint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page31]40] Internet-Draft XMPP Instant MessagingJuneJuly 2003is incontact that have requested theuser'sroster, containing an updated roster item for the user witheither ofthefollowing states: (a) subscription='none', ask='subscribe' or (b) subscription='from', ask='subscribe'. If'subscription' attribute set to a value of "none" (if the contact isnot inoffline, the contact's server MUST modify theuser'srosterwith either of those states,item and send that modified item theuser's servernext time the contact requests the roster); and (2) MUSTsilently ignoredeliver the "unsubscribe" state change notification to the contact: <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='user@somedomain' subscription='none' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> <presence from='user@somedomain' to='contact@otherdomain' type='unsubscribe'/> 4. Upon receiving the presence stanza of type"subscribed" (i.e., it MUST NOT route it to the user, modify the user's roster, or generate a roster push to the user's available resources). If"unsubscribe", the contactis in the user's roster withSHOULD acknowledge receipt of that subscription state notification through either accepting it by sending a presence stanza ofthose states, the user's server (1) MUST delivertype "unsubscribed" to the user or denying it by sending a presence stanza of type "subscribed"from the contactto the user;(2) MUST initiate a "roster push" to all ofthis step lets theuser's available resourcescontact's server know thathave requestedit must no longer send notification of theroster, containing an updated roster item forsubscription state change to the contactwith the 'subscription' attribute set to(see Section 8.6). 5. The contact's server then (1) MUST send avaluepresence stanza of"to"; and (3) MUST delivertype "unsubscribed" to theavailableuser; and (2) SHOULD send unavailable presencestanza receivedfromeach ofthecontact's available resourcescontact toeach oftheuser's available resources:user: <presenceto='user@domain' from='contact@domain' type='subscribed'/> <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='contact@domain' subscription='to' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq>from='contact@otherdomain' to='user@somedomain' type='unsubscribed'/> <presencefrom='contact@domain/resource' to='user@domain/resource'/> From the perspective offrom='contact@otherdomain' to='user@somedomain' type='unavailable'/> Saint-Andre & Miller Expires January 26, 2004 [Page 41] Internet-Draft XMPP Instant Messaging July 2003 6. When theuser, there now existsuser's server receives asubscriptionpresence stanza of type "unsubscribed" and/or unavailable presence, it MUST deliver them to thecontact; fromuser: <presence from='contact@otherdomain' to='user@somedomain' type='unsubscribed'/> <presence from='contact@otherdomain' to='user@somedomain' type='unavailable'/> 7. Upon receiving theperspectivepresence stanza ofthe contact, there now exists a subscription from the user. (Note: If at this pointtype "unsubscribed", the usersends anotherSHOULD acknowledge receipt of that subscriptionrequeststate notification through either accepting it by sending a presence stanza of type "unsubscribe" to thecontact,contact or denying it by sending a presence stanza of type "subscribe" to the contact; this step lets the user's serverMUST silently ignoreknow thatrequest.) 7.2.1 Alternate Flow: Contact Declines Subscription Request The above activity flow representsit must no longer send notification of the"happy path" relatedsubscription state change to theuser'suser (see Section 8.6). 7.4.2 Case #2: Unsubscribing When Subscription is Mutual In the second case, the user has a subscriptionrequestto thecontact. The main alternate flow occurs ifcontact and the contactdeniesalso has a subscription to the user (i.e., theuser'ssubscriptionrequest. Saint-Andre & Miller Expires December 28, 2003 [Page 32] Internet-Draft XMPP Instant Messaging June 2003is mutual). 1. If thecontactuser wants todeny the request,unsubscribe from the contact'sclientpresence, the user MUST send a presence stanza of type"unsubscribed""unsubscribe" to theuser (instead of the presence stanza of type "subscribed" sent in Step 6 of Section 7.2):contact: <presenceto='user@domain' type='unsubscribed'/>to='contact@otherdomain' type='unsubscribe'/> 2. As a result, thecontact's server MUST route the presence stanza of type "unsubscribed" to the user, first stamping the 'from' address as the bare JID (<contact@domain>) of the contact: <presence from='contact@domain' to='user@domain' type='unsubscribed'/> 3. Upon receiving the presence stanza of type "unsubscribed" addressed to the user, theuser's server (1) MUSTdeliver that presence stanza to the user and (2) MUST initiatesend a "roster push" to all of the user's available resources that have requested the roster, containing an updated roster item for the contact with the 'subscription' attribute set to a value of"none""from"; andwith no 'ask' attribute: <presence from='contact@domain' to='user@domain' type='unsubscribed'/> <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='contact@domain' subscription='none' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> As a result of this activity, the contact is now in(2) MUST route theuser's roster with a subscription statepresence stanza of"none", whereastype "unsubscribe" to theuser is not incontact, first stamping thecontact's roster at all. 7.3 Creating a Mutual Subscription The user and contact can build on'from' address as theforegoing to create a mutual subscription (i.e., a subscriptionbare JID (<user@somedomain>) oftype "both"). The process isthe user: Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page33]42] Internet-Draft XMPP Instant MessagingJuneJuly 2003defined below. 1. If the contact wants to create a mutual subscription, the contact MUST send a subscription request to<iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='contact@otherdomain' subscription='from' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> <presence from='user@somedomain' to='contact@otherdomain' type='unsubscribe'/> 3. Upon receiving theuser (subjectpresence stanza of type "unsubscribe" addressed toconfigured preferences,thecontact's client MAY send this automatically): <presence to='user@domain' type='subscribe'/> 2. As a result,contact, the contact's server (1) MUST initiate a "roster push" to all available resources associated with the contact that have requested the roster,withcontaining an updated roster item for the userstill in the 'from' subscription state butwitha pending 'to' subscription denoted bytheinclusion'subscription' attribute set to a value of "to" (if theask='subscribe' attribute incontact is offline, the contact's server MUST modify the rosteritem;item and(2) MUST routesend that modified item thepresence stanza of type "subscribe" tonext time theuser, first stampingcontact requests the'from' address asroster); and (2) MUST deliver thebare JID (<contact@domain>) of"unsubscribe" state change notification to the contact: <iq type='set'> <query xmlns='jabber:iq:roster'> <itemjid='user@domain' subscription='from' ask='subscribe'jid='user@somedomain' subscription='to' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> <presencefrom='contact@domain' to='user@domain' type='subscribe'/> 3.from='user@somedomain' to='contact@otherdomain' type='unsubscribe'/> 4. Upon receiving the presence stanza of type "unsubscribe", the contact SHOULD acknowledge receipt of that subscription state notification through either accepting it by sending a presence stanza of type "unsubscribed" to the user or denying it by sending a presence stanza of type "subscribed" to the user; this step lets the contact's server know that it must no longer send Saint-Andre & Miller Expires January 26, 2004 [Page 43] Internet-Draft XMPP Instant Messaging July 2003 notification of the subscription state change to the contact (see Section 8.6). 5. The contact's server then (1) MUST send a presence stanza of type "unsubscribed" to the user; and (2) SHOULD send unavailable presence from the contact to the user: <presence from='contact@otherdomain' to='user@somedomain' type='unsubscribed'/> <presence from='contact@otherdomain' to='user@somedomain' type='unavailable'/> 6. When the user's server receives a presence stanza of type "unsubscribed" and/or unavailable presence, it MUST deliver them to the user: <presence from='contact@otherdomain' to='user@somedomain' type='unsubscribed'/> <presence from='contact@otherdomain' to='user@somedomain' type='unavailable'/> 7. Upon receiving the presence stanza of type "unsubscribed", the user SHOULD acknowledge receipt of that subscription state notification through either accepting it by sending a presence stanza of type "unsubscribe" to the contact or denying it by sending a presence stanza of type "subscribe"addressedto theuser,contact; this step lets the user's server know that it mustdetermine if there is at least one active session in whichno longer send notification of the subscription state change to the userhas sent available presence and has requested(see Section 8.6). Note: Obviously this does not result in removal of theroster. If so,roster item from the user'sserver MUST deliverroster, and the contact still has a subscriptionrequestto the user's presence. In order to both completely cancel a mutual subscription and fully remove the roster item from the user's roster, the user(if not, it MUST storeshould update the roster item with subscription='remove' as defined in Section 7.6. Saint-Andre & Miller Expires January 26, 2004 [Page 44] Internet-Draft XMPP Instant Messaging July 2003 7.5 Cancelling a Subscription At any time after approving a subscription requestoffline for delivery whenfrom a user, a contact MAY cancel that subscription. While the XML that the contact sends to make thisconditionhappen isnext met). No matter whenthe same in all instances, the subsequent subscriptionrequeststate isdelivered,different depending on theuser must then decide whether or not to accept it (subject to configured preferences,subscription state obtaining when theuser's client MAY accept or denycancellation was sent. Both possible scenarios are defined below. 7.5.1 Case #1: Cancelling When Subscription is Not Mutual In the first case, the user has a subscriptionrequest without presenting itto theuser). Here we assumecontact but the"happy path" thatcontact does not have a subscription to the useraccepts(i.e., the subscriptionrequest (the alternate flow of decliningis not yet mutual). 1. If thesubscription request is defined in Section 7.3.1). In this Saint-Andre & Miller Expires December 28, 2003 [Page 34] Internet-Draft XMPP Instant Messaging June 2003 case,contact wants to cancel the user'sclientsubscription, the contact MUST send a presence stanza of type"subscribed" to the contact in order"unsubscribed" toacceptthesubscription request.user: <presenceto='contact@domain' type='subscribed'/> 4.to='user@somedomain' type='unsubscribed'/> 2. As a result, theuser'scontact's server (1) MUSTinitiatesend a "roster push" to all of theuser'scontact's available resources that have requested the roster, containingaan updated roster item for thecontactuser with the 'subscription' attribute set to a value of"both";"none"; (2) MUST route the presence stanza of type"subscribed""unsubscribed" to thecontact,user, first stamping the 'from' address as the bare JID(<user@domain>)(<contact@otherdomain>) of theuser;contact; and (3) SHOULD sendavailableunavailable presence fromeach oftheuser's available resourcescontact to thecontact:user: Saint-Andre & Miller Expires January 26, 2004 [Page 45] Internet-Draft XMPP Instant Messaging July 2003 <iq type='set'> <query xmlns='jabber:iq:roster'> <itemjid='contact@domain' subscription='both' name='MyContact'> <group>MyBuddies</group>jid='user@somedomain' subscription='none' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> <presencefrom='user@domain' to='contact@domain' type='subscribed'/>from='contact@otherdomain' to='user@somedomain' type='unsubscribed'/> <presencefrom='user@domain/resource' to='contact@domain'/> 5.from='contact@otherdomain' to='user@somedomain' type='unavailable'/> 3. Upon receiving the presence stanza of type"subscribed""unsubscribed" addressed to thecontact, 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', ask='subscribe' or (b) subscription='from', ask='subscribe'. If the user is not in the contact's roster with either of those states, the contact's server MUST silently ignore the presence stanza of type "subscribed" (i.e., it MUST NOT route it to the contact, modify the contact's roster, or generate a roster push to the contact's available resources). If the user is in the contact's roster with either of those states,user, thecontact'suser's server (1) MUSTdeliver the presence stanza of type "subscribed" from the user to the contact; (2) MUSTinitiate a "roster push" to all of the user's availableSaint-Andre & Miller Expires December 28, 2003 [Page 35] Internet-Draft XMPP Instant Messaging June 2003resourcesassociated with the contactthat have requested the roster, containing an updated roster itemforfor the contact with the 'subscription' attribute set to a value of "none" (if the user is offline, the user's server MUST modify the roster item and send that modified item the next time the userwithrequests the'subscription' attribute setroster); (2) MUST deliver the "unsubscribed" state change notification toa value of "both";the user; and (3) MUST deliver theavailableunavailable presencestanza received from each of the user's available resourcestoeach ofthecontact's available resources: <presence from='user@domain' to='contact@domain' type='subscribed'/>user: Saint-Andre & Miller Expires January 26, 2004 [Page 46] Internet-Draft XMPP Instant Messaging July 2003 <iq type='set'> <query xmlns='jabber:iq:roster'> <itemjid='user@domain' subscription='both' name='SomeUser'> <group>SomeGroup</group>jid='contact@otherdomain' subscription='none' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> <presencefrom='user@domain/resource' to='contact@domain/resource'/> The user andfrom='contact@otherdomain' to='user@somedomain' type='unsubscribed'/> <presence from='contact@otherdomain' to='user@somedomain' type='unavailable'/> 4. Upon receiving thecontact now have a mutual subscription to each other'spresence-- i.e., the subscription isstanza of type"both". The user's server MUST now send the user's current presence information to the contact. (Note: If at this point"unsubscribed", the usersends aSHOULD acknowledge receipt of that subscriptionrequeststate notification through either accepting it by sending a presence stanza of type "unsubscribe" to the contact orthe contact sendsdenying it by sending asubscription requestpresence stanza of type "subscribe" to theuser,contact; this step lets thesendinguser's serverMUST silently ignoreknow thatrequest and not routeitto the intended recipient.) 7.3.1 Alternate Flow: User Declines Subscription Request The above activity flow represents the "happy path" related tomust no longer send notification of thecontact'ssubscriptionrequeststate change to theuser. The main alternate flow occurs if the user denies the contact's subscription request. 1. If theuserwants to deny the request, the user's client MUST send a presence stanza of type "unsubscribed" to the contact (instead of the presence stanza of type "subscribed" sent in Step 3 of(see Section7.3): <presence to='contact@domain' type='unsubscribed'/> Saint-Andre & Miller Expires December 28, 2003 [Page 36] Internet-Draft XMPP Instant Messaging June 2003 2. As8.6). 7.5.2 Case #2: Cancelling When Subscription is Mutual In the second case, the user has aresult,subscription to theuser's server MUST routecontact and thepresence stanza of type "unsubscribed"contact also has a subscription to thecontact, first stampinguser (i.e., the'from' address assubscription is mutual). 1. If thebare JID (<user@domain>) ofcontact wants to cancel theuser: <presence from='user@domain' to='contact@domain' type='unsubscribed'/> 3. Upon receivinguser's subscription, the contact MUST send a presence stanza of type "unsubscribed"addressedto thecontact,user: <presence to='user@somedomain' type='unsubscribed'/> 2. As a result, the contact's server (1) MUSTdeliver that presence stanza to the contact; and (2) MUST initiatesend a "roster push" to all of the contact's available resourcesassociated with the contactthat 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 to='contact@domain' from='user@domain' type='unsubscribed'/> <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='user@domain' subscription='from' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> As a result of this activity, there has been no change in the subscription state; i.e., the contact is in the user's roster with a subscription state of "to" and the user is in"to"; (2) MUST route thecontact's roster with a subscription statepresence stanza of"from". 7.4 Unsubscribing At any time after subscribing to a contact's presence, a user MAY unsubscribe. While the XML that the user sendstype "unsubscribed" tomake this happen is the same in all instances, the subsequent subscription state is different depending on the subscription state obtaining whentheunsubscribe "command" was sent. Both possible scenarios are defined below.user, Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page37]47] Internet-Draft XMPP Instant MessagingJuneJuly 20037.4.1 Case #1: Unsubscribing When Subscription is Not Mutual In thefirstcase, the user has a subscription to the contact butstamping thecontact does not have a subscription to'from' address as theuser (i.e.,bare JID (<contact@otherdomain>) of thesubscription is not yet mutual). 1. Ifcontact; and (3) SHOULD send unavailable presence from theuser wantscontact tounsubscribe fromthecontact's presence,user: <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='user@somedomain' subscription='to' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> <presence from='contact@otherdomain' to='user@somedomain' type='unsubscribed'/> <presence from='contact@otherdomain' to='user@somedomain' type='unavailable'/> 3. Upon receiving theuser MUST send apresence stanza of type"unsubscribe""unsubscribed" addressed to thecontact: <presence to='contact@domain' type='unsubscribe'/> 2. As a result,user, the user's server (1) MUSTsendinitiate a "roster push" to all of the user's available resources that have requested the roster, containing an updated roster item for the contact with the 'subscription' attribute set to a value of"none";"from" (if the user is offline, the user's server MUST modify the roster item and send that modified item the next time the user requests the roster); and (2) MUSTroutedeliver thepresence stanza of type "unsubscribe""unsubscribed" state change notification to thecontact, first stamping the 'from' address asuser; and (3) MUST deliver thebare JID (<user@domain>) ofunavailable presence to the user: Saint-Andre & Miller Expires January 26, 2004 [Page 48] Internet-Draft XMPP Instant Messaging July 2003 <iq type='set'> <query xmlns='jabber:iq:roster'> <itemjid='contact@domain' subscription='none'jid='contact@otherdomain' subscription='from' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> <presencefrom='user@domain' to='contact@domain' type='unsubscribe'/> 3.from='contact@otherdomain' to='user@somedomain' type='unsubscribed'/> <presence from='contact@otherdomain' to='user@somedomain' type='unavailable'/> 4. Upon receiving the presence stanza of type "unsubscribed", the user SHOULD acknowledge receipt of that subscription state notification through either accepting it by sending a presence stanza of type "unsubscribe"addressedto thecontact,contact or denying it by sending a presence stanza of type "subscribe" to thecontact'scontact; this step lets the user's server(1) MUST initiateknow that it must no longer send notification of the subscription state change to the user (see Section 8.6). Note: Obviously this does not result in removal of the roster item from the contact's roster, and the contact still has a subscription to the user's presence. In order to both completely cancel a mutual subscription and fully remove the roster item from the contact's roster, the contact should update the roster item with subscription='remove' as defined in Section 7.6. 7.6 Removing a Roster Item and Cancelling All Subscriptions Because there may be many steps involved in completely removing a"roster push" to all available resources associated with the contact that have requestedroster item and cancelling subscriptions in both directions, XMPP IM includes a "shortcut" method for doing so. The process may be initiated no matter what theroster,current subscription state is by sending a roster set containing anupdated rosteritem for theusercontact with the 'subscription' attribute set to a value of"none" (if the contact is offline, the contact's server MUST modify the roster item and send that modified item the next time the contact requests the roster); and (2) SHOULD deliver the unsubscribe command to the contact:"remove": Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page38]49] Internet-Draft XMPP Instant MessagingJuneJuly 2003 <iqtype='set'>type='set' id='remove1'> <query xmlns='jabber:iq:roster'> <itemjid='user@domain' subscription='none' name='SomeUser'> <group>SomeGroup</group> </item>jid='contact@otherdomain' subscription='remove'/> </query> </iq><presence to='contact@domain' from='user@domain' type='unsubscribe'/> 4. The contact's server then (1) MAY send a presence stanza of type "unsubscribed" toWhen theuser; and (2) SHOULD send unavailable presenceuser removes a contact from his or her roster by setting thecontact'subscription' attribute tothe user: <presence to='user@domain' from='contact@domain' type='unsubscribed'/> <presence to='user@domain' from='contact@domain' type='unavailable'/> 5. Ifa value of "remove", the user's serverreceives a presence stanza of type "unsubscribed" and/or unavailable presence, it(1) MUSTdeliver them to the user: <presence to='user@domain' from='contact@domain' type='unavailable'/> <presence to='user@domain' from='contact@domain' type='unsubscribed'/> 7.4.2 Case #2: Unsubscribing When Subscription is Mutual In the second case, the user has aautomatically cancel any existing presence subscriptiontobetween thecontactuser andSaint-Andre & Miller Expires December 28, 2003 [Page 39] Internet-Draft XMPP Instant Messaging June 2003the contactalso has a subscription to the user (i.e., the subscription is mutual). 1. If(both 'to' and 'from' as appropriate); (2) MUST remove theuser wants to unsubscriberoster item from thecontact's presence,user's roster and inform all of the user's available resources of theuserroster item removal; (3) MUST inform the resource that initiated the removal of success; and (4) SHOULD sendaunavailable presencestanza of type "unsubscribe"to the contact: <presenceto='contact@domain'from='user@somedomain' to='contact@otherdomain' type='unsubscribe'/>2. As a result,<presence from='user@somedomain' to='contact@otherdomain' type='unsubscribed'/> <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='contact@otherdomain' subscription='remove'/> </query> </iq> <iq type='result' id='remove1'/> <presence from='user@somedomain' to='contact@otherdomain' type='unavailable'/> Upon receiving theuser'spresence stanza of type "unsubscribe", the contact's server (1) MUSTsendinitiate a "roster push" to allof the user'savailable resources associated with the contact that have requested the roster, containing an updated roster item for thecontactuser with the 'subscription' attribute set to a value of"from";"to" (if the contact is offline, the contact's server MUST modify the roster item and(2) routesend Saint-Andre & Miller Expires January 26, 2004 [Page 50] Internet-Draft XMPP Instant Messaging July 2003 that modified item thepresence stanza of type "unsubscribe" tonext time thecontact, first stampingcontact requests the'from' address asroster); and (2) MUST also deliver thebare JID (<user@domain>) of"unsubscribe" state change notification to theuser:contact: <iq type='set'> <query xmlns='jabber:iq:roster'> <itemjid='contact@domain' subscription='from' name='MyContact'> <group>MyBuddies</group>jid='user@somedomain' subscription='to' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> <presencefrom='user@domain' to='contact@domain'from='user@somedomain' to='contact@otherdomain' type='unsubscribe'/>3.Upon receiving the presence stanza of type"unsubscribe" addressed to the contact,"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 the user with the 'subscription' attribute set to a value of"to""none" (if the contact is offline, the contact's server MUST modify the roster item and send that modified item the next time the contact requests the roster); and (2)SHOULDMUST also deliver theunsubscribe command"unsubscribe" state change notification to the contact:Saint-Andre & Miller Expires December 28, 2003 [Page 40] Internet-Draft XMPP Instant Messaging June 2003<iq type='set'> <query xmlns='jabber:iq:roster'> <itemjid='user@domain' subscription='to'jid='user@somedomain' subscription='none' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> <presenceto='contact@domain' from='user@domain' type='unsubscribe'/> 4. The contact's server then (1) MAY send afrom='user@somedomain' to='contact@otherdomain' type='unsubscribed'/> Upon receiving the presence stanza of type"unsubscribed" to the user; and (2) SHOULD send unavailable presence from the contact"unavailable" addressed to theuser: <presence to='user@domain' from='contact@domain' type='unsubscribed'/> <presence to='user@domain' from='contact@domain' type='unavailable'/> 5. Ifcontact, theuser'scontact's serverreceives a presence stanza of type "unsubscribed" and/or unavailable presence, itMUST deliverthemthe unavailable Saint-Andre & Miller Expires January 26, 2004 [Page 51] Internet-Draft XMPP Instant Messaging July 2003 presence to the user: <presenceto='user@domain' from='contact@domain' type='unsubscribed'/> <presence to='user@domain' from='contact@domain'from='user@somedomain' to='contact@otherdomain' type='unavailable'/>Note: Obviously this does not result in removal ofNote that when the user removes theroster itemcontact from the user's roster,andthecontactend state of the contact's roster is that the user is stillhasin the contact's roster with a subscriptionto the user's presence. Instate of "none"; in order tobothcompletelycancel a mutual subscription and fullyremove the roster itemfromfor theuser's roster,user, the contact needs to also send a roster removal request. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page41]52] Internet-Draft XMPP Instant MessagingJuneJuly 2003the user should update the roster item with subscription='remove' as defined in Section 7.6. 7.5 Cancelling a8. SubscriptionAt any time after approvingStates This section summarizes information about subscription states. 8.1 Defined States There are nine possible subscription states: 1. "None" = you and I are not subscribed to each other, and neither of us has requested a subscriptionrequestfroma user, a contact MAY cancel that subscription. While the XML thatthecontact sendsother 2. "None + Pending Out" = you and I are not subscribed tomake this happen is the same in all instances, the subsequenteach other, and I've sent you a subscriptionstate is different depending on therequest but you have not responded yet 3. "None + Pending In" = you and I are not subscribed to each other, and you've sent me a subscriptionstate obtaining when the cancellation was sent. Both possible scenariosrequest but I have not responded yet 4. "None + Pending Out/In" = you and I aredefined below. 7.5.1 Case #1: Cancelling When Subscription is Not Mutual In the first case, the user hasnot subscribed to each other, you've sent me a subscription request but I have not responded yet, and I've sent you a subscription request but you have not responded yet 5. "To" = I'm subscribed to you (one-way) 6. "To + Pending In" = I'm subscribed to you, and you've send me a subscription request but I have not responded yet 7. "From" = you're subscribed to me (one-way) 8. "From + Pending Out" = you're subscribed to me, and I've sent you a subscriptionto the contactrequest butthe contact does notyou havea subscription to the user (i.e., the subscription isnot responded yetmutual). 1. If the contact wants9. "Both" = we're subscribed tocancel the user's subscription, the contact MUST send a presence stanzaeach other (two-way) 8.2 Server Handling oftype "unsubscribed" to the user: <presence to='user@domain' type='unsubscribed'/> 2. AsOutbound Presence, Categorized by Subscription State This section defines how aresult, the contact'sserver(1)MUSTsend a "roster push" to all of the contact's available resources that have requested the roster, containinghandle anupdated roster item for the user with the 'subscription' attribute set to a value of "none"; (2) MUST route theoutbound presence stanza of type"unsubscribed" to the user, first stamping the 'from' address as the bare JID (<contact@domain>) of the contact;"subscribe", "subscribed", "unsubscribe", and(3) SHOULD send unavailable presence from the contact to the user: Saint-Andre & Miller Expires December 28, 2003 [Page 42] Internet-Draft XMPP Instant Messaging June 2003 <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='user@domain' subscription='none' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> <presence to='user@domain' from='contact@domain' type='unsubscribed'/> <presence to='user@domain' from='contact@domain' type='unavailable'/> 3. Upon receiving the presence stanza of type"unsubscribed"addressed(i.e., route it to theuser, the user's server (1) MUST initiateintended recipient and/or make a"roster push"change toall of the user's available resources that have requested the roster, containing an updated roster item forthecontact with the 'subscription' attribute set to a value of "none" (ifsubscription state), categorized by theusercurrent subscription state. The general rule isoffline, the user'sthat a server MUSTmodify the roster item and send that modified itemroute thenext timestanza to theuser requestsintended recipient if it would change theroster);subscription state, and(2) SHOULD deliverMUST NOT route thepresencestanzaof type "unsubscribed" toif it would not change the subscription state. Detailed definitions are contained in theuser: <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='contact@domain' subscription='none' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> <presence to='user@domain' from='contact@domain' type='unsubscribed'/>Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page43]53] Internet-Draft XMPP Instant MessagingJuneJuly 20034. Upon receivingfollowing sections. Naturally, if thepresencestanzaof type "unavailable" addressed tochanges theuser,subscription state, theuser'sserver MUSTdeliver the unavailable presence to the user: <presence to='user@domain' from='contact@domain' type='unavailable'/> 7.5.2 Case #2: Cancelling When Subscription is Mutual In the second case, the user has a subscription to the contact and the contactalsohas a subscription to the user (i.e.,change the subscriptionis mutual). 1. If the contact wants to cancel the user's subscription, the contact MUST send a presence stanzastate. 8.2.1 Subscription State = None +-------------------------------------------------------+ | STANZA TYPE | ROUTE? | NEW STATE | +-------------------------------------------------------+ | subscribe | yes | "None + Pending Out" | | subscribed | no | no state change | | unsubscribe | no | no state change | | unsubscribed | no | no state change | +-------------------------------------------------------+ 8.2.2 Subscription State = None + Pending Out +-------------------------------------------------------+ | STANZA TYPE | ROUTE? | NEW STATE | +-------------------------------------------------------+ | subscribe | no | no state change | | subscribed | no | no state change | | unsubscribe | yes | "None" | | unsubscribed | no | no state change | +-------------------------------------------------------+ 8.2.3 Subscription State = None + Pending In +-------------------------------------------------------+ | STANZA TYPE | ROUTE? | NEW STATE | +-------------------------------------------------------+ | subscribe | yes | "None + Pending Out/In" | | subscribed | yes | "From" | | unsubscribe | no | no state change | | unsubscribed | yes | "None" | +-------------------------------------------------------+ Saint-Andre & Miller Expires January 26, 2004 [Page 54] Internet-Draft XMPP Instant Messaging July 2003 8.2.4 Subscription State = None + Pending Out/In +-------------------------------------------------------+ | STANZA TYPE | ROUTE? | NEW STATE | +-------------------------------------------------------+ | subscribe | no | no state change | | subscribed | yes | "From + Pending Out" | | unsubscribe | yes | "None + Pending In" | | unsubscribed | yes | "None + Pending Out" | +-------------------------------------------------------+ 8.2.5 Subscription State = To +-------------------------------------------------------+ | STANZA TYPE | ROUTE? | NEW STATE | +-------------------------------------------------------+ | subscribe | no | no state change | | subscribed | no | no state change | | unsubscribe | yes | "None" | | unsubscribed | no | no state change | +-------------------------------------------------------+ 8.2.6 Subscription State = To + Pending In +-------------------------------------------------------+ | STANZA TYPE | ROUTE? | NEW STATE | +-------------------------------------------------------+ | subscribe | no | no state change | | subscribed | yes | "Both" | | unsubscribe | yes | "None + Pending In" | | unsubscribed | yes | "To" | +-------------------------------------------------------+ Saint-Andre & Miller Expires January 26, 2004 [Page 55] Internet-Draft XMPP Instant Messaging July 2003 8.2.7 Subscription State = From +-------------------------------------------------------+ | STANZA TYPE | ROUTE? | NEW STATE | +-------------------------------------------------------+ | subscribe | yes | "From + Pending Out" | | subscribed | no | no state change | | unsubscribe | no | no state change | | unsubscribed | yes | "None" | +-------------------------------------------------------+ 8.2.8 Subscription State = From + Pending Out +-------------------------------------------------------+ | STANZA TYPE | ROUTE? | NEW STATE | +-------------------------------------------------------+ | subscribe | no | no state change | | subscribed | no | no state change | | unsubscribe | yes | "From" | | unsubscribed | yes | "None + Pending Out" | +-------------------------------------------------------+ 8.2.9 Subscription State = Both +-------------------------------------------------------+ | STANZA TYPE | ROUTE? | NEW STATE | +-------------------------------------------------------+ | subscribe | no | no state change | | subscribed | no | no state change | | unsubscribe | yes | "From" | | unsubscribed | yes | "To" | +-------------------------------------------------------+ 8.3 Server Handling oftype "unsubscribed" to the user: <presence to='user@domain' type='unsubscribed'/> 2. AsOutbound Presence, Categorized by Presence Type This section defines how aresult, the contact'sserver(1)MUSTsend a "roster push" to all of the contact's available resources that have requested the roster, containinghandle anupdated roster item for the user with the 'subscription' attribute set to a value of "to"; (2) MUST route theoutbound presence stanza of type "subscribe", "subscribed", "unsubscribe", and "unsubscribed" (i.e., route it to theuser, first stamping the 'from' address as the bare JID (<contact@domain>) of the contact; and (3) SHOULD send unavailable presence from the contactintended recipient and/or make a change to theuser:subscription state), categorized by presence type. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page44]56] Internet-Draft XMPP Instant MessagingJuneJuly 2003<iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='user@domain' subscription='to' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> <presence from='contact@domain' to='user@domain' type='unsubscribed'/> <presence from='contact@domain' to='user@domain' 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 available resources that have requested the roster, containing an updated roster item for the contact with the 'subscription' attribute set to a value of "from" (if the user is offline, the user's server MUST modify the roster item and send that modified item the next time the user requests the roster); and (2) SHOULD deliver the presence stanza of type "unsubscribed" to the user: <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='contact@domain' subscription='from' name='MyContact'> <group>MyBuddies</group> </item> </query> </iq> <presence to='user@domain' from='contact@domain' type='unsubscribed'/>8.3.1 Subscribe +----------------------------------------------------------------+ | EXISTING STATE | ROUTE? | NEW STATE | +----------------------------------------------------------------+ | "None" | yes | "None + Pending Out" | | "None + Pending Out" | no | no state change | | "None + Pending In" | yes | "None + Pending Out/In" | | "None + Pending Out/In" | no | no state change | | "To" | no | no state change | | "To + Pending In" | no | no state change | | "From" | yes | "From + Pending Out" | | "From + Pending Out" | no | no state change | | "Both" | no | no state change | +----------------------------------------------------------------+ 8.3.2 Subscribed +----------------------------------------------------------------+ | EXISTING STATE | ROUTE? | NEW STATE | +----------------------------------------------------------------+ | "None" | no | no state change | | "None + Pending Out" | no | 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" | | "From" | no | no state change | | "From + Pending Out" | no | no state change | | "Both" | no | no state change | +----------------------------------------------------------------+ Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page45]57] Internet-Draft XMPP Instant MessagingJuneJuly 20034. Upon receiving the8.3.3 Unsubscribe +----------------------------------------------------------------+ | EXISTING STATE | ROUTE? | NEW STATE | +----------------------------------------------------------------+ | "None" | no | no state change | | "None + Pending Out" | no | no state change | | "None + Pending In" | no | no state change | | "None + Pending Out/In" | yes | "None + Pending In" | | "To" | yes | "None" | | "To + Pending In" | yes | "None + Pending In" | | "From" | no | no state change | | "From + Pending Out" | yes | "From" | | "Both" | yes | "From" | +----------------------------------------------------------------+ Note: When a user sends an outbound presence stanza of type"unavailable" addressed to the user, the user's server MUST deliver the unavailable presence to the user: <presence to='user@domain' from='contact@domain' type='unavailable'/> Note: Obviously this does not result"unsubscribe" that results inremoval of the roster item from the contact's roster, and the contact still has a subscription to the user's presence. In order to both completely cancelamutualsubscriptionand fully remove the roster item fromstate change, the contact'sroster, the contact should update the roster item with subscription='remove' as defined in Section 7.6. 7.6 Removing a Roster Item and Cancelling All Subscriptions Because there may be many steps involved in completely removing a roster item and cancelling subscriptions in both directions, XMPP IM includes a "shortcut" method for doing so. The process may be initiated no matter what the current subscription state isserver SHOULD auto-reply by sending aroster set containing an item for the contact with the 'subscription' attribute set to a valuepresence stanza of"remove": <iq type='set' id='remove1'> <query xmlns='jabber:iq:roster'> <item jid='contact@domain' subscription='remove'/> </query> </iq> Whentype "unsubscribed" to the userremoves a contact from his or her roster by settingon behalf of the'subscription' attributecontact and MUST deliver that presence stanza toa valuethe contact. 8.3.4 Unsubscribed +----------------------------------------------------------------+ | EXISTING STATE | ROUTE? | NEW STATE | +----------------------------------------------------------------+ | "None" | no | no state change | | "None + Pending Out" | no | no state change | | "None + Pending In" | yes | "None" | | "None + Pending Out/In" | yes | "None + Pending Out" | | "To" | no | no state change | | "To + Pending In" | yes | "To" | | "From" | yes | "None" | | "From + Pending Out" | yes | "None + Pending Out" | | "Both" | yes | "To" | +----------------------------------------------------------------+ 8.4 Server Handling of"remove", the user'sInbound Presence, Categorized by Subscription State This section defines how a server(1)MUSTautomatically cancel any existinghandle an inbound presencesubscription between the userstanza of type "subscribe", "subscribed", "unsubscribe", and "unsubscribed" (i.e., deliver it to thecontact (both 'to' and 'from'intended recipient and/or make a change to the subscription state), categorized by subscription state. (Note: some of the presence stanza type should never be received asappropriate); (2)inbound stanzas, since the sender's server MUSTremoveNOT route Saint-Andre & Miller Expires January 26, 2004 [Page 58] Internet-Draft XMPP Instant Messaging July 2003 them to theroster item fromintended recipient; however, these stanza types are included for theuser's roster and inform allsake ofthe user's available resourcescompleteness.) 8.4.1 Subscription State = None +--------------------------------------------------------+ | STANZA TYPE | DELIVER? | NEW STATE | +--------------------------------------------------------+ | subscribe | yes | "None + Pending In" | | subscribed | no | no state change | | unsubscribe | no | no state change | | unsubscribed | no | no state change | +--------------------------------------------------------+ 8.4.2 Subscription State = None + Pending Out +--------------------------------------------------------+ | STANZA TYPE | DELIVER? | NEW STATE | +--------------------------------------------------------+ | subscribe | yes | "None + Pending Out/In" | | subscribed | yes | "To" | | unsubscribe | no | no state change | | unsubscribed | yes | "None" | +--------------------------------------------------------+ 8.4.3 Subscription State = None + Pending In +--------------------------------------------------------+ | STANZA TYPE | DELIVER? | NEW STATE | +--------------------------------------------------------+ | subscribe | no | no state change | | subscribed | no | no state change | | unsubscribe | yes | "None" | | unsubscribed | no | no state change | +--------------------------------------------------------+ Saint-Andre & Miller Expires January 26, 2004 [Page 59] Internet-Draft XMPP Instant Messaging July 2003 8.4.4 Subscription State = None + Pending Out/In +--------------------------------------------------------+ | STANZA TYPE | DELIVER? | NEW STATE | +--------------------------------------------------------+ | subscribe | no | no state change | | subscribed | yes | "To + Pending In" | | unsubscribe | yes | "None + Pending Out" | | unsubscribed | yes | "None + Pending In" | +--------------------------------------------------------+ 8.4.5 Subscription State = To +--------------------------------------------------------+ | STANZA TYPE | DELIVER? | NEW STATE | +--------------------------------------------------------+ | subscribe | yes | "To + Pending In" | | subscribed | no | no state change | | unsubscribe | no | no state change | | unsubscribed | yes | "None" | +--------------------------------------------------------+ 8.4.6 Subscription State = To + Pending In +--------------------------------------------------------+ | STANZA TYPE | DELIVER? | NEW STATE | +--------------------------------------------------------+ | subscribe | no | no state change | | subscribed | no | no state change | | unsubscribe | yes | "To" | | unsubscribed | yes | "None + Pending In" | +--------------------------------------------------------+ Saint-Andre & Miller Expires January 26, 2004 [Page 60] Internet-Draft XMPP Instant Messaging July 2003 8.4.7 Subscription State = From +--------------------------------------------------------+ | STANZA TYPE | DELIVER? | NEW STATE | +--------------------------------------------------------+ | subscribe | no | no state change | | subscribed | no | no state change | | unsubscribe | yes | "None" | | unsubscribed | no | no state change | +--------------------------------------------------------+ 8.4.8 Subscription State = From + Pending Out +--------------------------------------------------------+ | STANZA TYPE | DELIVER? | NEW STATE | +--------------------------------------------------------+ | subscribe | no | no state change | | subscribed | yes | "Both" | | unsubscribe | yes | "None + Pending Out" | | unsubscribed | yes | "From" | +--------------------------------------------------------+ 8.4.9 Subscription State = Both +--------------------------------------------------------+ | STANZA TYPE | DELIVER? | NEW STATE | +--------------------------------------------------------+ | subscribe | no | no state change | | subscribed | no | no state change | | unsubscribe | yes | "To" | | unsubscribed | yes | "From" | +--------------------------------------------------------+ 8.5 Server Handling ofthe roster item removal; (3)Inbound Presence, Categorized by Presence Type This section defines how a server MUSTinform the resource that initiated the removalhandle an inbound presence stanza ofsuccess;type "subscribe", "subscribed", "unsubscribe", and(4) SHOULD send unavailable presence"unsubscribed" (i.e., deliver it to thecontact:intended recipient and/or make a change to the subscription state), categorized by presence type. Saint-Andre & Miller ExpiresDecember 28,January 26, 2004 [Page 61] Internet-Draft XMPP Instant Messaging July 2003 8.5.1 Subscribe +------------------------------------------------------------------+ | EXISTING STATE | DELIVER? | NEW STATE | +------------------------------------------------------------------+ | "None" | yes | "None + Pending In" | | "None + Pending Out" | yes | "None + Pending Out/In" | | "None + Pending In" | no | no state change | | "None + Pending Out/In" | no | no state change | | "To" | yes | "To + Pending In" | | "To + Pending In" | no | no state change | | "From" | no | no state change | | "From + Pending Out" | no | no state change | | "Both" | no | no state change | +------------------------------------------------------------------+ 8.5.2 Subscribed +------------------------------------------------------------------+ | EXISTING STATE | DELIVER? | NEW STATE | +------------------------------------------------------------------+ | "None" | no | no state change | | "None + Pending Out" | yes | "To" | | "None + Pending In" | no | no state change | | "None + Pending Out/In" | yes | "To + Pending In" | | "To" | no | no state change | | "To + Pending In" | no | no state change | | "From" | no | no state change | | "From + Pending Out" | yes | "Both" | | "Both" | no | no state change | +------------------------------------------------------------------+ Saint-Andre & Miller Expires January 26, 2004 [Page46]62] Internet-Draft XMPP Instant MessagingJuneJuly 2003<presence from='user@domain' to='contact@domain' type='unsubscribe'/> <presence from='user@domain' to='contact@domain' type='unsubscribed'/> <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='contact@domain' subscription='remove'/> </query> </iq> <iq type='result' id='remove1'/> <presence from='user@domain' to='contact@domain' type='unavailable'/> Upon receiving the8.5.3 Unsubscribe +------------------------------------------------------------------+ | EXISTING STATE | DELIVER? | NEW STATE | +------------------------------------------------------------------+ | "None" | no | no state change | | "None + Pending Out" | no | no state change | | "None + Pending In" | yes | "None" | | "None + Pending Out/In" | yes | "None + Pending Out" | | "To" | no | no state change | | "To + Pending In" | yes | "To" | | "From" | yes | "None" | | "From + Pending Out" | yes | "None + Pending Out | | "Both" | yes | "To" | +------------------------------------------------------------------+ 8.5.4 Unsubscribed +------------------------------------------------------------------+ | EXISTING STATE | DELIVER? | NEW STATE | +------------------------------------------------------------------+ | "None" | no | no state change | | "None + Pending Out" | yes | "None" | | "None + Pending In" | no | no state change | | "None + Pending Out/In" | yes | "None + Pending In" | | "To" | yes | "None" | | "To + Pending In" | yes | "None + Pending In" | | "From" | no | no state change | | "From + Pending Out" | yes | "From" | | "Both" | yes | "From" | +------------------------------------------------------------------+ 8.6 Server Delivery and Client Acknowledgement of Subscription State Change Notifications When a server receives an inbound presencestanzaof type "subscribe", "subscribed", "unsubscribe",the contact's server (1) MUST initiateand "unsubscribed" that consists of a"roster push"subscription state change notification, in addition toall available resources associated with the contact that have requestedsending theroster, containing anappropriate "roster push" (or updated rosteritem for the user with the 'subscription' attribute set to a value of "to" (ifwhen thecontactroster isoffline, the contact's servernext requested), it MUSTmodify the roster item and send that modified itemdeliver thenext timenotification to thecontact requestsintended recipient at least once. A server MUST require theroster);recipient to approve or deny a subscription request (i.e., an inbound presence stanza of type "subscribe") and(2) SHOULD also deliverMAY require theunsubscribe commandrecipient to acknowledge receipt of thecontact: <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='user@domain' subscription='to' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> <presence to='contact@domain' from='user@domain'state change notification. In order to require acknowledgement, a server SHOULD Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page47]63] Internet-Draft XMPP Instant MessagingJuneJuly 2003type='unsubscribe'/> Upon receiving the presence stanza of type "unsubscribed",send thecontact's server (1) MUST initiate a "roster push"notification toall available resources associated withthecontact that have requested the roster, containing an updated roster item forrecipient each time theuser withrecipient logs in, until the'subscription' attribute set to a valuerecipient acknowledges receipt of"none" (ifthecontact is offline,notification by accepting or denying thecontact's server MUST modifyrelevant notification. Acknowledgement is sent by either accepting or denying theroster item and send that modified itemnotification, as shown in thenext timefollowing table: +--------------------------------------------------+ | NOTIFICATION | ACCEPT | DENY | +--------------------------------------------------+ | subscribe | subscribed | unsubscribed | | subscribed | subscribe | unsubscribe | | unsubscribe | unsubscribed | subscribed | | unsubscribed | unsubscribe | subscribe | +--------------------------------------------------+ Obviously, given thecontact requestsforegoing subscription state charts, some theroster);acknowledgement and(2) SHOULD also deliver the unsubscribe commanddenial stanzas will be routed to thecontact: <iq type='set'> <query xmlns='jabber:iq:roster'> <item jid='user@domain' subscription='none' name='SomeUser'> <group>SomeGroup</group> </item> </query> </iq> <presence to='contact@domain' from='user@domain' type='unsubscribed'/> Upon receivingcontact and result in subscription state changes, while others will not. However, any such stanzas MUST result in thepresence stanza of type "unavailable" addressedserver's no longer sending the subscription state notification to thecontact,user. Because thecontact'ssender's server MUSTdeliver the unavailableautomatically generate outbound presenceto the user: <presence from='user@domain' to='contact@domain' type='unavailable'/> Note that when the user removes the contact from the user's roster, the end statestanzas ofthe contact's roster is that the user is still in the contact'stype "unsubscribe" and "unsubscribed" upon receiving a roster set with the 'subscription' attribute set to asubscription statevalue of"none"; in order to completely remove"remove" (see Section 7.6), the server MUST treat a rosteritemremove request as equivalent to sending those presence stanzas forthe user, the contact needspurposes of determining whether toalso send a roster removal request.continue sending subscription state change notifications of type "subscribe" or "subscribed" to the user. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page48]64] Internet-Draft XMPP Instant MessagingJuneJuly 20038.9. Blocking Communication Most instant messaging systems have found it necessary to implement some method for users to block communications from particular other users (this is also required by sections 5.1.5, 5.1.15, 5.3.2, and 5.4.10 of RFC 2779 [2]). In XMPP this is done using the 'jabber:iq:privacy' namespace by managing one's privacy lists. Server-side privacy lists enable successful completion of the following use cases: o Retrieving one's privacy lists. o Adding, removing, and editing one's privacy lists. o Setting, changing, or declining active lists. o Setting, changing, or declining the default list (i.e., the list that is active by default). o Allowing or denying messages based on JID, group, or subscription type (or globally). o Allowing or denying inbound presence notifications based on JID, group, or subscription type (or globally). o Allowing or denying outbound presence notifications based on JID, group, or subscription type (or globally). o Allowing or denying IQs based on JID, group, or subscription type (or globally). o Allowing or denying all communications based on JID, group, or subscription type (or globally). Note: presence notifications do not include presence subscriptions, only presence information that is broadcasted to entities that are subscribed to a user's presence information. Thus this includes presence stanzas with no 'type' attribute or of type='unavailable' only.8.19.1 Syntax A user MAY define one or more privacy lists, which are stored by the user's server. Each <list/> element contains one or more rules in the form of <item/> elements, and each <item/> element uses attributes to define a privacy rule type, a specific value to which the rules applies, the relevant action, and the place of the item in the Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page49]65] Internet-Draft XMPP Instant MessagingJuneJuly 2003 processing order. The syntax is as follows: <iq> <query xmlns='jabber:iq:privacy'> <list name='foo'> <item type='[jid|group|subscription]' value='bar' action='[accept|deny]'order='nonNegativeInteger'/>order='unsignedInt'/> </list> </query> </iq> If the type is "jid", then the 'value' attribute MUST contain a valid Jabber ID. JIDs are matched in the following order:<user@domain/<user@somedomain/ resource>, then<user@domain>,<user@somedomain>, then<domain/resource>,<somedomain/resource>, then<domain>.<somedomain>. If the value is<user@domain>,<user@somedomain>, then any connected resource for thatuser@domainuser@somedomain matches. If the value is<domain/resource>,<somedomain/resource>, then only that resource matches. If the value is<domain>,<somedomain>, then anyuser@domainuser@somedomain (or subdomain) matches. If the type is "group", then the 'value' attributeMUSTSHOULD contain the name of a group in the user's roster. (If a client attempts to update, create, or delete a list item with a group that is not in the user's roster, the serverMUSTSHOULD return to the client an <item-not-found/> stanza error.) If the type is "subscription", then the 'value' attribute MUST be one of "both", "to", "from", or "none" as defined in XMPP Core [1]. If no 'type' attribute is included, the rule provides the "fall-through" case. The 'action' attribute MUST be included and its value MUST be either "accept" or "deny". The 'order' attribute MUST be included and its value MUST be a non-negative integer that is unique among all items in the list. (If a client attempts to create or update a list with non-unique order values, the server MUST return to the client a <bad-request/> stanza error. Within the 'jabber:iq:privacy' namespace, the <query/> child of a client-generated IQ stanza of type "set" MUST NOT include more than one child element (i.e., the stanza must contain only one <active/> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page50]66] Internet-Draft XMPP Instant MessagingJuneJuly 2003 element, one <default/> element, or one <list/> element); if a client violates this rule, the server MUST return to the client a <bad-request/> stanza error.) When a client adds or updates a privacy list, the <list/> element SHOULD contain at least one <item/> child element; when a client removes a privacy list, the <list/> element SHOULD contain no one <item/> child element. When a client updates a privacy list, it must include all of the desired items (i.e., not a "delta").8.29.2 Business Rules 1. If there is an active list set for a session, it affects only the session for which it is activated, and only for the duration of the session. Only the active list for that session is processed (i.e., the default list is ignored). 2. The default list applies to the user as a whole, and is processed if there is no active list set for the target session/resource to which a stanza is addressed, or if there are no current sessions for the user. 3. If there is no active list set for a session (or there are no current sessions for the user), and there is no default list, then all stanzas SHOULD BE accepted or appropriately processed by the server on behalf of the user. 4. Privacy lists SHOULD be the first routing and delivery rule applied by a server, trumping the other rules specified in Section9.10. 5. The order in which privacy list items are processed by the server is important. List items MUST be processed in ascending order determined by the values of the 'order' attribute for each <item/ >. 6. As soon as a stanza is matched against a privacy list, the server SHOULD appropriately handle the stanza and cease processing. 7. If no fall-through item is provided in a list, the fall-through action is assumed to be "accept". 8.WhenIf a user updates the definition fora list or adds a newan active list, subsequent processing based on that active list(whether or not it is active),MUST use theserver SHOULD NOT "push" that information out toupdated definition (for allof the user's availableresources to which thathave requested the roster's account, as is done for rosters. If aactive list currently applies). Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page51]67] Internet-Draft XMPP Instant MessagingJuneJuly 2003client or user wants to retrieve the current privacy list information, it SHOULD request the relevant list.9. If a change to the subscription state or roster group of a roster item defined in an active list occurs during a user'ssession and the activesession, subsequent processingof thebased on that active list MUSTbe based ontake into account the changed state orgroup. 8.3group (for all resources to which that active list currently applies). 9.3 Retrieving One's Privacy Lists Example: Client requests names of privacy lists from server: <iq type='get' id='getlist1'> <query xmlns='jabber:iq:privacy'/> </iq> Example: Server sends names of privacy lists to client, preceded by active list and default list: <iq type='result' id='getlist1'to='romeo@montague.net/orchard'>to='romeo@example.net/orchard'> <query xmlns='jabber:iq:privacy'> <active name='private'/> <default name='public'/> <list name='public'/> <list name='private'/> <list name='special'/> </query> </iq> Example: Client requests a privacy list from server: <iq type='get' id='getlist2'> <query xmlns='jabber:iq:privacy'> <list name='public'/> </query> </iq> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page52]68] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Example: Server sends a privacy list to client: <iq type='result' id='getlist2'to='romeo@montague.net/orchard'>to='romeo@example.net/orchard'> <query xmlns='jabber:iq:privacy'> <list name='public'> <itemjid='tybalt@capulet.com'type='jid' value='tybalt@example.com' action='deny' order='1'/> <item action='allow' order='2'/> </list> </query> </iq> Example: Client requests another privacy list from server: <iq type='get' id='getlist3'> <query xmlns='jabber:iq:privacy'> <list name='private'/> </query> </iq> Example: Server sends another privacy list to client: <iq type='result' id='getlist3'to='romeo@montague.net/orchard'>to='romeo@example.net/orchard'> <query xmlns='jabber:iq:privacy'> <list name='private'> <item type='subscription' value='both' action='allow' order='10'/> <item action='deny' order='15'/> </list> </query> </iq> Example: Client requests yet another privacy list from server: <iq type='get' id='getlist4'> <query xmlns='jabber:iq:privacy'> <list name='special'/> </query> </iq> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page53]69] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Example: Server sends yet another privacy list to client: <iq type='result' id='getlist4'to='romeo@montague.net/orchard'>to='romeo@example.net/orchard'> <query xmlns='jabber:iq:privacy'> <list name='special'> <item type='jid'value='juliet@capulet.com'value='juliet@example.com' action='allow' order='6'/> <item type='jid'value='benvolio@shakespeare.lit'value='benvolio@example.org' action='allow' order='7'/> <item type='jid'value='mercutio@verona.it'value='mercutio@shakespeare.lit' action='allow' order='42'/> <itemaction='deny'/>action='deny' order='666'/> </list> </query> </iq> In this example, the user has three lists: (1) 'public', which allows communications from everyone except one specific entity (this is the default list); (2) 'private', which allows communications only with contacts who have a bidirectional subscription with the user (this is the active list); and (3) 'special', which allows communications only with three specific entities. If the user attempts to retrieve a list but a list by that name does not exist, the server MUST return an <item-not-found> stanza error to the user: Example: Client attempts to retrieve non-existent list: <iq type='error' id='getlist5'> <query xmlns='jabber:iq:privacy'> <list name='The Empty Set'/> </query> <error type='cancel'> <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page54]70] Internet-Draft XMPP Instant MessagingJuneJuly 2003 The user is allowed to retrieve only one list at a time. If the user attempts to retrieve more than one list in the same request, the server MUST return a <bad request> stanza error to the user: Example: Client attempts to retrieve more than one list: <iq type='error' id='getlist6'> <query xmlns='jabber:iq:privacy'> <list name='public'/> <list name='private'/> <list name='special'/> </query> <error type='modify'> <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> </error> </iq>8.49.4 Managing Active Lists In order to set or change the active list currently being applied by the server, the user MUST send an IQ stanza of type "set" with a <query/> element qualified by the 'jabber:iq:privacy' namespace that contains an empty <active/> child element possessing a 'name' attribute whose value is set to the desired list name. Example: Client requests change of active list: <iq type='set' id='active1'> <query xmlns='jabber:iq:privacy'> <active name='special'/> </query> </iq> The server MUST activate and apply the requested list before sending the result back to the client. Example: Server acknowledges success of active list change: <iq type='result' id='active1'to='juliet@capulet.com/balcony'/>to='juliet@example.com/balcony'/> If the user attempts to set an active list but a list by that name does not exist, the server MUST return an <item-not-found> stanza error to the user: Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page55]71] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Example: Client attempts to set a non-existent list as active: <iq type='error' id='active2'> <query xmlns='jabber:iq:privacy'><list<active name='The Empty Set'/> </query> <error type='cancel'> <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'> </error> </iq> In order to decline the use of any active list, a user MUST send an empty <active/> element with no name. Example: Client declines the use of active lists: <iq type='set' id='active2'> <query xmlns='jabber:iq:privacy'> <active/> </query> </iq>8.59.5 Managing the Default List In order to change its default list, the user MUST send an IQ stanza of type "set" with a <query/> element qualified by the 'jabber:iq:privacy' namespace that contains an empty <default/> child element possessing a 'name' attribute whose value is set to the desired list name. Example: Client requests change of default list: <iq type='set' id='default1'> <query xmlns='jabber:iq:privacy'> <default name='special'/> </query> </iq> Example: Server acknowledges success of default list change: <iq type='result' id='default1'to='juliet@capulet.com/balcony'/>to='juliet@example.com/balcony'/> If the user attempts to set a default list but a list by that name does not exist, the server MUST return an <item-not-found> stanza error to the user: Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page56]72] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Example: Client attempts to set a non-existent list as default: <iq type='error' id='default2'> <query xmlns='jabber:iq:privacy'><list<default name='The Empty Set'/> </query> <error type='cancel'> <item-not-found xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'> </error> </iq> In order to decline the use of a default list (i.e., to use the domain's stanza routing rules at all times), a user MUST send an empty <default/> element with no name. Example: Client declines the use of the default list: <iq type='set' id='default2'> <query xmlns='jabber:iq:privacy'> <default/> </query> </iq>8.69.6 Editing a Privacy List In order to edit a privacy list, the user MUST send an IQ stanza of type "set" with a <query/> element qualified by the 'jabber:iq:privacy' namespace that contains one <list/> child element possessing a 'name' attribute whose value is set to the list name the user would like to edit. The <list/> element MUST contain one or more <item/> elements, which specify the user's desired changes to the list by including all elements in the list (not the "delta"). Example: Client edits a privacy list: <iq type='set' id='edit1'> <query xmlns='jabber:iq:privacy'> <list name='public'> <item type='jid'value='tybalt@capulet.com'value='tybalt@example.com' action='deny' order='3'/> <item type='jid'value='paris@shakespeare.lit'value='paris@example.org' action='deny' order='5'/> <item action='allow' order='68'/> </list> </query> </iq> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page57]73] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Note: The value of the 'order' attribute for any given item is not fixed. Thus in the foregoing example if the user would like to add 4 items between the"tybalt@capulet.com""tybalt@example.com" item and the"paris@shakespeare.lit""paris@example.org" item, the user's client MUST renumber the relevant items before submitting the list to the server. Example: Server acknowledges success of list edit: <iq type='result' id='edit1'to='juliet@capulet.com/balcony'/> 8.7to='juliet@example.com/balcony'/> 9.7 Adding a New Privacy List The same protocol used to edit an existing list is used to create a new list. If the list name matches that of an existing list, the request to add a new list will overwrite the old one.8.89.8 Removing a Privacy List In order to remove a privacy list, the user MUST send an IQ stanza of type "set" with a <query/> element qualified by the 'jabber:iq:privacy' namespace that contains one empty <list/> child element possessing a 'name' attribute whose value is set to the list name the user would like to remove. Example: Client removes a privacy list: <iq type='set' id='remove1'> <query xmlns='jabber:iq:privacy'> <list name='private'/> </query> </iq> Example: Server acknowledges success of list removal: <iq type='result' id='remove1'to='juliet@capulet.com/balcony'/>to='juliet@example.com/balcony'/> If a user attempts to remove an active list or the default list, the server MUST return a <conflict/> stanza error to the user. The user MUST first set another list to active or default before removing it. If the user attempts to remove a list but a list by that name does not exist, the server MUST return an <item-not-found> stanza error to the user: If the user attempts to remove more than one list in the same request, the server MUST return a <bad request> stanza error to the user. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page58]74] Internet-Draft XMPP Instant MessagingJuneJuly 20038.99.9 Blocking Messages Server-side privacy lists enable a user to block incoming messages from other users based on the other user's JID, roster group, or subscription status (or globally). The following examples illustrate the protocol. Example: User blocks based on JID: <iq type='set' id='msg1'> <query xmlns='jabber:iq:privacy'> <list name='message-jid-example'> <item type='jid'value='tybalt@capulet.com'value='tybalt@example.com' action='deny' order='3'> <message/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive messages from the user with the specified JID. Example: User blocks based on roster group: <iq type='set' id='msg2'> <query xmlns='jabber:iq:privacy'> <list name='message-group-example'> <item type='group' value='Enemies' action='deny' order='4'> <message/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive messages from any users in the specified roster group. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page59]75] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Example: User blocks based on subscription type: <iq type='set' id='msg3'> <query xmlns='jabber:iq:privacy'> <list name='message-sub-example'> <item type='subscription' value='none' action='deny' order='5'> <message/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive messages from any users with the specified subscription type. Example: User blocks globally: <iq type='set' id='msg4'> <query xmlns='jabber:iq:privacy'> <list name='message-global-example'> <item action='deny' order='6'> <message/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive messages from any other users.8.109.10 Blocking Inbound Presence Notifications Server-side privacy lists enable a user to block incoming presence notifications from other users based on the other user's JID, roster group, or subscription status (or globally). The following examples illustrate the protocol. Note: presence notifications do not include presence subscriptions, only presence information that is broadcasted to the user because the user previously subscribed to a contact's presence information. Thus this includes presence stanzas with no 'type' attribute or of type='unavailable' only. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page60]76] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Example: User blocks based on JID: <iq type='set' id='presin1'> <query xmlns='jabber:iq:privacy'> <list name='presin-jid-example'> <item type='jid'value='tybalt@capulet.com'value='tybalt@example.com' action='deny' order='7'> <presence-in/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive presence notifications from the user with the specified JID. Example: User blocks based on roster group: <iq type='set' id='presin2'> <query xmlns='jabber:iq:privacy'> <list name='presin-group-example'> <item type='group' value='Enemies' action='deny' order='8'> <presence-in/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive presence notifications from any users in the specified roster group. Example: User blocks based on subscription type: <iq type='set' id='presin3'> <query xmlns='jabber:iq:privacy'> <list name='presin-sub-example'> <item type='subscription' value='to' action='deny' order='9'> <presence-in/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive presence notifications from any users with the specified subscription type. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page61]77] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Example: User blocks globally: <iq type='set' id='presin4'> <query xmlns='jabber:iq:privacy'> <list name='presin-global-example'> <item action='deny' order='11'> <presence-in/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive presence notifications from any other users.8.119.11 Blocking Outbound Presence Notifications Server-side privacy lists enable a user to block outgoing presence notifications to other users based on the other user's JID, roster group, or subscription status (or globally). The following examples illustrate the protocol. Note: presence notifications do not include presence subscriptions, only presence information that is broadcasted to contacts because those contacts previously subscribed to the user's presence information. Thus this includes presence stanzas with no 'type' attribute or of type='unavailable' only. Note also that because information about last activity MAY be requested by a contact (as defined in Section 4.5), a user SHOULD block both outbound presence and IQs in relation to any given entity. Example: User blocks based on JID: <iq type='set' id='presout1'> <query xmlns='jabber:iq:privacy'> <list name='presout-jid-example'> <item type='jid'value='tybalt@capulet.com'value='tybalt@example.com' action='deny' order='13'> <presence-out/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not send presence notifications to the user with the specified JID. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page62]78] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Example: User blocks based on roster group: <iq type='set' id='presout2'> <query xmlns='jabber:iq:privacy'> <list name='presout-group-example'> <item type='group' value='Enemies' action='deny' order='15'> <presence-out/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not send presence notifications to any users in the specified roster group. Example: User blocks based on subscription type: <iq type='set' id='presout3'> <query xmlns='jabber:iq:privacy'> <list name='presout-sub-example'> <item type='subscription' value='from' action='deny' order='17'> <presence-out/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not send presence notifications to any users with the specified subscription type. Example: User blocks globally: <iq type='set' id='presout4'> <query xmlns='jabber:iq:privacy'> <list name='presout-global-example'> <item action='deny' order='23'> <presence-out/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not send presence notifications to any other users. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page63]79] Internet-Draft XMPP Instant MessagingJuneJuly 20038.129.12 Blocking IQs Server-side privacy lists enable a user to block incoming IQ requests of type "get" or "set" from other users based on the other user's JID, roster group, or subscription status (or globally). The following examples illustrate the protocol. Example: User blocks based on JID: <iq type='set' id='iq1'> <query xmlns='jabber:iq:privacy'> <list name='iq-jid-example'> <item type='jid'value='tybalt@capulet.com'value='tybalt@example.com' action='deny' order='29'> <iq/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive IQ requests of type "get" or "set" from the user with the specified JID. Example: User blocks based on roster group: <iq type='set' id='iq2'> <query xmlns='jabber:iq:privacy'> <list name='iq-group-example'> <item type='group' value='Enemies' action='deny' order='31'> <iq/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive IQ requests of type "get" or "set" from any users in the specified roster group. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page64]80] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Example: User blocks based on subscription type: <iq type='set' id='iq3'> <query xmlns='jabber:iq:privacy'> <list name='iq-sub-example'> <item type='subscription' value='none' action='deny' order='17'> <iq/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive IQ requests of type "get" or "set" from any users with the specified subscription type. Example: User blocks globally: <iq type='set' id='iq4'> <query xmlns='jabber:iq:privacy'> <list name='iq-global-example'> <item action='deny' order='1'> <iq/> </item> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive IQ requests of type "get" or "set" from any other users.8.139.13 Blocking All Communication Server-side privacy lists enable a user to block all communications from and presence to other users based on the other user's JID, roster group, or subscription status (or globally). The following examples illustrate the protocol. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page65]81] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Example: User blocks based on JID: <iq type='set' id='all1'> <query xmlns='jabber:iq:privacy'> <list name='all-jid-example'> <item type='jid'value='tybalt@capulet.com'value='tybalt@example.com' action='deny' order='23'/> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive any communications from, nor send any stanzas to, the user with the specified JID. Example: User blocks based on roster group: <iq type='set' id='all2'> <query xmlns='jabber:iq:privacy'> <list name='all-group-example'> <item type='group' value='Enemies' action='deny' order='13'/> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive any communications from, nor send any stanzas to, any users in the specified roster group. Example: User blocks based on subscription type: <iq type='set' id='all3'> <query xmlns='jabber:iq:privacy'> <list name='all-sub-example'> <item type='subscription' value='none' action='deny' order='11'/> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive any communications from, nor send any stanzas to, any users with the specified subscription type. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page66]82] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Example: User blocks globally: <iq type='set' id='all4'> <query xmlns='jabber:iq:privacy'> <list name='all-global-example'> <item action='deny' order='7'/> </list> </query> </iq> As a result of creating and applying the foregoing list, the user will not receive any communications from, nor send any stanzas to, any other users.8.149.14 Blocked Entity Attempts to Communicate with User If a blocked entity attempts to send messages or presence notifications to the user, the user's server SHOULD silently drop the stanza and MUST NOT return an error to the sending entity. If a blocked entity attempts to send an IQ stanza of type "get" or "set" to the user, the user's server MUST return to the sending entity a <feature-not-implemented/> stanza error, since this is the standard error code sent from a client that does not understand the namespace of an IQ get or set. IQ stanzas of other types SHOULD be silently dropped by the server. Example: Blocked entity attempts to send IQ get: <iq type='get'to='romeo@montague.net' from='tybalt@capulet.com/pda'to='romeo@example.net' from='tybalt@example.com/pda' id='probing1'> <query xmlns='jabber:iq:last'/> </iq> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page67]83] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Example: Server returns error to blocked entity: <iq type='error'from='romeo@montague.net' to='tybalt@capulet.com/pda'from='romeo@example.net' to='tybalt@example.com/pda' id='probing1'> <query xmlns='jabber:iq:last'/> <error type='cancel'> <feature-not-implemented xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'> </error> </iq>8.159.15 Higher-Level Heuristics When building a representation of a higher-level privacy heuristic, a client SHOULD use the simplest possible representation. For example, the heuristic "block all communications with any user not in my roster" could be constructed in any of the following ways: o accept communications from all JIDs in my roster (i.e., listing each JID as a separate list item), but deny communications with everyone else o accept communications from any user who is in one of the groups that make up my roster (i.e., listing each group as a separate list item), but deny communications from everyone else o accept communications from any user with whom I have a subscription of 'both' or 'to' or 'from' (i.e., listing each subscription value separately), but deny communications from everyone else o deny communications from anyone whose subscription state is 'none' The final representation is the simplest and SHOULD be used; here is the XML that would be sent in this case: <iq type='set' id='heuristic1'> <query xmlns='jabber:iq:privacy'> <list name='heuristic-example'> <item type='subscription' value='none' action='deny' order='437'/> </list> </query> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page68]84] Internet-Draft XMPP Instant MessagingJuneJuly 2003 </iq> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page69]85] Internet-Draft XMPP Instant MessagingJuneJuly 20039.10. Server Rules for Handling XML Stanzas Each server implementation will contain its own "delivery tree" for handling stanzas it receives. Such a tree determines whether a stanza needs to be routed to another domain, processed internally, or delivered to a connected resource associated with a registered user. The following rules apply:9.110.1 No 'to' Address If the stanza possesses no 'to' attribute, the server SHOULD process it on behalf of the entity that sent it. Because all stanzas received from other servers MUST possess a 'to' attribute, this rule applies only to stanzas received from an entity that is connected to the server (usually an active client session). If the server receives a presence stanza with no 'to' attribute, the server SHOULD broadcast it to the entities that are subscribed to the sending entity's presence as defined under Section 4.1. If the server receives an IQ stanza of type "get" or "set" with no 'to' attribute and it understands the namespace that qualifies the content of the stanza, it MUST process the stanza on behalf of sending entity (where the meaning of "process" is determined by the semantics of the qualifying namespace).9.210.2 Foreign Domain If the hostname of the domain identifier portion of the JID contained in the 'to' attribute does not match one of the configured hostnames of the server itself or a subdomain thereof, the server SHOULD route the stanza to the foreign domain (subject to local service provisioning and security policies regarding inter-domain communication). If routing to the recipient's server is unsuccessful, the sender's server MUST return an error to the sender; if the recipient's server can be contacted but delivery by the recipient's server to the recipient is unsuccessful, the recipient's server MUST return an error to the sender by way of the sender's server.9.310.3 Subdomain If the hostname of the domain identifier portion of the JID contained in the 'to' attribute matches a subdomain of one of the configured hostnames of the server itself, the server MAY process the stanza itself or MAY route the stanza to a specialized service that is responsible for that subdomain (if any).9.410.4 Bare Domain or Specific Resource If the hostname of the domain identifier portion of the JID contained Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page70]86] Internet-Draft XMPP Instant MessagingJuneJuly 2003 in the 'to' attribute matches the hostname of the server itself and the JID contained in the 'to' attribute is of the form<domain><somedomain> or<domain/resource>,<somedomain/resource>, the server (or a defined resource thereof) SHOULD process the stanza as appropriate for the stanza type. If the stanza is an IQ stanza and the server understands the namespace that qualifies the content of the stanza, the server SHOULD process the request according to the semantics of the qualifying namespace, and MUST reply with an IQ of type "result" or "error".9.510.5 User in Same Domain If the hostname of the domain identifier portion of the JID contained in the 'to' attribute matches the hostname of the server itself and the JID contained in the 'to' attribute is of the form<user@domain><user@somedomain> or<user@domain/resource>,<user@somedomain/resource>, the server SHOULD first apply any privacy rules (Section8)9) that are in force. If privacy rules allow the stanza, it SHOULD be routed or delivered to the intended recipient of the stanza as represented by the JID contained in the 'to' attribute. The following rules apply: 1. If the JID contains a resource identifier (i.e., is of the form<user@domain/resource>)<user@somedomain/resource>) and there is an available resource whose authzid matches the full JID, the recipient's server SHOULD deliver the stanza to the session that exactly matches the resource identifier. 2. If the JID contains a resource identifier and there is no available resource whose authzid matches the full JID, the recipient's server SHOULD return to the sender a <recipient-unavailable/> stanza error. 3. If the JID is of the form<user@domain><user@somedomain> and there is at least one available resource available for the user, the recipient's server MUST follow these rules: 1. For message stanzas, the server SHOULD deliver the stanza to the available resource that provided the highest value for the <priority/> element (if the resource did not provide a priority, the server SHOULD consider it to have provided a value of zero). If two resources have the same priority, the server MAY use some other rule (e.g., most recent connect time or activity time) to choose between them. However, the server MUST NOT deliver the stanza to an available resource that provided a negative value for the <priority/> element. 2. For presence stanzas other than those of type "probe", the server MUST deliver the stanza to all available resources, except that the server MUST NOT deliver the stanza to an Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page71]87] Internet-Draft XMPP Instant MessagingJuneJuly 2003 available resource that provided a negative value for the <priority/> element; for presence probes, the server SHOULD reply based on the rules defined in Section 4.1. 3. For IQ stanzas, the server SHOULD deliver the stanza to all available resources, except that the server MUST NOT deliver the stanza to an available resource that provided a negative value for the <priority/> element. 4. If the JID is of the form<user@domain><user@somedomain> and there are no available resources associated with the user (e.g., an instant messaging user is offline), how the stanza is handled depends on the stanza type: 1. For presence stanzas of type "subscribe", the server MUST maintain a record of the stanza, as specified under Section 4.1. 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. However, if offline message storage is not enabled, the server MUST return to the sender a <service-unavailable/> stanza error. (Note: offline message storage is not defined in XMPP since it strictly is a matter of implementation and service provisioning.) 4. For IQ stanzas, the server MUST reply with either an IQ result 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 (e.g., this is the case with the 'jabber:iq:last' protocol defined above); if not, the server MUST reply with a <service-unavailable/> stanza error. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page72]88] Internet-Draft XMPP Instant MessagingJuneJuly 200310.11. IANA Considerations For several related IANA considerations, refer to XMPP Core [1].10.111.1 XML Namespace Name for Session Data A URN sub-namespace for session-related data in the Extensible Messaging and Presence Protocol (XMPP) is defined as follows. URI: urn:ietf:params:xml:ns:xmpp-session Specification: [RFCXXXX] Description: This is the XML namespace name for session-related data in the Extensible Messaging and Presence Protocol (XMPP) as defined by [RFCXXXX]. Registrant Contact: IETF, XMPP Working Group, <xmppwg@jabber.org> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page73]89] Internet-Draft XMPP Instant MessagingJuneJuly 200311.12. Security Considerations For security considerations, refer to the relevant section of XMPP Core [1]. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page74]90] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Normative References [1] Saint-Andre, P. and J. Miller, "XMPP Core", draft-ietf-xmpp-core-15 (work in progress), June 2003. [2] Day, M., Aggarwal, S. and J. Vincent, "Instant Messaging / Presence Protocol Requirements", RFC 2779, February 2000. [3] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page75]91] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Informative References [4] Jabber Software Foundation, "Jabber Software Foundation", August 2001, <http://www.jabber.org/>. [5] Day, M., Rosenberg, J. and H. Sugano, "A Model for Presence and Instant Messaging", RFC 2778, February 2000, <http:// www.ietf.org/rfc/rfc2778.txt>. [6] Dawson, F. and T. Howes, "vCard MIME Directory Profile", RFC 2426, September 1998. Authors' Addresses Peter Saint-Andre Jabber Software Foundation EMail: stpeter@jabber.org Jeremie Miller Jabber Software Foundation EMail: jeremie@jabber.org Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page76]92] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Appendix A. vCards Sections 3.1.3 and 4.1.4 of RFC 2779 [2] require that it be possible to retrieve contact information for other users (e.g., telephone number or email address). An XML representation of the vCard specification defined in RFC 2426 [6] is in common use within the Jabber community to provide such information. Documentation of this protocol is maintained by the Jabber Software Foundation [4] at <http://www.jabber.org/protocol/> but is out of scope for this document. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page77]93] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Appendix B. XML Schemas The following XML schemas are descriptive, not normative. For schemas defining the core features of XMPP, refer to XMPP Core [1]. B.1 session <?xml version='1.0' encoding='UTF-8'?> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='urn:ietf:params:xml:ns:xmpp-session' xmlns='urn:ietf:params:xml:ns:xmpp-session' elementFormDefault='qualified'> <xs:element name='session' type='empty'/> <xs:simpleType name='empty'> <xs:restriction base='xs:string'> <xs:enumeration value=''/> </xs:restriction> </xs:simpleType> </xs:schema> B.2 jabber:iq:last <?xml version='1.0' encoding='UTF-8'?> <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='jabber:iq:last' xmlns='jabber:iq:last' elementFormDefault='qualified'> <xs:element name='query'> <xs:complexType> <xs:attribute name='seconds' type='xs:unsignedLong' use='optional'/> </xs:complexType> </xs:element> </xs:schema> B.3 jabber:iq:privacy <?xml version='1.0' encoding='UTF-8'?> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page78]94] Internet-Draft XMPP Instant MessagingJuneJuly 2003 <xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema' targetNamespace='jabber:iq:privacy' xmlns='jabber:iq:privacy' elementFormDefault='qualified'> <xs:element name='query'> <xs:complexType> <xs:sequence> <xs:element ref='active' minOccurs='0' maxOccurs='1'/> <xs:element ref='default' minOccurs='0' maxOccurs='1'/> <xs:element ref='list' minOccurs='0' maxOccurs='unbounded'/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name='active'> <xs:complexType> <xs:attribute name='name' type='xs:string' use='optional'/> </xs:complexType> </xs:element> <xs:element name='default'> <xs:complexType> <xs:attribute name='name' type='xs:string' use='optional'/> </xs:complexType> </xs:element> <xs:element name='list'> <xs:complexType> <xs:sequence> <xs:element ref='item' minOccurs='0' maxOccurs='unbounded'/> </xs:sequence> <xs:attribute name='name' type='xs:string' use='required'/> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page79]95] Internet-Draft XMPP Instant MessagingJuneJuly 2003 </xs:complexType> </xs:element> <xs:element name='item'> <xs:complexType> <xs:sequence> <xs:element ref='iq' minOccurs='0' maxOccurs='1'/> <xs:element ref='message' minOccurs='0' maxOccurs='1'/> <xs:element ref='presence-in' minOccurs='0' maxOccurs='1'/> <xs:element ref='presence-out' minOccurs='0' maxOccurs='1'/> </xs:sequence> <xs:attribute name='order'type='xs:nonNegativeInteger'type='xs:unsignedInt' use='required'/> <xs:attribute name='value' type='xs:string' use='optional'/> <xs:attribute name='action' use='required'> <xs:simpleType> <xs:restriction base='xs:NCName'> <xs:enumeration value='allow'/> <xs:enumeration value='deny'/> </xs:restriction> </xs:simpleType> </xs:attribute> <xs:attribute name='type' use='optional'> <xs:simpleType> <xs:restriction base='xs:NCName'> <xs:enumeration value='group'/> <xs:enumeration value='jid'/> <xs:enumeration value='subscription'/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:complexType> </xs:element> <xs:element name='iq' type='empty'/> <xs:element name='message' type='empty'/> <xs:element name='presence-in' type='empty'/> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page80]96] Internet-Draft XMPP Instant MessagingJuneJuly 2003 <xs:element name='presence-out' type='empty'/> <xs:simpleType name='empty'> <xs:restriction base='xs:string'> <xs:enumeration value=''/> </xs:restriction> </xs:simpleType> </xs:schema> B.4 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='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='to'/> <xs:enumeration value='from'/> <xs:enumeration value='both'/> <xs:enumeration value='none'/> <xs:enumeration value='remove'/> </xs:restriction> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page81]97] Internet-Draft XMPP Instant MessagingJuneJuly 2003 </xs:simpleType> </xs:attribute> <xs:attribute name='ask' use='optional'> <xs:simpleType> <xs:restriction base='xs:NCNAME'> <xs:enumeration value='subscribe'/> </xs:restriction> </xs:simpleType> </xs:attribute> </xs:complexType> </xs:element> <xs:element name='group' type='xs:string'/> </xs:schema> Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page82]98] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Appendix C. Revision History Note to RFC Editor: please remove this entire appendix, and the corresponding entries in the table of contents, prior to publication. C.1 Changes from draft-ietf-xmpp-im-14 o Added subscription state charts. o Fixed several typographical errors in the privacy rules examples. o Changed datatype of 'order' attribute in privacy rules from nonNegativeInteger to unsignedInt. C.2 Changes from draft-ietf-xmpp-im-13 o Made one small change to privacy list syntax rules.C.2C.3 Changes from draft-ietf-xmpp-im-12 o Clarified meaning of the default message type as well as handling of unknown or unsupported types. o Made several small editorial changes.C.3C.4 Changes from draft-ietf-xmpp-im-11 o Further clarified subscription syntax and semantics. o Further clarified presence responsibilities for clients and servers. o Added 'xml:lang' example to presence status. o Added subsection on presence priority. o Defined server handling of unsolicited presence stanzas of type "subscribed". o Specified default resource priority if not provided. o Corrected several errors in the schemas. o Added privacy list business rule regarding roster changes. Saint-Andre & Miller Expires January 26, 2004 [Page 99] Internet-Draft XMPP Instant Messaging July 2003 o Removed the 'jabber:iq:privacy:error' namespace (not necessary). o Documented message type='normal'. o Made numerous small editorial changes throughout.C.4C.5 Changes from draft-ietf-xmpp-im-10 o Clarified presence responsibilities for servers and clients.Saint-Andre & Miller Expires December 28, 2003 [Page 83] Internet-Draft XMPP Instant Messaging June 2003o Clarified the routing and delivery rules for servers. o Made the 'xml:lang' examples more complete. o Corrected several errors in the unsubscribe workflow. o Made small editorial changes in several sections.C.5C.6 Changes from draft-ietf-xmpp-im-09 o Clarified rules regarding allowable JID types in rosters. o Further clarified the semantics and routing implications of presence priorities. o Removed several obsolete subsections.C.6C.7 Changes from draft-ietf-xmpp-im-08 o Removed authorization content (now addressed in XMPP Core). o Added protocol for initiating an IM session, including schema and IANA registration template. o Corrected <*-condition/> elements to be <condition/>. o Made small editorial changes to address RFC Editor requirements.C.7C.8 Changes from draft-ietf-xmpp-im-07 o Added several error cases for resource authorization and updated relevant schema.C.8Saint-Andre & Miller Expires January 26, 2004 [Page 100] Internet-Draft XMPP Instant Messaging July 2003 C.9 Changes from draft-ietf-xmpp-im-06 o Specified that IQ result stanzas are required in response to roster pushes. o Changed stanza error namespace names to conform to the format defined in "The IETF XML Registry" as specified in XMPP Core. o Removed note to RFC Editor regarding provisional namespace names.Saint-Andre & Miller Expires December 28, 2003 [Page 84] Internet-Draft XMPP Instant Messaging June 2003 C.9C.10 Changes from draft-ietf-xmpp-im-05 o Removed use of ask='unsubscribe' per list discussion. o Clarified handling of resource conflict during authorization. o Added schemas for jabber:iq:auth, jabber:iq:auth:error, and jabber:iq:privacy:error. o Corrected several small protocol errors in the examples. o Clarified semantics of message types.C.10C.11 Changes from draft-ietf-xmpp-im-04 o Specified sending of unavailable presence after unsubscribe and subscription-cancellation actions. o Further specified syntax and business rules for privacy lists. o Brought error codes into line with definitions in draft-ietf-xmpp-core. o Added note to RFC Editor regarding provisional namespace names. o Removed vCard content and DTD, instead pointing to JSF documentation.C.11C.12 Changes from draft-ietf-xmpp-im-03 o Fixed order processing on privacy rules per list discussion. o Made numerous small editorial changes.C.12Saint-Andre & Miller Expires January 26, 2004 [Page 101] Internet-Draft XMPP Instant Messaging July 2003 C.13 Changes from draft-ietf-xmpp-im-02 o Added a great deal more detail to the narrative regarding server-side privacy rules as well as the interaction between rosters and subscriptions. o Removed DTDs in favor of schemas (with the exception of vCard XML). o Removed non-normative documentation of authentication using jabber:iq:auth and of in-band registration usingSaint-Andre & Miller Expires December 28, 2003 [Page 85] Internet-Draft XMPP Instant Messaging June 2003jabber:iq:register, since these are maintained by the Jabber Software Foundation and are not part of the XMPP specification.C.13C.14 Changes from draft-ietf-xmpp-im-01 o Made numerous small editorial changes.C.14C.15 Changes from draft-ietf-xmpp-im-00 o Moved registration and authentication via jabber:iq:auth to non-normative appendices. o Changed initial presence stanza from MUST be empty to SHOULD be empty. o Specified that user or clients should not send presence stanzas of type='probe'. o Specified the algorithm for digest passwords.C.15C.16 Changes from draft-miller-xmpp-im-02 o Added information about the 'jabber:iq:last' protocol to meet the requirement defined in section 3.2.4 of RFC 2779. o Added information about the 'jabber:iq:privacy' protocol to meet the requirement defined in section 2.3.5 of RFC 2779. o Added information about the vCard XML protocol to meet the requirement defined in sections 3.1.3 and 4.1.4 of RFC 2779. o Changed the material describing authentication (but not resource authorization) with 'jabber:iq:auth' to non-normative. Saint-Andre & Miller Expires January 26, 2004 [Page 102] Internet-Draft XMPP Instant Messaging July 2003 o Noted that the only watchers are subscribers. o Nomenclature changes: (1) from "chunks" to "stanzas"; (2) from "host" to "server"; (3) from "node" to "client" or "user" (as appropriate). Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page86]103] Internet-Draft XMPP Instant MessagingJuneJuly 2003 Intellectual Property Statement The IETF takes no position regarding the validity or scope of any intellectual property 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; neither does it represent that it has made any effort to identify any such rights. Information on the IETF's procedures with respect to rights in standards-track and standards-related documentation can be found in BCP-11. Copies of claims of rights made available for publication 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 implementors or users of this specification can be obtained from the IETF Secretariat. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights which may cover technology that may be required to practice this standard. Please address the information to the IETF Executive Director. Full Copyright Statement Copyright (C) The Internet Society (2003). All Rights Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assignees. This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page87]104] Internet-Draft XMPP Instant MessagingJuneJuly 2003 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Acknowledgement Funding for the RFC Editor function is currently provided by the Internet Society. Saint-Andre & Miller ExpiresDecember 28, 2003January 26, 2004 [Page88]105] ----