xmpp 之Jabber RFC3921 [草稿]

::-- run_mei [2005-07-05 10:11:22]

翻译者

run mei

shhgs

Network Working Group P. Saint-Andre, Ed. Request for Comments: 3921 Jabber Software Foundation Category: Standards Track October 2004

(XMPP): Instant Messaging and Presence

Extensible Messaging and Presence Protocol

Status of this Memo

  • This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited.

Copyright Notice

  • Copyright (C) The Internet Society (2004).

Abstract

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

Saint-Andre Standards Track [Page 1]

RFC 3921 XMPP IM October 2004

Table of Contents

  1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
  2. Syntax of XML Stanzas . . . . . . . . . . . . . . . . . . . . . . . 4
  3. Session Establishment . . . . . . . . . . . . . . . . . . . . . . . 10
  4. Exchanging Messages . . . . . . . . . . . . . . . . . . . .. . . . 13
  5. Exchanging Presence Information . . . . . . . . . . . . . . . 16
  6. Managing Subscriptions . . . . . . . . . . . . . . . . . . . . . . . 26
  7. Roster Management . . . . . . . . . . . . . . . . . . . . . . . . . 27
  8. Integration of Roster Items and Presence Subscriptions . . . 32
  9. Subscription States . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
  10. Blocking Communication . . . . . . . . . . . . . . . . . . . 62
  11. Server Rules for Handling XML Stanzas . . . . . . . . . . . 85
  12. IM and Presence Compliance Requirements . . . . . . . . . . 88
  13. Internationalization Considerations . . . . . . . . . . . . 89
  14. Security Considerations . . . . . . . . . . . . . . . . . . 89
  15. IANA Considerations . . . . . . . . . . . . . . . . . . . . 90
  16. References . . . . . . . . . . . . . . . . . . . . . . . . . 91
  17. vCards . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 B. XML Schemas. . . . . . . . . . . . . . . . . . . . . . . . . 93 C. Differences Between Jabber IM/Presence Protocols and XMPP. . 105 Contributors . . . . . . . . . . . . . . . . . . . . . . . . . . 106 Acknowledgements . . . . . . . . . . . . . . . . . . . . . . . . 106 Author's Address. . . . . . . . . . . . . . . . . . . . . . . . . 106 Full Copyright Statement. . . . . . . . . . . . . . . . . . . . . 107

1. Introduction

1.1. Overview

  • The Extensible Messaging and Presence Protocol (XMPP) is a protocol for streaming XML [XML] elements in order to exchange messages and presence information in close to real time. The core features of XMPP are defined in Extensible Messaging and Presence Protocol (XMPP): Core [XMPP-CORE]. These features -- mainly XML streams, use

    of TLS and SASL, 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 [XML-NAMES]. This memo describes extensions to and applications of the core features of XMPP that provide the basic functionality expected of an instant messaging (IM) and presence application as defined in RFC 2779 [IMP-REQS].

XMPP是一种将XML elements流化以达到近乎实时地传递消息(message)和在线信息(presence information)的协议。XMPP的核心功能在(XMPP): Core [XMPP-CORE]中定义。这些功能——主要包括XML的流化,TLS和SASL的使用,以及像<message/>,<presence/>以及<iq/>这样的流的子元素——提供给我们一些素材,使我们能创建很多"半实时(near-real-time)"的应用程序,而这些半实时的应用程序或许会位于应用程序的核心层之上,专门负责发送由程序专用的XML数据。这份memo讲述的是怎样扩展和使用XMPP的核心功能,而XMPP的核心协议仅涵盖了由RFC 2779 [IMP-REQS]定义的,基本的IM和presence application 所应该提供的功能。

Saint-Andre Standards Track [Page 2]

RFC 3921 XMPP IM October 2004

1.2. Requirements

  • For the purposes of this memo, the requirements of a basic instant messaging and presence application are defined by [IMP-REQS], which at a high level stipulates that a user must be able to complete the following use cases: 作为本文档的基础,基本的IM和"在线应用程序presence application"的要求 刊载在[IMP-REQS]里面。这份文档在大体上规定了用户必须能完成如下的功能。 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")
    • 管理通讯录里的资料(XMPP称之为roster)
    o Block communications to or from specific other users
    • 切断与他人的通讯
    Detailed definitions of these functionality areas are contained in [IMP-REQS], and the interested reader is directed to that document regarding the requirements addressed herein. 这些功能的详细定义刊载在[IMP-REQS]里,感兴趣的读者可以自己去看。 [IMP-REQS] also stipulates that presence services must be separable from instant messaging services; i.e., it must be possible to use the protocol to provide a presence service, an instant messaging service, or both. Although the text of this memo assumes that implementations and deployments will want to offer a unified instant messaging and presence service, there is no requirement that a service must offer both a presence service and an instant messaging service, and the protocol makes it possible to offer separate and distinct services for presence and for instant messaging. [IMP-REQS]同时还规定,在线信息的服务必须与及时信息的服务相分离。比方说, 协议必须允许你只使用在线信息,或及时信息服务,当然也可以两个都用。虽然 我们认为真正实现的时候,在线信息和及时信息服务肯定是合二为一的,但是它 也没有强求你一定必须同时提供在线信息合及时信息服务。这个协议完全允许你 提供单独的在线信息或及时信息服务。 Note: While XMPP-based instant messaging and presence meets the requirements of [IMP-REQS], it was not designed explicitly with that specification in mind, since the base protocol evolved through an open development process within the Jabber open-source community before RFC 2779 was written. Note also that although protocols addressing many other functionality areas have been defined in the Jabber community, such protocols are not included in this memo because they are not required by [IMP-REQS]. 注意:虽然基于XMPP的及时信息和在线服务符合[IMP-REQS]的要求,但它并 不是刻意去实现的,因为Jabber开源社区早在RFC 2779发布之前就已经促成了 基本的协议。同时还要指出的是,虽然Jabber社区还为协议设计了很多别的方面 的功能,但由于[IMP-REQS]并没有要求,因此我们这里也就不涉及了。

1.3. Terminology

  • This memo inherits the terminology defined in [XMPP-CORE]. 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 BCP 14, RFC 2119 [TERMS].

Saint-Andre Standards Track [Page 3]

RFC 3921 XMPP IM October 2004

2. Syntax of XML Stanzas

2.1. Message Syntax

2.1.1. Types of Message

Saint-Andre Standards Track [Page 4]

RFC 3921 XMPP IM October 2004

2.1.2. Child Elements

2.1.2.1. Subject

Saint-Andre Standards Track [Page 5]

RFC 3921 XMPP IM October 2004

2.1.2.2. Body

2.1.2.3. Thread

2.2. Presence Syntax

Saint-Andre Standards Track [Page 6]

RFC 3921 XMPP IM October 2004

2.2.1. Types of Presence

==== 2.2.2. Child Elements ====

Saint-Andre Standards Track [Page 7]

RFC 3921 XMPP IM October 2004

2.2.2.1. Show

2.2.2.2. Status

2.2.2.3. Priority

Saint-Andre Standards Track [Page 8]

RFC 3921 XMPP IM October 2004

2.3. IQ Syntax

2.4. Extended Namespaces

Saint-Andre Standards Track [Page 9]

RFC 3921 XMPP IM October 2004

3. Session Establishment

Saint-Andre Standards Track [Page 10]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 11]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 12]

RFC 3921 XMPP IM October 2004

4. Exchanging Messages

4.1. Specifying an Intended Recipient

Saint-Andre Standards Track [Page 13]

RFC 3921 XMPP IM October 2004

4.2. Specifying a Message Type

4.3. Specifying a Message Body

4.4. Specifying a Message Subject

Saint-Andre Standards Track [Page 14]

RFC 3921 XMPP IM October 2004

4.5. Specifying a Conversation Thread

Saint-Andre Standards Track [Page 15]

RFC 3921 XMPP IM October 2004

5. Exchanging Presence Information

5.1. Client and Server Presence Responsibilities

5.1.1. Initial Presence

Saint-Andre Standards Track [Page 16]

RFC 3921 XMPP IM October 2004

  1. Broadcast initial presence from the full JID (e.g.,
    • <[email protected]/resource>) of the user to all contacts that are subscribed to the user's presence information; such contacts are those for which a JID is present in the user's roster with the 'subscription' attribute set to a value of "from" or "both". (Note: The user's server MUST NOT broadcast initial presence to contacts to which the user is blocking outbound presence notifications, as described under Blocking Outbound Presence Notifications (Section 10.11).)

    In addition, the user's server MUST broadcast initial presence from the user's new available resource to any of the user's existing available resources (if any). Upon receiving initial presence from the user, the contact's server MUST deliver the user's presence stanza to the full JIDs

    (<[email protected]/resource>) associated with all of the contact's available resources, but only if the user is in the contact's roster with a subscription state of "to" or "both" and the contact has not blocked inbound presence notifications from the user's bare or full JID (as defined under Blocking Inbound Presence Notifications (Section 10.10)). If the user's server receives a presence stanza of type "error" in response to the initial presence that it sent to a contact on behalf of the user, it SHOULD NOT send further presence updates to that contact (until and unless it receives a presence stanza from the contact).

5.1.2. Presence Broadcast

Saint-Andre Standards Track [Page 17]

RFC 3921 XMPP IM October 2004

5.1.3. Presence Probes

Saint-Andre Standards Track [Page 18]

RFC 3921 XMPP IM October 2004

  1. Else, if the contact has at least one available resource, the
    • server MUST reply to the presence probe by sending to the user the full XML of the last presence stanza with no 'to' attribute received by the server from each of the contact's available resources (again, subject to privacy lists in force for each session).

5.1.4. Directed Presence

Saint-Andre Standards Track [Page 19]

RFC 3921 XMPP IM October 2004

5.1.5. Unavailable Presence

5.1.6. Presence Subscriptions

Saint-Andre Standards Track [Page 20]

RFC 3921 XMPP IM October 2004

5.2. Specifying Availability Status

5.3. Specifying Detailed Status Information

Saint-Andre Standards Track [Page 21]

RFC 3921 XMPP IM October 2004

5.4. Specifying Presence Priority

=== 5.5. Presence Examples ===

Saint-Andre Standards Track [Page 22]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 23]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 24]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 25]

RFC 3921 XMPP IM October 2004

6. Managing Subscriptions

6.1. Requesting a Subscription

Saint-Andre Standards Track [Page 26]

RFC 3921 XMPP IM October 2004

6.2. Handling a Subscription Request

6.3. Cancelling a Subscription from Another Entity

6.4. Unsubscribing from Another Entity's Presence

7. Roster Management

Saint-Andre Standards Track [Page 27]

RFC 3921 XMPP IM October 2004

7.1. Syntax and Semantics

Saint-Andre Standards Track [Page 28]

RFC 3921 XMPP IM October 2004

7.2. Business Rules

=== 7.3. Retrieving One's Roster on Login ===

Saint-Andre Standards Track [Page 29]

RFC 3921 XMPP IM October 2004

7.4. Adding a Roster Item

Saint-Andre Standards Track [Page 30]

RFC 3921 XMPP IM October 2004

7.5. Updating a Roster Item

Saint-Andre Standards Track [Page 31]

RFC 3921 XMPP IM October 2004

7.6. Deleting a Roster Item

8. Integration of Roster Items and Presence Subscriptions

8.1. Overview

Saint-Andre Standards Track [Page 32]

RFC 3921 XMPP IM October 2004

8.2. User Subscribes to Contact

Saint-Andre Standards Track [Page 33]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 34]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 35]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 36]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 37]

RFC 3921 XMPP IM October 2004

8.2.1. Alternate Flow: Contact Declines Subscription Request

Saint-Andre Standards Track [Page 38]

RFC 3921 XMPP IM October 2004

  1. If the contact wants to refuse 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 8.2):

    <presence to='[email protected]' 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 (<[email protected]>) of the contact:

    <presence

    Note: If the contact's server previously added the user to the contact's roster for tracking purposes, it MUST remove the relevant item at this time.
  3. Upon receiving the presence stanza of type "unsubscribed"
    • addressed to the user, the user's server (1) MUST deliver that presence stanza to the user and (2) MUST initiate a 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" and with no 'ask' attribute:

    <presence

    <iq type='set'>

    </iq>

  4. Upon receiving the presence stanza of type "unsubscribed", the
    • user SHOULD acknowledge receipt of that subscription state notification through either "affirming" it by sending a presence stanza of type "unsubscribe" to the contact or "denying" it by

Saint-Andre Standards Track [Page 39]

RFC 3921 XMPP IM October 2004

8.3. Creating a Mutual Subscription

Saint-Andre Standards Track [Page 40]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 41]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 42]

RFC 3921 XMPP IM October 2004

8.3.1. Alternate Flow: User Declines Subscription Request

Saint-Andre Standards Track [Page 43]

RFC 3921 XMPP IM October 2004

  1. As a result, the user's server MUST route the presence stanza of
    • type "unsubscribed" to the contact, first stamping the 'from'

      address as the bare JID (<[email protected]>) of the user:

    <presence

  2. Upon receiving the presence stanza of type "unsubscribed"
    • addressed to the contact, the contact's server (1) MUST deliver that presence stanza to the contact; and (2) 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 "from" and with no 'ask' attribute:

    <presence

    <iq type='set'>

    </iq>

  3. Upon receiving the presence stanza of type "unsubscribed", the
    • contact SHOULD acknowledge receipt of that subscription state notification through either "affirming" it by sending a presence stanza of type "unsubscribe" to the user or "denying" it by sending a presence stanza of type "subscribe" to the user; this step does not necessarily affect the subscription state (see Subscription States (Section 9) for details), but instead lets the contact's server know that it MUST no longer send notification of the subscription state change to the contact (see Section 9.4).
    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 the contact's roster with a subscription state of "from".

Saint-Andre Standards Track [Page 44]

RFC 3921 XMPP IM October 2004

8.4. Unsubscribing

8.4.1. Case #1: Unsubscribing When Subscription is Not Mutual

Saint-Andre Standards Track [Page 45]

RFC 3921 XMPP IM October 2004

  1. Upon receiving the presence stanza of type "unsubscribe"
    • addressed to the contact, 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 "none" (if the contact is unavailable or has not requested the roster, the contact's server MUST modify the roster item and send that modified item the next time the contact requests the roster); and (2) MUST deliver the "unsubscribe" state change notification to the contact:

    <iq type='set'>

    </iq>

    <presence

  2. Upon receiving the presence stanza of type "unsubscribe", the
    • contact SHOULD acknowledge receipt of that subscription state notification through either "affirming" 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 does not necessarily affect the subscription state (see Subscription States (Section 9) for details), but instead lets the contact's server know that it MUST no longer send notification of the subscription state change to the contact (see Section 9.4).
  3. The contact's server then (1) MUST send a presence stanza of type
    • "unsubscribed" to the user; and (2) SHOULD send unavailable presence from all of the contact's available resources to the user:

    <presence

Saint-Andre Standards Track [Page 46]

RFC 3921 XMPP IM October 2004

8.4.2. Case #2: Unsubscribing When Subscription is Mutual

Saint-Andre Standards Track [Page 47]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 48]

RFC 3921 XMPP IM October 2004

  1. The contact's server then (1) MUST send a presence stanza of type
    • "unsubscribed" to the user; and (2) SHOULD send unavailable presence from all of the contact's available resources to the user:

    <presence

    <presence

  2. When the user's server receives the presence stanzas of type
    • "unsubscribed" and "unavailable", it MUST deliver them to the user:

    <presence

    <presence

  3. Upon receiving the presence stanza of type "unsubscribed", the
    • user SHOULD acknowledge receipt of that subscription state notification through either "affirming" it by sending a presence stanza of type "unsubscribe" to the contact or "denying" it by sending a presence stanza of type "subscribe" to the contact; this step does not necessarily affect the subscription state (see Subscription States (Section 9) for details), but instead lets the user's server know that it MUST no longer send notification of the subscription state change to the user (see Section 9.4).
    Note: Obviously this does not result in removal of the roster item from the user's roster, and the contact still has a subscription to the user's presence information. In order to both completely cancel

Saint-Andre Standards Track [Page 49]

RFC 3921 XMPP IM October 2004

8.5. Cancelling a Subscription

8.5.1. Case #1: Cancelling When Subscription is Not Mutual

Saint-Andre Standards Track [Page 50]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 51]

RFC 3921 XMPP IM October 2004

8.5.2. Case #2: Cancelling When Subscription is Mutual

Saint-Andre Standards Track [Page 52]

RFC 3921 XMPP IM October 2004

  1. 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 unavailable or has not requested the roster, the user's server MUST modify the roster item and send that modified item the next time the user requests the roster); and (2) MUST deliver the "unsubscribed" state change notification to all of the user's available resources; and (3) MUST deliver the unavailable presence to all of the user's available resources:

    <iq type='set'>

    </iq>

    <presence

    <presence

  2. Upon receiving the presence stanza of type "unsubscribed", the
    • user SHOULD acknowledge receipt of that subscription state notification through either "affirming" it by sending a presence stanza of type "unsubscribe" to the contact or "denying" it by sending a presence stanza of type "subscribe" to the contact; this step does not necessarily affect the subscription state (see Subscription States (Section 9) for details), but instead lets the user's server know that it MUST no longer send notification of the subscription state change to the user (see Section 9.4).
    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 information. In order to both completely cancel a mutual subscription and fully remove the roster item from

Saint-Andre Standards Track [Page 53]

RFC 3921 XMPP IM October 2004

8.6. Removing a Roster Item and Cancelling All Subscriptions

Saint-Andre Standards Track [Page 54]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 55]

RFC 3921 XMPP IM October 2004

9. Subscription States

9.1. Defined States

Saint-Andre Standards Track [Page 56]

RFC 3921 XMPP IM October 2004

  1. "None" = contact and user are not subscribed to each other, and
    • neither has requested a subscription from the other
  2. "None + Pending Out" = contact and user are not subscribed to
    • each other, and user has sent contact a subscription request but contact has not replied yet
  3. "None + Pending In" = contact and user are not subscribed to each
    • other, and contact has sent user a subscription request but user has not replied yet (note: contact's server SHOULD NOT push or deliver roster items in this state, but instead SHOULD wait until contact has approved subscription request from user)
  4. "None + Pending Out/In" = contact and user are not subscribed to
    • each other, contact has sent user a subscription request but user has not replied yet, and user has sent contact a subscription request but contact has not replied yet
  5. "To" = user is subscribed to contact (one-way)
  6. "To + Pending In" = user is subscribed to contact, and contact
    • has sent user a subscription request but user has not replied yet
  7. "From" = contact is subscribed to user (one-way)
  8. "From + Pending Out" = contact is subscribed to user, and user
    • has sent contact a subscription request but contact has not replied yet
  9. "Both" = user and contact are subscribed to each other (two-way)

9.2. Server Handling of Outbound Presence Subscription Stanzas

Saint-Andre Standards Track [Page 57]

RFC 3921 XMPP IM October 2004

9.3. Server Handling of Inbound Presence Subscription Stanzas

Saint-Andre Standards Track [Page 58]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 59]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 60]

RFC 3921 XMPP IM October 2004

9.4. Server Delivery and Client Acknowledgement of Subscription Requests and State Change Notifications

Saint-Andre Standards Track [Page 61]

RFC 3921 XMPP IM October 2004

10. Blocking Communication

Saint-Andre Standards Track [Page 62]

RFC 3921 XMPP IM October 2004

10.1. Syntax and Semantics

Saint-Andre Standards Track [Page 63]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 64]

RFC 3921 XMPP IM October 2004

10.2. Business Rules

  1. If there is an active list set for a session, it affects only the
    • session(s) for which it is activated, and only for the duration of the session(s); the server MUST apply the active list only and MUST NOT apply the default list (i.e., there is no "layering" of lists).
  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 in accordance with the Server Rules for Handling XML Stanzas (Section 11).
  4. Privacy lists MUST be the first delivery rule applied by a
    • server, superseding (1) the routing and delivery rules specified in Server Rules for Handling XML Stanzas (Section 11), and (2) the handling of subscription-related presence stanzas (and corresponding generation of roster pushes) specified in Integration of Roster Items and Presence Subscriptions (Section 8).
  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 integer values of the 'order' attribute for

      each <item/>.

Saint-Andre Standards Track [Page 65]

RFC 3921 XMPP IM October 2004

  1. As soon as a stanza is matched against a privacy list rule, the
    • server MUST appropriately handle the stanza in accordance with the rule and cease processing.
  2. If no fall-through item is provided in a list, the fall-through
    • action is assumed to be "allow".
  3. If a user updates the definition for an active list, subsequent
    • processing based on that active list MUST use the updated definition (for all resources to which that active list currently applies).
  4. If a change to the subscription state or roster group of a roster
    • item defined in an active or default list occurs during a user's session, subsequent processing based on that list MUST take into account the changed state or group (for all resources to which that list currently applies).
  5. When the definition for a rule is modified, the server MUST send
    • an IQ stanza of type "set" to all connected resources, containing

      a <query/> element with only one <list/> child element, where the 'name' attribute is set to the name of the modified privacy list. These "privacy list pushes" adhere to the same semantics as the "roster pushes" used in roster management, except that only the list name itself (not the full list definition or the "delta") is pushed to the connected resources. It is up to the receiving resource to determine whether to retrieve the modified list definition, although a connected resource SHOULD do so if the list currently applies to it.

  6. When a resource attempts to remove a list or specify a new
    • default list while that list applies to a connected resource other than the sending resource, the server MUST return a

      <conflict/> error to the sending resource and MUST NOT make the requested change.

10.3. Retrieving One's Privacy Lists

Saint-Andre Standards Track [Page 66]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 67]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 68]

RFC 3921 XMPP IM October 2004

10.4. Managing Active Lists

Saint-Andre Standards Track [Page 69]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 70]

RFC 3921 XMPP IM October 2004

10.5. Managing the Default List

Saint-Andre Standards Track [Page 71]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 72]

RFC 3921 XMPP IM October 2004

10.6. Editing a Privacy List

Saint-Andre Standards Track [Page 73]

RFC 3921 XMPP IM October 2004

10.7. Adding a New Privacy List

10.8. Removing a Privacy List

Saint-Andre Standards Track [Page 74]

RFC 3921 XMPP IM October 2004

10.9. Blocking Messages

Saint-Andre Standards Track [Page 75]

RFC 3921 XMPP IM October 2004

10.10. Blocking Inbound Presence Notifications

Saint-Andre Standards Track [Page 76]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 77]

RFC 3921 XMPP IM October 2004

10.11. Blocking Outbound Presence Notifications

Saint-Andre Standards Track [Page 78]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 79]

RFC 3921 XMPP IM October 2004

10.12. Blocking IQ Stanzas

Saint-Andre Standards Track [Page 80]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 81]

RFC 3921 XMPP IM October 2004

10.13. Blocking All Communication

Saint-Andre Standards Track [Page 82]

RFC 3921 XMPP IM October 2004

10.14. Blocked Entity Attempts to Communicate with User

Saint-Andre Standards Track [Page 83]

RFC 3921 XMPP IM October 2004

10.15. Higher-Level Heuristics

Saint-Andre Standards Track [Page 84]

RFC 3921 XMPP IM October 2004

11. Server Rules for Handling XML Stanzas

11.1. Inbound Stanzas

Saint-Andre Standards Track [Page 85]

RFC 3921 XMPP IM October 2004

  1. Else if the JID is of the form <user@domain> and there is at

    • least one available resource available for the user, the recipient's server MUST follow these rules:
    • For message stanzas, the server SHOULD deliver the stanza to
      • the highest-priority available resource (if the resource did

        not provide a value for the <priority/> element, the server SHOULD consider it to have provided a value of zero). If two or more available resources have the same priority, the server MAY use some other rule (e.g., most recent connect time, most recent activity time, or highest availability as determined by some hierarchy of <show/> values) to choose between them or MAY deliver the message to all such resources. However, the server MUST NOT deliver the stanza to an available resource with a negative priority; if the only available resource has a negative priority, the server SHOULD handle the message as if there were no available resources (defined below). In addition, the server MUST NOT rewrite the 'to' attribute (i.e., it MUST leave it as <user@domain> rather than change it to <user@domain/ resource>).

    • For presence stanzas other than those of type "probe", the
      • server MUST deliver the stanza to all available resources; for presence probes, the server SHOULD reply based on the rules defined in Presence Probes (Section 5.1.3). In addition, the server MUST NOT rewrite the 'to' attribute

        (i.e., it MUST leave it as <user@domain> rather than change it to <user@domain/resource>).

    • For IQ stanzas, the server itself MUST reply on behalf of the
      • user with either an IQ result or an IQ error, and MUST NOT deliver the IQ stanza to any of the available resources. Specifically, if the semantics of the qualifying namespace define a reply that the server can provide, the server MUST reply to the stanza on behalf of the user; if not, the server

        MUST reply with a <service-unavailable/> stanza error.

  2. Else if the JID is of the form <user@domain> and there are no

    • available resources associated with the user, how the stanza is handled depends on the stanza type:

Saint-Andre Standards Track [Page 86]

RFC 3921 XMPP IM October 2004

  1. For presence stanzas of type "subscribe", "subscribed",
    • "unsubscribe", and "unsubscribed", the server MUST maintain a record of the stanza and deliver the stanza at least once (i.e., when the user next creates an available resource); in addition, the server MUST continue to deliver presence stanzas of type "subscribe" until the user either approves or denies the subscription request (see also Presence Subscriptions (Section 5.1.6)).
  2. For all other presence stanzas, the server SHOULD silently
    • ignore the stanza by not storing it for later delivery or replying to it on behalf of the user.
  3. For message stanzas, the server MAY choose to store the
    • stanza on behalf of the user and deliver it when the user next becomes available, or forward the message to the user via some other means (e.g., to the user's email account). However, if offline message storage or message forwarding is not enabled, the server MUST return to the sender a

      <service-unavailable/> stanza error. (Note: Offline message storage and message forwarding are not defined in XMPP, since they are strictly a matter of implementation and service provisioning.)

  4. For IQ stanzas, the server itself MUST reply on behalf of the
    • user with either an IQ result or an IQ error. Specifically, if the semantics of the qualifying namespace define a reply that the server can provide, the server MUST reply to the stanza on behalf of the user; if not, the server MUST reply

      with a <service-unavailable/> stanza error.

11.2. Outbound Stanzas

Saint-Andre Standards Track [Page 87]

RFC 3921 XMPP IM October 2004

  1. First attempt to resolve the foreign hostname using an [SRV]
    • Service of "xmpp-server" and Proto of "tcp", resulting in resource records such as "_xmpp-server._tcp.example.com.", as specified in [XMPP-CORE].
  2. If the "xmpp-server" address record resolution fails, attempt to
    • resolve the "_im" or "_pres" [SRV] Service as specified in

      [IMP-SRV], using the "_im" Service for <message/> stanzas and the "_pres" Service for <presence/> stanzas (it is up to the implementation how to handle <iq/> stanzas). This will result in one or more resolutions of the form "_im.<proto>.example.com." or "_pres.<proto>.example.com.", where "<proto>" would be a label registered in the Instant Messaging SRV Protocol Label registry or the Presence SRV Protocol Label registry: either "_xmpp" for an XMPP-aware domain or some other IANA-registered label (e.g., "_simple") for a non-XMPP-aware domain.

  3. If both SRV address record resolutions fail, attempt to perform a
    • normal IPv4/IPv6 address record resolution to determine the IP address using the "xmpp-server" port of 5269 registered with the IANA, as specified in [XMPP-CORE].
    Administrators of server deployments are strongly encouraged to keep the _im._xmpp, _pres._xmpp, and _xmpp._tcp SRV records properly synchronized, since different implementations might perform the "_im" and "_pres" lookups before the "xmpp-server" lookup.

12. IM and Presence Compliance Requirements

12.1. Servers

Saint-Andre Standards Track [Page 88]

RFC 3921 XMPP IM October 2004

12.2. Clients

13. Internationalization Considerations

14. Security Considerations

Saint-Andre Standards Track [Page 89]

RFC 3921 XMPP IM October 2004

15. IANA Considerations

15.1. XML Namespace Name for Session Data

Saint-Andre Standards Track [Page 90]

RFC 3921 XMPP IM October 2004

15.2. Instant Messaging SRV Protocol Label Registration

15.3. Presence SRV Protocol Label Registration

16. References

16.1. Normative References

Saint-Andre Standards Track [Page 91]

RFC 3921 XMPP IM October 2004

16.2. Informative References

Saint-Andre Standards Track [Page 92]

RFC 3921 XMPP IM October 2004

Appendix A. vCards

Appendix B. XML Schemas

B.1 jabber:client

Saint-Andre Standards Track [Page 93]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 94]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 95]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 96]

RFC 3921 XMPP IM October 2004

B.2 jabber:server

Saint-Andre Standards Track [Page 97]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 98]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 99]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 100]

RFC 3921 XMPP IM October 2004

B.3 session

B.4 jabber:iq:privacy

Saint-Andre Standards Track [Page 101]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 102]

RFC 3921 XMPP IM October 2004

Saint-Andre Standards Track [Page 103]

RFC 3921 XMPP IM October 2004

B.5 jabber:iq:roster

Saint-Andre Standards Track [Page 104]

RFC 3921 XMPP IM October 2004

Appendix C. Differences Between Jabber IM/Presence Protocols and XMPP

C.1 Session Establishment

Saint-Andre Standards Track [Page 105]

RFC 3921 XMPP IM October 2004

C.2 Privacy Lists

Contributors

Acknowledgements

Author's Address

Saint-Andre Standards Track [Page 106]

RFC 3921 XMPP IM October 2004

Intellectual Property

Acknowledgement

Saint-Andre Standards Track [Page 107]

RFC_3921 (last edited 2009-12-25 07:14:07 by localhost)