3 XMPP Working Group P. Saint-Andre (ed.)
4 Internet-Draft Jabber Software Foundation
5 Expires: September 19, 2004 March 21, 2004
8 Extensible Messaging and Presence Protocol (XMPP): Instant Messaging
14 This document is an Internet-Draft and is in full conformance with
15 all provisions of Section 10 of RFC2026.
17 Internet-Drafts are working documents of the Internet Engineering
18 Task Force (IETF), its areas, and its working groups. Note that other
19 groups may also distribute working documents as Internet-Drafts.
21 Internet-Drafts are draft documents valid for a maximum of six months
22 and may be updated, replaced, or obsoleted by other documents at any
23 time. It is inappropriate to use Internet-Drafts as reference
24 material or to cite them other than as "work in progress."
26 The list of current Internet-Drafts can be accessed at http://
27 www.ietf.org/ietf/1id-abstracts.txt.
29 The list of Internet-Draft Shadow Directories can be accessed at
30 http://www.ietf.org/shadow.html.
32 This Internet-Draft will expire on September 19, 2004.
36 Copyright (C) The Internet Society (2004). All Rights Reserved.
40 This memo describes extensions to and applications of the core
41 features of the Extensible Messaging and Presence Protocol (XMPP)
42 that provide the basic instant messaging (IM) and presence
43 functionality defined in RFC 2779.
55 Saint-Andre (ed.) Expires September 19, 2004 [Page 1]
57 Internet-Draft XMPP IM March 2004
62 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3
63 2. Syntax of XML Stanzas . . . . . . . . . . . . . . . . . . . 4
64 3. Session Establishment . . . . . . . . . . . . . . . . . . . 11
65 4. Exchanging Messages . . . . . . . . . . . . . . . . . . . . 14
66 5. Exchanging Presence Information . . . . . . . . . . . . . . 16
67 6. Managing Subscriptions . . . . . . . . . . . . . . . . . . . 26
68 7. Roster Management . . . . . . . . . . . . . . . . . . . . . 28
69 8. Integration of Roster Items and Presence Subscriptions . . . 32
70 9. Subscription States . . . . . . . . . . . . . . . . . . . . 56
71 10. Blocking Communication . . . . . . . . . . . . . . . . . . . 62
72 11. Server Rules for Handling XML Stanzas . . . . . . . . . . . 84
73 12. IM and Presence Compliance Requirements . . . . . . . . . . 87
74 13. Internationalization Considerations . . . . . . . . . . . . 88
75 14. Security Considerations . . . . . . . . . . . . . . . . . . 88
76 15. IANA Considerations . . . . . . . . . . . . . . . . . . . . 89
77 Normative References . . . . . . . . . . . . . . . . . . . . 90
78 Informative References . . . . . . . . . . . . . . . . . . . 91
79 Author's Address . . . . . . . . . . . . . . . . . . . . . . 91
80 A. vCards . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
81 B. XML Schemas . . . . . . . . . . . . . . . . . . . . . . . . 92
82 C. Differences Between Jabber IM/Presence Protocols and XMPP . 104
83 Intellectual Property and Copyright Statements . . . . . . . 105
111 Saint-Andre (ed.) Expires September 19, 2004 [Page 2]
113 Internet-Draft XMPP IM March 2004
120 The Extensible Messaging and Presence Protocol (XMPP) is a protocol
121 for streaming XML [XML] elements in order to exchange messages and
122 presence information in close to real time. The core features of
123 XMPP are defined in Extensible Messaging and Presence Protocol
124 (XMPP): Core [XMPP-CORE]. These features -- mainly XML streams, use
125 of TLS and SASL, and the <message/>, <presence/>, and <iq/> children
126 of the stream root -- provide the building blocks for many types of
127 near-real-time applications, which may be layered on top of the core
128 by sending application-specific data qualified by particular XML
129 namespaces [XML-NAMES]. This memo describes extensions to and
130 applications of the core features of XMPP that provide the basic
131 functionality expected of an instant messaging (IM) and presence
132 application as defined in RFC 2779 [IMP-REQS].
136 For the purposes of this memo, the requirements of a basic instant
137 messaging and presence application are defined by [IMP-REQS], which
138 at a high level stipulates that a user must be able to complete the
141 o Exchange messages with other users
143 o Exchange presence information with other users
145 o Manage subscriptions to and from other users
147 o Manage items in a contact list (in XMPP this is called a "roster")
149 o Block communications to or from specific other users
151 Detailed definitions of these functionality areas are contained in
152 [IMP-REQS], and the interested reader is directed to that document
153 regarding the requirements addressed herein.
155 [IMP-REQS] also stipulates that presence services must be separable
156 from instant messaging services; i.e., it must be possible to use the
157 protocol to provide a presence service, an instant messaging service,
158 or both. Although the text of this memo assumes that implementations
159 and deployments will want to offer a unified instant messaging and
160 presence service, there is no requirement that a service must offer
161 both a presence service and an instant messaging service, and the
162 protocol makes it possible to offer separate and distinct services
163 for presence and for instant messaging.
167 Saint-Andre (ed.) Expires September 19, 2004 [Page 3]
169 Internet-Draft XMPP IM March 2004
172 Note: While XMPP-based instant messaging and presence meets the
173 requirements of [IMP-REQS], it was not designed explicitly with that
174 specification in mind, since the base protocol evolved through an
175 open development process within the Jabber open-source community
176 before RFC 2779 was written. Note also that although protocols
177 addressing many other functionality areas have been defined in the
178 Jabber community, such protocols are not included in this memo
179 because they are not required by [IMP-REQS].
183 This memo inherits the terminology defined in [XMPP-CORE].
185 The capitalized key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
186 "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and
187 "OPTIONAL" in this document are to be interpreted as described in RFC
192 Most of the core aspects of the Extensible Messaging and Presence
193 Protocol were developed originally within the Jabber open-source
194 community in 1999. This community was founded by Jeremie Miller, who
195 released source code for the initial version of the jabberd server in
196 January 1999. Major early contributors to the base protocol also
197 included Ryan Eatmon, Peter Millard, Thomas Muldowney, and Dave
198 Smith. Work specific to instant messaging and presence by the XMPP
199 Working Group has concentrated especially on IM session establishment
200 and communication blocking (privacy lists); the session establishment
201 protocol was mainly developed by Rob Norris and Joe Hildebrand, and
202 the privacy lists protocol was originally contributed by Peter
207 Thanks are due to a number of individuals in addition to the
208 contributors listed. Although it is difficult to provide a complete
209 list, the following individuals were particularly helpful in defining
210 the protocols or in commenting on the specifications in this memo:
211 Thomas Charron, Richard Dobson, Schuyler Heath, Jonathan Hogg, Craig
212 Kaes, Jacek Konieczny, Lisa Dusseault, Alexey Melnikov, Keith
213 Minkler, Julian Missig, Pete Resnick, Marshall Rose, Jean-Louis
214 Seguineau, Alexey Shchepin, Iain Shigeoka, and David Waite. Thanks
215 also to members of the XMPP Working Group and the IETF community for
216 comments and feedback provided throughout the life of this memo.
218 2. Syntax of XML Stanzas
223 Saint-Andre (ed.) Expires September 19, 2004 [Page 4]
225 Internet-Draft XMPP IM March 2004
228 The basic semantics and common attributes of XML stanzas qualified by
229 the 'jabber:client' and 'jabber:server' namespaces are defined in
230 [XMPP-CORE]. However, these namespaces also define various child
231 elements, as well as values for the common 'type' attribute, that are
232 specific to instant messaging and presence applications. Thus,
233 before addressing particular "use cases" for such applications, we
234 here further describe the syntax of XML stanzas, thereby
235 supplementing the discussion in [XMPP-CORE].
239 Message stanzas qualified by the 'jabber:client' or 'jabber:server'
240 namespace are used to "push" information to another entity. Common
241 uses in instant messaging applications include single messages,
242 messages sent in the context of a chat conversation, messages sent in
243 the context of a multi-user chat room, headlines and other alerts,
246 2.1.1 Types of Message
248 The 'type' attribute of a message stanza is RECOMMENDED; if included,
249 it specifies the conversational context of the message, thus
250 providing a hint regarding presentation (e.g., in a GUI). If
251 included, the 'type' attribute MUST have one of the following values:
253 o chat -- The message is sent in the context of a one-to-one chat
254 conversation. A compliant client SHOULD present the message in an
255 interface enabling one-to-one chat between the two parties,
256 including an appropriate conversation history.
258 o error -- An error has occurred related to a previous message sent
259 by the sender (for details regarding stanza error syntax, refer to
260 [XMPP-CORE]). A compliant client SHOULD present an appropriate
261 interface informing the sender of the nature of the error.
263 o groupchat -- The message is sent in the context of a multi-user
264 chat environment (similar to that of [IRC]). A compliant client
265 SHOULD present the message in an interface enabling many-to-many
266 chat between the parties, including a roster of parties in the
267 chatroom and an appropriate conversation history. Full definition
268 of XMPP-based groupchat protocols is out of scope for this memo.
270 o headline -- The message is probably generated by an automated
271 service that delivers or broadcasts content (news, sports, market
272 information, RSS feeds, etc.). No reply to the message is
273 expected, and a compliant client SHOULD present the message in an
274 interface that appropriately differentiates the message from
275 standalone messages, chat sessions, or groupchat sessions (e.g.,
279 Saint-Andre (ed.) Expires September 19, 2004 [Page 5]
281 Internet-Draft XMPP IM March 2004
284 by not providing the recipient with the ability to reply).
286 o normal -- The message is a single message that is sent outside the
287 context of a one-to-one conversation or groupchat, and to which it
288 is expected that the recipient will reply. A compliant client
289 SHOULD present the message in an interface enabling the recipient
290 to reply, but without a conversation history.
292 An IM application SHOULD support all of the foregoing message types;
293 if an application receives a message with no 'type' attribute or the
294 application does not understand the value of the 'type' attribute
295 provided, it MUST consider the message to be of type "normal" (i.e.,
296 "normal" is the default). The "error" type MUST be generated only in
297 response to an error related to a message received from another
300 Although the 'type' attribute is OPTIONAL, it is considered polite to
301 mirror the type in any replies to a message; furthermore, some
302 specialized applications (e.g., a multi-user chat service) MAY at
303 their discretion enforce the use of a particular message type (e.g.,
308 As described under extended namespaces (Section 2.4), a message
309 stanza MAY contain any properly-namespaced child element.
311 In accordance with the default namespace declaration, by default a
312 message stanza is qualified by the 'jabber:client' or 'jabber:server'
313 namespace, which defines certain allowable children of message
314 stanzas. If the message stanza is of type "error", it MUST include
315 an <error/> child; for details, see [XMPP-CORE]. Otherwise, the
316 message stanza MAY contain any of the following child elements
317 without an explicit namespace declaration:
328 The <subject/> element contains human-readable XML character data
329 that specifies the topic of the message. The <subject/> element MUST
330 NOT possess any attributes, with the exception of the 'xml:lang'
331 attribute. Multiple instances of the <subject/> element MAY be
335 Saint-Andre (ed.) Expires September 19, 2004 [Page 6]
337 Internet-Draft XMPP IM March 2004
340 included for the purpose of providing alternate versions of the same
341 subject, but only if each instance possesses an 'xml:lang' attribute
342 with a distinct language value. The <subject/> element MUST NOT
343 contain mixed content (as defined in Section 3.2.2 of [XML]).
347 The <body/> element contains human-readable XML character data that
348 specifies the textual contents of the message; this child element is
349 normally included but is OPTIONAL. The <body/> element MUST NOT
350 possess any attributes, with the exception of the 'xml:lang'
351 attribute. Multiple instances of the <body/> element MAY be included
352 but only if each instance possesses an 'xml:lang' attribute with a
353 distinct language value. The <body/> element MUST NOT contain mixed
354 content (as defined in Section 3.2.2 of [XML]).
358 The <thread/> element contains non-human-readable XML character data
359 specifying an identifier that is used for tracking a conversation
360 thread (sometimes referred to as an "instant messaging session")
361 between two entities. The value of the <thread/> element is
362 generated by the sender and SHOULD be copied back in any replies. If
363 used, it MUST be unique to that conversation thread within the stream
364 and MUST be consistent throughout that conversation (a client that
365 receives a message from the same full JID but with a different thread
366 ID MUST assume that the message in question exists outside the
367 context of the existing conversation thread). The use of the
368 <thread/> element is OPTIONAL and is not used to identify individual
369 messages, only conversations. A message stanza MUST NOT contain more
370 than one <thread/> element. The <thread/> element MUST NOT possess
371 any attributes. The value of the <thread/> element MUST be treated
372 as opaque by entities; no semantic meaning may be derived from it,
373 and only exact comparisons may be made against it. The <thread/>
374 element MUST NOT contain mixed content (as defined in Section 3.2.2
379 Presence stanzas are used qualified by the 'jabber:client' or
380 'jabber:server' namespace to express an entity's current network
381 availability (offline or online, along with various sub-states of the
382 latter and optional user-defined descriptive text), and to notify
383 other entities of that availability. Presence stanzas are also used
384 to negotiate and manage subscriptions to the presence of other
391 Saint-Andre (ed.) Expires September 19, 2004 [Page 7]
393 Internet-Draft XMPP IM March 2004
396 2.2.1 Types of Presence
398 The 'type' attribute of a presence stanza is OPTIONAL. A presence
399 stanza that does not possess a 'type' attribute is used to signal to
400 the server that the sender is online and available for communication.
401 If included, the 'type' attribute specifies a lack of availability, a
402 request to manage a subscription to another entity's presence, a
403 request for another entity's current presence, or an error related to
404 a previously-sent presence stanza. If included, the 'type' attribute
405 MUST have one of the following values:
407 o unavailable -- Signals that the entity is no longer available for
410 o subscribe -- The sender wishes to subscribe to the recipient's
413 o subscribed -- The sender has allowed the recipient to receive
416 o unsubscribe -- The sender is unsubscribing from another entity's
419 o unsubscribed -- The subscription request has been denied or a
420 previously-granted subscription has been cancelled.
422 o probe -- A request for an entity's current presence; SHOULD be
423 generated only by a server on behalf of a user.
425 o error -- An error has occurred regarding processing or delivery of
426 a previously-sent presence stanza.
428 For detailed information regarding presence semantics and the
429 subscription model used in the context of XMPP-based instant
430 messaging and presence applications, refer to Exchanging Presence
431 Information (Section 5) and Managing Subscriptions (Section 6).
435 As described under extended namespaces (Section 2.4), a presence
436 stanza MAY contain any properly-namespaced child element.
438 In accordance with the default namespace declaration, by default a
439 presence stanza is qualified by the 'jabber:client' or
440 'jabber:server' namespace, which defines certain allowable children
441 of presence stanzas. If the presence stanza is of type "error", it
442 MUST include an <error/> child; for details, see [XMPP-CORE]. If the
443 presence stanza possesses no 'type' attribute, it MAY contain any of
447 Saint-Andre (ed.) Expires September 19, 2004 [Page 8]
449 Internet-Draft XMPP IM March 2004
452 the following child elements (note that the <status/> child MAY be
453 sent in a presence stanza of type "unavailable" or, for historical
454 reasons, "subscribe"):
465 The OPTIONAL <show/> element contains non-human-readable XML
466 character data that specifies the particular availability status of
467 an entity or specific resource. A presence stanza MUST NOT contain
468 more than one <show/> element. The <show/> element MUST NOT possess
469 any attributes. If provided, the XML character data value MUST be
470 one of the following (additional availability types could be defined
471 through a properly-namespaced child element of the presence stanza):
473 o away -- The entity or resource is temporarily away.
475 o chat -- The entity or resource is actively interested in chatting.
477 o dnd -- The entity or resource is busy (dnd = "Do Not Disturb").
479 o xa -- The entity or resource is away for an extended period (xa =
482 If no <show/> element is provided, the entity is assumed to be online
487 The OPTIONAL <status/> element contains XML character data specifying
488 a natural-language description of availability status. It is
489 normally used in conjunction with the show element to provide a
490 detailed description of an availability state (e.g., "In a meeting").
491 The <status/> element MUST NOT possess any attributes, with the
492 exception of the 'xml:lang' attribute. Multiple instances of the
493 <status/> element MAY be included but only if each instance possesses
494 an 'xml:lang' attribute with a distinct language value.
498 The OPTIONAL <priority/> element contains non-human-readable XML
499 character data that specifies the priority level of the resource.
503 Saint-Andre (ed.) Expires September 19, 2004 [Page 9]
505 Internet-Draft XMPP IM March 2004
508 The value MUST be an integer between -128 and +127. A presence
509 stanza MUST NOT contain more than one <priority/> element. The
510 <priority/> element MUST NOT possess any attributes. If no priority
511 is provided, a server SHOULD consider the priority to be zero. For
512 information regarding the semantics of priority values in stanza
513 routing within instant messaging and presence applications, refer to
514 Server Rules for Handling XML Stanzas (Section 11).
518 IQ stanzas provide a structured request-response mechanism. The
519 basic semantics of that mechanism (e.g., that the 'id' attribute is
520 REQUIRED) are defined in [XMPP-CORE], whereas the specific semantics
521 required to complete particular use cases are defined in all cases by
522 an extended namespace (Section 2.4) (note that the 'jabber:client'
523 and 'jabber:server' namespaces do not define any children of IQ
524 stanzas other than the common <error/>). This memo defines two such
525 extended namespaces, one for Roster Management (Section 7) and the
526 other for Blocking Communication (Section 10); however, an IQ stanza
527 MAY contain structured information qualified by any extended
530 2.4 Extended Namespaces
532 While the three XML stanza kinds defined in the "jabber:client" or
533 "jabber:server" namespace (along with their attributes and child
534 elements) provide a basic level of functionality for messaging and
535 presence, XMPP uses XML namespaces to extend the stanzas for the
536 purpose of providing additional functionality. Thus a message or
537 presence stanza MAY contain one or more optional child elements
538 specifying content that extends the meaning of the message (e.g., an
539 XHTML-formatted version of the message body), and an IQ stanza MAY
540 contain one such child element. This child element MAY have any name
541 and MUST possess an 'xmlns' namespace declaration (other than
542 "jabber:client", "jabber:server", or "http://etherx.jabber.org/
543 streams") that defines all data contained within the child element.
545 Support for any given extended namespace is OPTIONAL on the part of
546 any implementation (aside from the extended namespaces defined
547 herein). If an entity does not understand such a namespace, the
548 entity's expected behavior depends on whether the entity is (1) the
549 recipient or (2) an entity that is routing the stanza to the
552 Recipient: If a recipient receives a stanza that contains a child
553 element it does not understand, it SHOULD ignore that specific XML
554 data, i.e., it SHOULD not process it or present it to a user or
555 associated application (if any). In particular:
559 Saint-Andre (ed.) Expires September 19, 2004 [Page 10]
561 Internet-Draft XMPP IM March 2004
564 * If an entity receives a message or presence stanza that
565 contains XML data qualified by a namespace it does not
566 understand, the portion of the stanza that is in the unknown
567 namespace SHOULD be ignored.
569 * If an entity receives a message stanza whose only child element
570 is qualified by a namespace it does not understand, it MUST
571 ignore the entire stanza.
573 * If an entity receives an IQ stanza of type "get" or "set"
574 containing a child element qualified by a namespace it does not
575 understand, the entity SHOULD return an IQ stanza of type
576 "error" with an error condition of <service-unavailable/>.
578 Router: If a routing entity (usually a server) handles a stanza that
579 contains a child element it does not understand, it SHOULD ignore
580 the associated XML data by passing it on untouched to the
584 3. Session Establishment
586 Most instant messaging and presence applications based on XMPP are
587 implemented via a client-server architecture that requires a client
588 to establish a session on a server in order to engage in the expected
589 instant messaging and presence activities. However, there are
590 several pre-conditions that MUST be met before a client can establish
591 an instant messaging and presence session. These are:
593 1. Stream Authentication -- a client MUST complete stream
594 authentication as documented in [XMPP-CORE] before attempting to
595 establish a session or send any XML stanzas.
597 2. Resource Binding -- after completing stream authentication, a
598 client MUST bind a resource to the stream so that the client's
599 address is of the form <user@domain/resource>, after which the
600 entity is now said to be a "connected resource" in the
601 terminology of [XMPP-CORE].
603 If a server supports sessions, it MUST include a <session/> element
604 qualified by the 'urn:ietf:params:xml:ns:xmpp-session' namespace in
605 the stream features it advertises to a client after the completion of
606 stream authentication as defined in [XMPP-CORE]:
608 Server advertises session establishment feature to client:
611 xmlns='jabber:client'
615 Saint-Andre (ed.) Expires September 19, 2004 [Page 11]
617 Internet-Draft XMPP IM March 2004
620 xmlns:stream='http://etherx.jabber.org/streams'
625 <bind xmlns='urn:ietf:params:xml:ns:xmpp-bind'/>
626 <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
629 Upon being so informed that session establishment is required (and
630 after completing resource binding), the client MUST establish a
631 session if it desires to engage in instant messaging and presence
632 functionality; it completes this step by sending to the server an IQ
633 stanza of type "set" containing an empty <session/> child element
634 qualified by the 'urn:ietf:params:xml:ns:xmpp-session' namespace:
636 Step 1: Client requests session with server:
641 <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
644 Step 2: Server informs client that session has been created:
646 <iq from='example.com'
650 Upon establishing a session, a connected resource (in the terminology
651 of [XMPP-CORE]) is said to be an "active resource".
653 Several error conditions are possible. For example, the server may
654 encounter an internal condition that prevents it from creating the
655 session, the username or authorization identity may lack permissions
656 to create a session, or there may already be an active resource
657 associated with a resource identifier of the same name.
659 If the server encounters an internal condition that prevents it from
660 creating the session, it MUST return an error.
662 Step 2 (alt): Server responds with error (internal server error):
664 <iq from='example.com' type='error' id='sess_1'>
665 <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
667 <internal-server-error
671 Saint-Andre (ed.) Expires September 19, 2004 [Page 12]
673 Internet-Draft XMPP IM March 2004
676 xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
680 If the username or resource is not allowed to create a session, the
681 server MUST return an error (e.g., forbidden).
683 Step 2 (alt): Server responds with error (username or resource not
684 allowed to create session):
686 <iq from='example.com' type='error' id='sess_1'>
687 <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
690 xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
694 If there is already an active resource of the same name, the server
695 MUST either (1) terminate the active resource and allow the
696 newly-requested session, or (2) disallow the newly-requested session
697 and maintain the active resource. Which of these the server does is
698 up to the implementation, although it is RECOMMENDED to implement
699 case #1. In case #1, the server SHOULD send a <conflict/> stream
700 error to the active resource, terminate the XML stream and underlying
701 TCP connection for the active resource, and return a IQ stanza of
702 type "result" (indicating success) to the newly-requested session.
703 In case #2, the server SHOULD send a <conflict/> stanza error to the
704 newly-requested session but maintain the XML stream for that
705 connection so that the newly-requested session has an opportunity to
706 negotiate a non-conflicting resource identifier before sending
707 another request for session establishment.
709 Step 2 (alt): Server informs existing active resource of resource
713 <conflict xmlns='urn:ietf:params:xml:ns:xmpp-streams'/>
717 Step 2 (alt): Server informs newly-requested session of resource
720 <iq from='example.com' type='error' id='sess_1'>
721 <session xmlns='urn:ietf:params:xml:ns:xmpp-session'/>
722 <error type='cancel'>
723 <conflict xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
727 Saint-Andre (ed.) Expires September 19, 2004 [Page 13]
729 Internet-Draft XMPP IM March 2004
735 After establishing a session, a client SHOULD send initial presence
736 and request its roster as described below, although these actions are
739 Note: Before allowing the creation of instant messaging and presence
740 sessions, a server MAY require prior account provisioning. Possible
741 methods for account provisioning include account creation by a server
742 administrator as well as in-band account registration using the
743 'jabber:iq:register' namespace; the latter method is documented by
744 the Jabber Software Foundation [JSF] at <http://www.jabber.org/
745 protocol/> but is out of scope for this memo.
747 4. Exchanging Messages
749 Exchanging messages is a basic use of XMPP and is brought about when
750 a user generates a message stanza that is addressed to another
751 entity. As defined under Server Rules for Handling XML Stanzas
752 (Section 11), the sender's server is responsible for delivering the
753 message to the intended recipient (if the recipient is on the same
754 server) or for routing the message to the recipient's server (if the
755 recipient is on a different server).
757 For information regarding the syntax of message stanzas as well as
758 their defined attributes and child elements, refer to Message Syntax
761 4.1 Specifying an Intended Recipient
763 An instant messaging client SHOULD specify an intended recipient for
764 a message by providing the JID of an entity other than the sender in
765 the 'to' attribute of the <message/> stanza. If the message is being
766 sent in reply to a message previously received from an address of the
767 form <user@domain/resource> (e.g., within the context of a chat
768 session), the value of the 'to' address SHOULD be of the form
769 <user@domain/resource> rather than of the form <user@domain> unless
770 the sender has knowledge (via presence) that the intended recipient's
771 resource is no longer available. If the message is being sent
772 outside the context of any existing chat session or received message,
773 the value of the 'to' address SHOULD be of the form <user@domain>
774 rather than of the form <user@domain/resource>.
776 4.2 Specifying a Message Type
778 As noted, it is RECOMMENDED for a message stanza to possess a 'type'
779 attribute whose value captures the conversational context (if any) of
783 Saint-Andre (ed.) Expires September 19, 2004 [Page 14]
785 Internet-Draft XMPP IM March 2004
788 the message (see Type (Section 2.1.1)).
790 The following example shows a valid value of the 'type' attribute:
792 Example: A message of a defined type:
795 to='romeo@example.net'
796 from='juliet@example.com/balcony'
799 <body>Wherefore art thou, Romeo?</body>
803 4.3 Specifying a Message Body
805 A message stanza MAY (and often will) contain a child <body/> element
806 whose XML character data specifies the primary meaning of the message
807 (see Body (Section 2.1.2.2)).
809 Example: A message with a body:
812 to='romeo@example.net'
813 from='juliet@example.com/balcony'
816 <body>Wherefore art thou, Romeo?</body>
817 <body xml:lang='cz'>PročeŽ jsi ty, Romeo?</body>
821 4.4 Specifying a Message Subject
823 A message stanza MAY contain one or more child <subject/> elements
824 specifying the topic of the message (see Subject (Section 2.1.2.1)).
826 Example: A message with a subject:
829 to='romeo@example.net'
830 from='juliet@example.com/balcony'
833 <subject>I implore you!</subject>
835 xml:lang='cz'>Úpěnlivě prosim!</subject>
839 Saint-Andre (ed.) Expires September 19, 2004 [Page 15]
841 Internet-Draft XMPP IM March 2004
844 <body>Wherefore art thou, Romeo?</body>
845 <body xml:lang='cz'>PročeŽ jsi ty, Romeo?</body>
849 4.5 Specifying a Conversation Thread
851 A message stanza MAY contain a child <thread/> element specifying the
852 conversation thread in which the message is situated, for the purpose
853 of tracking the conversation (see Thread (Section 2.1.2.3)).
855 Example: A threaded conversation:
858 to='romeo@example.net/orchard'
859 from='juliet@example.com/balcony'
862 <body>Art thou not Romeo, and a Montague?</body>
863 <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread>
867 to='juliet@example.com/balcony'
868 from='romeo@example.net/orchard'
871 <body>Neither, fair saint, if either thee dislike.</body>
872 <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread>
876 to='romeo@example.net/orchard'
877 from='juliet@example.com/balcony'
880 <body>How cam'st thou hither, tell me, and wherefore?</body>
881 <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread>
885 5. Exchanging Presence Information
887 Exchanging presence information is made relatively straightforward
888 within XMPP by using presence stanzas. However, we see here a
889 contrast to the handling of messages: although a client MAY send
890 directed presence information to another entity by including a 'to'
891 address, normally presence notifications (i.e., presence stanzas of
895 Saint-Andre (ed.) Expires September 19, 2004 [Page 16]
897 Internet-Draft XMPP IM March 2004
900 type "available" and "unavailable" with no 'to' address) are sent
901 from a client to its server and then broadcasted by the server to any
902 entities that are subscribed to the presence of the sending entity
903 (in the terminology of RFC 2778 [IMP-MODEL], these entities are
904 subscribers). This broadcast model does not apply to
905 subscription-related presence stanzas or presence stanzas of type
906 "error", but to presence notifications only as defined above. (Note:
907 While presence information MAY be provided on a user's behalf by an
908 automated service, normally it is provided by the user's client.)
910 For information regarding the syntax of presence stanzas as well as
911 their defined attributes and child elements, refer to [XMPP-CORE].
913 5.1 Client and Server Presence Responsibilities
915 5.1.1 Initial Presence
917 After establishing a session, a client SHOULD send initial presence
918 to the server in order to signal its availability for communications.
919 As defined herein, the initial presence stanza (1) MUST possess no
920 'to' address (signalling that it is meant to be broadcasted by the
921 server on behalf of the client) and (2) MUST possess no 'type'
922 attribute (signalling the user's availability). After sending
923 initial presence, an active resource is said to be an "available
926 Upon receiving initial presence from a client, the user's server MUST
927 do the following if there is not already one or more available
928 resources for the user (if there is already one or more available
929 resources for the user, the server obviously does not need to send
930 the presence probes, since it already possesses the requisite
933 1. Send presence probes (i.e., presence stanzas whose 'type'
934 attribute is set to a value of "probe") from the full JID (e.g.,
935 <user@example.com/resource>) of the user to all contacts to which
936 the user is subscribed in order to determine if they are
937 available; such contacts are those for which a JID is present in
938 the user's roster with the 'subscription' attribute set to a
939 value of "to" or "both". (Note: The user's server MUST NOT send
940 presence probes to contacts from which the user is blocking
941 inbound presence notifications, as described under Blocking
942 Inbound Presence Notifications (Section 10.10).)
944 2. Broadcast initial presence from the full JID (e.g.,
945 <user@example.com/resource>) of the user to all contacts that are
946 subscribed to the user's presence information; such contacts are
947 those for which a JID is present in the user's roster with the
951 Saint-Andre (ed.) Expires September 19, 2004 [Page 17]
953 Internet-Draft XMPP IM March 2004
956 'subscription' attribute set to a value of "from" or "both".
957 (Note: The user's server MUST NOT broadcast initial presence to
958 contacts to which the user is blocking outbound presence
959 notifications, as described under Blocking Outbound Presence
960 Notifications (Section 10.11).)
962 In addition, the user's server MUST broadcast initial presence from
963 the user's new available resource to any of the user's existing
964 available resources (if any).
966 Upon receiving initial presence from the user, the contact's server
967 MUST deliver the user's presence stanza to the full JIDs
968 (<contact@example.org/resource>) associated with all of the contact's
969 available resources, but only if the user is in the contact's roster
970 with a subscription state of "to" or "both" and the contact has not
971 blocked inbound presence notifications from the user's bare or full
972 JID (as defined under Blocking Inbound Presence Notifications
975 If the user's server receives a presence stanza of type "error" in
976 response to the initial presence that it sent to a contact on behalf
977 of the user, it SHOULD NOT send further presence updates to that
978 contact (until and unless it receives a presence stanza from the
981 5.1.2 Presence Broadcast
983 After sending initial presence, the user MAY update its presence
984 information for broadcasting at any time during its session by
985 sending a presence stanza with no 'to' address and either no 'type'
986 attribute or a 'type' attribute with a value of "unavailable".
987 (Note: A user's client SHOULD NOT send a presence update to broadcast
988 information that changes independently of the user's presence and
991 If the presence stanza lacks a 'type' attribute (i.e., expresses
992 availability), the user's server MUST broadcast the full XML of that
993 presence stanza to all contacts (1) that are in the user's roster
994 with a subscription type of "from" or "both", (2) to whom the user
995 has not blocked outbound presence notifications, and (3) from whom
996 the server has not received a presence error during the user's
997 session (as well as to any of the user's other available resources).
999 If the presence stanza has a 'type' attribute set to a value of
1000 "unavailable", the user's server MUST broadcast the full XML of that
1001 presence stanza to all entities that fit the above description, as
1002 well as to any entities to which the user has sent directed available
1003 presence during the user's session (if the user has not yet sent
1007 Saint-Andre (ed.) Expires September 19, 2004 [Page 18]
1009 Internet-Draft XMPP IM March 2004
1012 directed unavailable presence to that entity).
1014 5.1.3 Presence Probes
1016 Upon receiving a presence probe from the user, the contact's server
1017 SHOULD reply as follows:
1019 1. If the user is not in the contact's roster with a subscription
1020 state of "From", "From + Pending Out", or "Both" (as defined
1021 under Subscription States (Section 9)), the contact's server MUST
1022 return a presence stanza of type "error" in response to the
1023 presence probe (however, if a server receives a presence probe
1024 from a subdomain of the server's hostname or another such trusted
1025 service, it MAY provide presence information about the user to
1026 that entity). Specifically:
1028 * if the user is in the contact's roster with a subscription
1029 state of "None", "None + Pending Out", or "To" (or is not in
1030 the contact's roster at all), the contact's server MUST return
1031 a <forbidden/> stanza error in response to the presence probe.
1033 * if the user is in the contact's roster with a subscription
1034 state of "None + Pending In", "None + Pending Out/In", or "To
1035 + Pending In", the contact's server MUST return a
1036 <not-authorized/> stanza error in response to the presence
1039 2. Else, if the contact is blocking presence notifications to the
1040 user's bare JID or full JID (using either a default list or
1041 active list as defined under Blocking Outbound Presence
1042 Notifications (Section 10.11)), the server MUST NOT reply to the
1045 3. Else, if the contact has no available resources, the server MUST
1046 either (1) reply to the presence probe by sending to the user the
1047 full XML of the last presence stanza of type "unavailable"
1048 received by the server from the contact, or (2) not reply at all.
1050 4. Else, if the contact has at least one available resource, the
1051 server MUST reply to the presence probe by sending to the user
1052 the full XML of the last presence stanza with no 'to' attribute
1053 received by the server from each of the contact's available
1054 resources (again, subject to privacy lists in force for each
1063 Saint-Andre (ed.) Expires September 19, 2004 [Page 19]
1065 Internet-Draft XMPP IM March 2004
1068 5.1.4 Directed Presence
1070 A user MAY send directed presence to another entity (i.e., a presence
1071 stanza with a 'to' attribute whose value is the JID of the other
1072 entity and with either no 'type' attribute or a 'type' attribute
1073 whose value is "unavailable"). There are three possible cases:
1075 1. If the user sends directed presence to a contact that is in the
1076 user's roster with a subscription type of "from" or "both" after
1077 having sent initial presence and before sending unavailable
1078 presence broadcast, the user's server MUST route or deliver the
1079 full XML of that presence stanza (subject to privacy lists) but
1080 SHOULD NOT otherwise modify the contact's status regarding
1081 presence broadcast (i.e., it SHOULD include the contact's JID in
1082 any subsequent presence broadcasts initiated by the user).
1084 2. If the user sends directed presence to an entity that is not in
1085 the user's roster with a subscription type of "from" or "both"
1086 after having sent initial presence and before sending unavailable
1087 presence broadcast, the user's server MUST route or deliver the
1088 full XML of that presence stanza to the entity but MUST NOT
1089 modify the contact's status regarding available presence
1090 broadcast (i.e., it MUST NOT include the entity's JID in any
1091 subsequent broadcasts of available presence initiated by the
1092 user); however, if the available resource from which the user
1093 sent the directed presence become unavailable, the user's server
1094 MUST broadcast that unavailable presence to the entity (if the
1095 user has not yet sent directed unavailable presence to that
1098 3. If the user sends directed presence without first sending initial
1099 presence or after having sent unavailable presence broadcast
1100 (i.e., the resource is active but not available), the user's
1101 server MUST treat the entities to which the user sends directed
1102 presence in the same way that it treats the entities listed in
1106 5.1.5 Unavailable Presence
1108 Before ending its session with a server, a client SHOULD gracefully
1109 become unavailable by sending a final presence stanza that possesses
1110 no 'to' attribute and that possesses a 'type' attribute whose value
1111 is "unavailable" (optionally, the final presence stanza MAY contain
1112 one or more <status/> elements specifying the reason why the user is
1113 no longer available). However, the user's server MUST NOT depend on
1114 receiving final presence from an available resource, since the
1115 resource may become unavailable unexpectedly or may be timed out by
1119 Saint-Andre (ed.) Expires September 19, 2004 [Page 20]
1121 Internet-Draft XMPP IM March 2004
1124 the server. If one of the user's resources becomes unavailable for
1125 any reason (either gracefully or ungracefully), the user's server
1126 MUST broadcast unavailable presence to all contacts (1) that are in
1127 the user's roster with a subscription type of "from" or "both", (2)
1128 to whom the user has not blocked outbound presence, and (3) from whom
1129 the server has not received a presence error during the user's
1130 session; the user's server MUST also send that unavailable presence
1131 stanza to any of the user's other available resources, as well as to
1132 any entities to which the user has sent directed presence during the
1133 user's session for that resource (if the user has not yet sent
1134 directed unavailable presence to that entity). Any presence stanza
1135 with no 'type' attribute and no 'to' attribute that is sent after
1136 sending directed unavailable presence or broadcasted unavailable
1137 presence MUST be broadcasted by the server to all subscribers.
1139 5.1.6 Presence Subscriptions
1141 A subscription request is a presence stanza whose 'type' attribute
1142 has a value of "subscribe". If the subscription request is being
1143 sent to an instant messaging contact, the JID supplied in the 'to'
1144 attribute SHOULD be of the form <contact@example.org> rather than
1145 <contact@example.org/resource>, since the desired result is normally
1146 for the user to receive presence from all of the contact's resources,
1147 not merely the particular resource specified in the 'to' attribute.
1149 A user's server MUST NOT automatically approve subscription requests
1150 on the user's behalf. All subscription requests MUST be directed to
1151 the user's client, specifically to one or more available resources
1152 associated with the user. If there is no available resource
1153 associated with the user when the subscription request is received by
1154 the user's server, the user's server MUST keep a record of the
1155 subscription request and deliver the request when the user next
1156 creates an available resource, until the user either approves or
1157 denies the request. If there is more than one available resource
1158 associated with the user when the subscription request is received by
1159 the user's server, the user's server MUST broadcast that subscription
1160 request to all available resources in accordance with Server Rules
1161 for Handling XML Stanzas (Section 11). (Note: If an active resource
1162 has not provided initial presence, the server MUST NOT consider it to
1163 be available and therefore MUST NOT send subscription requests to
1164 it.) However, if the user receives a presence stanza of type
1165 "subscribe" from a contact to whom the user has already granted
1166 permission to see the user's presence information (e.g., in cases
1167 when the contact is seeking to resynchronize subscription states),
1168 the user's server SHOULD auto-reply on behalf of the user. In
1169 addition, the user's server MAY choose to re-send an unapproved
1170 pending subscription request to the contact based on an
1171 implementation-specific algorithm (e.g., whenever a new resource
1175 Saint-Andre (ed.) Expires September 19, 2004 [Page 21]
1177 Internet-Draft XMPP IM March 2004
1180 becomes available for the user, or after a certain amount of time has
1181 elapsed); this helps to recover from transient, silent errors that
1182 may have occurred in relation to the original subscription request.
1184 5.2 Specifying Availability Status
1186 A client MAY provide further information about its availability
1187 status by using the <show/> element (see Show (Section 2.2.2.1)).
1189 Example: Availability status:
1196 5.3 Specifying Detailed Status Information
1198 In conjunction with the <show/> element, a client MAY provide
1199 detailed status information by using the <status/> element (see
1200 Status (Section 2.2.2.2)).
1202 Example: Detailed status information:
1204 <presence xml:lang='en'>
1206 <status>Wooing Juliet</status>
1207 <status xml:lang='cz'>Ja dvořím Juliet</status>
1211 5.4 Specifying Presence Priority
1213 A client MAY provide a priority for its resource by using the
1214 <priority/> element (see Priority (Section 2.2.2.3)).
1216 Example: Presence priority:
1218 <presence xml:lang='en'>
1220 <status>Wooing Juliet</status>
1221 <status xml:lang='cz'>Ja dvořím Juliet</status>
1222 <priority>1</priority>
1231 Saint-Andre (ed.) Expires September 19, 2004 [Page 22]
1233 Internet-Draft XMPP IM March 2004
1236 5.5 Presence Examples
1238 The examples in this section illustrate the presence-related
1239 protocols described above. The user is romeo@example.net, he has an
1240 available resource whose resource identifier is "orchard", and he has
1241 the following individuals in his roster:
1243 o juliet@example.com (subscription="both" and she has two available
1244 resources, one whose resource is "chamber" and another whose
1245 resource is "balcony")
1247 o benvolio@example.org (subscription="to")
1249 o mercutio@example.org (subscription="from")
1251 Example 1: User sends initial presence:
1255 Example 2: User's server sends presence probes to contacts with
1256 subscription="to" and subscription="both" on behalf of the user's
1261 from='romeo@example.net/orchard'
1262 to='juliet@example.com'/>
1266 from='romeo@example.net/orchard'
1267 to='benvolio@example.org'/>
1269 Example 3: User's server sends initial presence to contacts with
1270 subscription="from" and subscription="both" on behalf of the user's
1274 from='romeo@example.net/orchard'
1275 to='juliet@example.com'/>
1278 from='romeo@example.net/orchard'
1279 to='mercutio@example.org'/>
1281 Example 4: Contacts's servers reply to presence probe on behalf of
1282 all available resources:
1287 Saint-Andre (ed.) Expires September 19, 2004 [Page 23]
1289 Internet-Draft XMPP IM March 2004
1293 from='juliet@example.com/balcony'
1294 to='romeo@example.net/orchard'
1297 <status>be right back</status>
1298 <priority>0</priority>
1302 from='juliet@example.com/chamber'
1303 to='romeo@example.net/orchard'>
1304 <priority>1</priority>
1308 from='benvolio@example.org/pda'
1309 to='romeo@example.net/orchard'
1312 <status>gallivanting</status>
1315 Example 5: Contacts's servers deliver user's initial presence to all
1316 available resources or return error to user:
1319 from='romeo@example.net/orchard'
1320 to='juliet@example.com/chamber'/>
1323 from='romeo@example.net/orchard'
1324 to='juliet@example.com/balcony'/>
1328 from='mercutio@example.org'
1329 to='romeo@example.net/orchard'>
1330 <error type='cancel'>
1331 <gone xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
1335 Example 6: User sends directed presence to another user not in his
1339 from='romeo@example.net/orchard'
1343 Saint-Andre (ed.) Expires September 19, 2004 [Page 24]
1345 Internet-Draft XMPP IM March 2004
1348 to='nurse@example.com'
1351 <status>courting Juliet</status>
1352 <priority>0</priority>
1355 Example 7: User sends updated available presence information for
1358 <presence xml:lang='en'>
1360 <status>I shall return!</status>
1361 <priority>1</priority>
1364 Example 8: User's server broadcasts updated presence information only
1365 to one contact (not those from whom an error was received or to whom
1366 the user sent directed presence):
1369 from='romeo@example.net/orchard'
1370 to='juliet@example.com'
1373 <status>I shall return!</status>
1374 <priority>1</priority>
1377 Example 9: Contact's server delivers updated presence information to
1378 all of the contact's available resources:
1380 [to "balcony" resource...]
1382 from='romeo@example.net/orchard'
1383 to='juliet@example.com'
1386 <status>I shall return!</status>
1387 <priority>1</priority>
1390 [to "chamber" resource...]
1392 from='romeo@example.net/orchard'
1393 to='juliet@example.com'
1399 Saint-Andre (ed.) Expires September 19, 2004 [Page 25]
1401 Internet-Draft XMPP IM March 2004
1404 <status>I shall return!</status>
1405 <priority>1</priority>
1408 Example 10: One of the contact's resources broadcasts final presence:
1410 <presence from='juliet@example.com/balcony' type='unavailable'/>
1412 Example 11: Contact's server sends unavailable presence information
1417 from='juliet@example.com/balcony'
1418 to='romeo@example.net/orchard'/>
1420 Example 12: User sends final presence:
1422 <presence from='romeo@example.net/orchard'
1425 <status>gone home</status>
1428 Example 13: User's server broadcasts unavailable presence information
1429 to contact as well as to the person to whom the user sent directed
1434 from='romeo@example.net/orchard'
1435 to='juliet@example.com'
1437 <status>gone home</status>
1441 from='romeo@example.net/orchard'
1442 to='nurse@example.com'
1444 <status>gone home</status>
1448 6. Managing Subscriptions
1450 In order to protect the privacy of instant messaging users and any
1451 other entities, presence and availability information is disclosed
1455 Saint-Andre (ed.) Expires September 19, 2004 [Page 26]
1457 Internet-Draft XMPP IM March 2004
1460 only to other entities that the user has approved. When a user has
1461 agreed that another entity may view its presence, the entity is said
1462 to have a subscription to the user's presence information. A
1463 subscription lasts across sessions; indeed, it lasts until the
1464 subscriber unsubscribes or the subscribee cancels the
1465 previously-granted subscription. Subscriptions are managed within
1466 XMPP by sending presence stanzas containing specially-defined
1469 Note: There are important interactions between subscriptions and
1470 rosters; these are defined under Integration of Roster Items and
1471 Presence Subscriptions (Section 8), and the reader must refer to that
1472 section for a complete understanding of presence subscriptions.
1474 6.1 Requesting a Subscription
1476 A request to subscribe to another entity's presence is made by
1477 sending a presence stanza of type "subscribe".
1479 Example: Sending a subscription request:
1481 <presence to='juliet@example.com' type='subscribe'/>
1483 For client and server responsibilities regarding presence
1484 subscription requests, refer to Presence Subscriptions (Section
1487 6.2 Handling a Subscription Request
1489 When a client receives a subscription request from another entity, it
1490 MUST either approve the request by sending a presence stanza of type
1491 "subscribed" or refuse the request by sending a presence stanza of
1492 type "unsubscribed".
1494 Example: Approving a subscription request:
1496 <presence to='romeo@example.net' type='subscribed'/>
1498 Example: Refusing a presence subscription request:
1500 <presence to='romeo@example.net' type='unsubscribed'/>
1503 6.3 Cancelling a Subscription from Another Entity
1505 If a user would like to cancel a previously-granted subscription
1506 request, it sends a presence stanza of type "unsubscribed".
1511 Saint-Andre (ed.) Expires September 19, 2004 [Page 27]
1513 Internet-Draft XMPP IM March 2004
1516 Example: Cancelling a previously granted subscription request:
1518 <presence to='romeo@example.net' type='unsubscribed'/>
1521 6.4 Unsubscribing from Another Entity's Presence
1523 If a user would like to unsubscribe from the presence of another
1524 entity, it sends a presence stanza of type "unsubscribe".
1526 Example: Unsubscribing from an entity's presence:
1528 <presence to='juliet@example.com' type='unsubscribe'/>
1531 7. Roster Management
1533 In XMPP, one's contact list is called a roster, which consists of any
1534 number of specific roster items, each roster item being identified by
1535 a unique JID (usually of the form <contact@domain>). A user's roster
1536 is stored by the user's server on the user's behalf so that the user
1537 may access roster information from any resource.
1539 Note: There are important interactions between rosters and
1540 subscriptions; these are defined under Integration of Roster Items
1541 and Presence Subscriptions (Section 8), and the reader must refer to
1542 that section for a complete understanding of roster management.
1544 7.1 Syntax and Semantics
1546 Rosters are managed using IQ stanzas, specifically by means of a
1547 <query/> child element qualified by the 'jabber:iq:roster' namespace.
1548 The <query/> element MAY contain one or more <item/> children, each
1549 describing a unique roster item or "contact".
1551 The "key" or unique identifier for each roster item is a JID,
1552 encapsulated in the 'jid' attribute of the <item/> element (which is
1553 REQUIRED). The value of the 'jid' attribute SHOULD be of the form
1554 <user@domain> if the item is associated with another (human) instant
1557 The state of the presence subscription in relation to a roster item
1558 is captured in the 'subscription' attribute of the <item/> element.
1559 Allowable values for this attribute are:
1561 o "none" -- the user does not have a subscription to the contact's
1562 presence information, and the contact does not have a subscription
1563 to the user's presence information
1567 Saint-Andre (ed.) Expires September 19, 2004 [Page 28]
1569 Internet-Draft XMPP IM March 2004
1572 o "to" -- the user has a subscription to the contact's presence
1573 information, but the contact does not have a subscription to the
1574 user's presence information
1576 o "from" -- the contact has a subscription to the user's presence
1577 information, but the user does not have a subscription to the
1578 contact's presence information
1580 o "both" -- both the user and the contact have subscriptions to each
1581 other's presence information
1583 Each <item/> element MAY contain a 'name' attribute, which sets the
1584 "nickname" to be associated with the JID, as determined by the user
1585 (not the contact). The value of the 'name' attribute is opaque.
1587 Each <item/> element MAY contain one or more <group/> child elements,
1588 for use in collecting roster items into various categories. The XML
1589 character data of the <group/> element is opaque.
1593 A server MUST ignore any 'to' address on a roster "set", and MUST
1594 treat any roster "set" as applying to the sender. For added safety,
1595 a client SHOULD check the "from" address of a "roster push" (incoming
1596 IQ of type "set" containing a roster item) to ensure that it is from
1597 a trusted source; specifically, the stanza MUST either have no 'from'
1598 attribute (i.e., implicitly from the server) or have a 'from'
1599 attribute whose value matches the user's bare JID (of the form
1600 <user@domain>) or full JID (of the form <user@domain/resource>);
1601 otherwise, the client SHOULD ignore the "roster push".
1603 7.3 Retrieving One's Roster on Login
1605 Upon connecting to the server and sending available presence, a
1606 client SHOULD request the roster before sending initial presence
1607 (however, because receiving the roster may not be desirable for all
1608 resources, e.g., a connection with limited bandwidth, the client's
1609 request for the roster is OPTIONAL). If an available resource does
1610 not request the roster during a session, the server MUST NOT send it
1611 presence subscriptions and associated roster updates. If an
1612 unavailable resource requests the roster, the server SHOULD return an
1613 <unexpected-request/> error to the resource.
1615 Example: Client requests current roster from server:
1617 <iq from='juliet@example.com/balcony' type='get' id='roster_1'>
1618 <query xmlns='jabber:iq:roster'/>
1623 Saint-Andre (ed.) Expires September 19, 2004 [Page 29]
1625 Internet-Draft XMPP IM March 2004
1628 Example: Client receives roster from server:
1630 <iq to='juliet@example.com/balcony' type='result' id='roster_1'>
1631 <query xmlns='jabber:iq:roster'>
1632 <item jid='romeo@example.net'
1634 subscription='both'>
1635 <group>Friends</group>
1637 <item jid='mercutio@example.org'
1639 subscription='from'>
1640 <group>Friends</group>
1642 <item jid='benvolio@example.org'
1644 subscription='both'>
1645 <group>Friends</group>
1651 7.4 Adding a Roster Item
1653 At any time, a user MAY add an item to his or her roster.
1655 Example: Client adds a new item:
1657 <iq from='juliet@example.com/balcony' type='set' id='roster_2'>
1658 <query xmlns='jabber:iq:roster'>
1659 <item jid='nurse@example.com'
1661 <group>Servants</group>
1666 The server MUST update the roster information in persistent storage,
1667 and also push the change out to all of the user's available resources
1668 that have requested the roster. This "roster push" consists of an IQ
1669 stanza of type "set" from the server to the client and enables all
1670 available resources to remain in sync with the server-based roster
1673 Example: Server (1) pushes the updated roster information to all
1674 available resources that have requested the roster and (2) replies
1675 with an IQ result to the sending resource:
1679 Saint-Andre (ed.) Expires September 19, 2004 [Page 30]
1681 Internet-Draft XMPP IM March 2004
1684 <iq to='juliet@example.com/balcony'
1687 <query xmlns='jabber:iq:roster'>
1688 <item jid='nurse@example.com'
1690 subscription='none'>
1691 <group>Servants</group>
1696 <iq to='juliet@example.com/chamber'
1699 <query xmlns='jabber:iq:roster'>
1700 <item jid='nurse@example.com'
1702 subscription='none'>
1703 <group>Servants</group>
1708 <iq to='juliet@example.com/balcony' type='result' id='roster_2'/>
1710 As required by the semantics of the IQ stanza kind as defined in
1711 [XMPP-CORE], each resource that received the roster push MUST reply
1712 with an IQ stanza of type "result" (or "error).
1714 Example: Resources reply with an IQ result to the server:
1716 <iq from='juliet@example.com/balcony'
1720 <iq from='juliet@example.com/chamber'
1726 7.5 Updating a Roster Item
1728 Updating an existing roster item (e.g., changing the group) is done
1729 in the same way as adding a new roster item, i.e., by sending the
1730 roster item in an IQ set to the server.
1735 Saint-Andre (ed.) Expires September 19, 2004 [Page 31]
1737 Internet-Draft XMPP IM March 2004
1740 Example: User updates roster item (added group):
1742 <iq from='juliet@example.com/chamber' type='set' id='roster_3'>
1743 <query xmlns='jabber:iq:roster'>
1744 <item jid='romeo@example.net'
1746 subscription='both'>
1747 <group>Friends</group>
1748 <group>Lovers</group>
1753 As with adding a roster item, when updating a roster item the server
1754 MUST update the roster information in persistent storage, and also
1755 initiate a roster push to all of the user's available resources that
1756 have requested the roster.
1758 7.6 Deleting a Roster Item
1760 At any time, a user MAY delete an item from his or her roster by
1761 sending an IQ set to the server and making sure that the value of the
1762 'subscription' attribute is "remove" (a compliant server MUST ignore
1763 any other values of the 'subscription' attribute when received from a
1766 Example: Client removes an item:
1768 <iq from='juliet@example.com/balcony' type='set' id='roster_4'>
1769 <query xmlns='jabber:iq:roster'>
1770 <item jid='nurse@example.com' subscription='remove'/>
1774 As with adding a roster item, when deleting a roster item the server
1775 MUST update the roster information in persistent storage, initiate a
1776 roster push to all of the user's available resources that have
1777 requested the roster (with the 'subscription' attribute set to a
1778 value of "remove"), and send an IQ result to the initiating resource.
1780 For further information about the implications of this command, see
1781 Removing a Roster Item and Cancelling All Subscriptions (Section
1784 8. Integration of Roster Items and Presence Subscriptions
1791 Saint-Andre (ed.) Expires September 19, 2004 [Page 32]
1793 Internet-Draft XMPP IM March 2004
1798 Some level of integration between roster items and presence
1799 subscriptions is normally expected by an instant messaging user
1800 regarding the user's subscriptions to and from other contacts. This
1801 section describes the level of integration that MUST be supported
1802 within XMPP instant messaging applications.
1804 There are four primary subscription states:
1806 o None -- the user does not have a subscription to the contact's
1807 presence information, and the contact does not have a subscription
1808 to the user's presence information
1810 o To -- the user has a subscription to the contact's presence
1811 information, but the contact does not have a subscription to the
1812 user's presence information
1814 o From -- the contact has a subscription to the user's presence
1815 information, but the user does not have a subscription to the
1816 contact's presence information
1818 o Both -- both the user and the contact have subscriptions to each
1819 other's presence information (i.e., the union of 'from' and 'to')
1821 Each of these states is reflected in the roster of both the user and
1822 the contact, thus resulting in durable subscription states.
1823 Narrative explanations of how these subscription states interact with
1824 roster items in order to complete certain defined use cases are
1825 provided in the following sub-sections. Full details regarding
1826 server and client handling of all subscription states (including
1827 pending states between the primary states listed above) is provided
1828 in Subscription States (Section 9).
1830 The server MUST NOT send presence subscription requests or roster
1831 pushes to unavailable resources, nor to available resources that have
1832 not requested the roster.
1834 The 'from' and 'to' addresses are OPTIONAL in roster pushes; if
1835 included, their values SHOULD be the full JID of the resource for
1836 that session. A client MUST acknowledge each roster push with an IQ
1837 stanza of type "result" (for the sake of brevity, these stanzas are
1838 not shown in the following examples but are required by the IQ
1839 semantics defined in [XMPP-CORE]).
1841 8.2 User Subscribes to Contact
1843 The process by which a user subscribes to a contact, including the
1847 Saint-Andre (ed.) Expires September 19, 2004 [Page 33]
1849 Internet-Draft XMPP IM March 2004
1852 interaction between roster items and subscription states, is
1855 1. In preparation for being able to render the contact in the user's
1856 client interface and for the server to keep track of the
1857 subscription, the user's client SHOULD perform a "roster set" for
1858 the new roster item. This request consists of sending an IQ
1859 stanza of type='set' containing a <query/> element qualified by
1860 the 'jabber:iq:roster' namespace, which in turn contains an
1861 <item/> element that defines the new roster item; the <item/>
1862 element MUST possess a 'jid' attribute, MAY possess a 'name'
1863 attribute, MUST NOT possess a 'subscription' attribute, and MAY
1864 contain one or more <group/> child elements:
1866 <iq type='set' id='set1'>
1867 <query xmlns='jabber:iq:roster'>
1869 jid='contact@example.org'
1871 <group>MyBuddies</group>
1876 2. As a result, the user's server (1) MUST initiate a roster push
1877 for the new roster item to all available resources associated
1878 with this user that have requested the roster, setting the
1879 'subscription' attribute to a value of "none"; and (2) MUST reply
1880 to the sending resource with an IQ result indicating the success
1884 <query xmlns='jabber:iq:roster'>
1886 jid='contact@example.org'
1889 <group>MyBuddies</group>
1894 <iq type='result' id='set1'/>
1896 3. If the user wants to request a subscription to the contact's
1897 presence information, the user's client MUST send a presence
1898 stanza of type='subscribe' to the contact:
1903 Saint-Andre (ed.) Expires September 19, 2004 [Page 34]
1905 Internet-Draft XMPP IM March 2004
1908 <presence to='contact@example.org' type='subscribe'/>
1910 4. As a result, the user's server MUST initiate a second roster push
1911 to all of the user's available resources that have requested the
1912 roster, setting the contact to the pending sub-state of the
1913 'none' subscription state; this pending sub-state is denoted by
1914 the inclusion of the ask='subscribe' attribute in the roster
1918 <query xmlns='jabber:iq:roster'>
1920 jid='contact@example.org'
1924 <group>MyBuddies</group>
1929 Note: If the user did not create a roster item before sending the
1930 subscription request, the server MUST now create one on behalf of
1931 the user, then send a roster push to all of the user's available
1932 resources that have requested the roster, absent the 'name'
1933 attribute and the <group/> child shown above.
1935 5. The user's server MUST also stamp the presence stanza of type
1936 "subscribe" with the user's bare JID (i.e., <user@example.com>)
1937 as the 'from' address (if the user provided a 'from' address set
1938 to the user's full JID, the server SHOULD remove the resource
1939 identifier). If the contact is served by a different host than
1940 the user, the user's server MUST route the presence stanza to the
1941 contact's server for delivery to the contact (this case is
1942 assumed throughout; however, if the contact is served by the same
1943 host, then the server can simply deliver the presence stanza
1947 from='user@example.com'
1948 to='contact@example.org'
1951 Note: If the user's server receives a presence stanza of type
1952 "error" from the contact's server, it MUST deliver the error
1953 stanza to the user, whose client MAY determine that the error is
1954 in response to the outgoing presence stanza of type "subscribe"
1955 it sent previously (e.g., by tracking an 'id' attribute) and then
1959 Saint-Andre (ed.) Expires September 19, 2004 [Page 35]
1961 Internet-Draft XMPP IM March 2004
1964 choose to resend the "subscribe" request or revert the roster to
1965 its previous state by sending a presence stanza of type
1966 "unsubscribe" to the contact.
1968 6. Upon receiving the presence stanza of type "subscribe" addressed
1969 to the contact, the contact's server MUST determine if there is
1970 at least one available resource from which the contact has
1971 requested the roster. If so, it MUST deliver the subscription
1972 request to the contact (if not, the contact's server MUST store
1973 the subscription request offline for delivery when this condition
1974 is next met; normally this is done by adding a roster item for
1975 the contact to the user's roster, with a state of "None + Pending
1976 In" as defined under Subscription States (Section 9), however a
1977 server SHOULD NOT push or deliver roster items in that state to
1978 the contact). No matter when the subscription request is
1979 delivered, the contact must decide whether or not to approve it
1980 (subject to the contact's configured preferences, the contact's
1981 client MAY approve or refuse the subscription request without
1982 presenting it to the contact). Here we assume the "happy path"
1983 that the contact approves the subscription request (the alternate
1984 flow of declining the subscription request is defined in Section
1985 8.2.1). In this case, the contact's client (1) SHOULD perform a
1986 roster set specifying the desired nickname and group for the user
1987 (if any); and (2) MUST send a presence stanza of type
1988 "subscribed" to the user in order to approve the subscription
1991 <iq type='set' id='set2'>
1992 <query xmlns='jabber:iq:roster'>
1994 jid='user@example.com'
1996 <group>SomeGroup</group>
2001 <presence to='user@example.com' type='subscribed'/>
2003 7. As a result, the contact's server (1) MUST initiate a roster push
2004 to all available resources associated with the contact that have
2005 requested the roster, containing a roster item for the user with
2006 the subscription state set to 'from' (the server MUST send this
2007 even if the contact did not perform a roster set); (2) MUST
2008 return an IQ result to the sending resource indicating the
2009 success of the roster set; (3) MUST route the presence stanza of
2010 type "subscribed" to the user, first stamping the 'from' address
2011 as the bare JID (<contact@example.org>) of the contact; and (4)
2015 Saint-Andre (ed.) Expires September 19, 2004 [Page 36]
2017 Internet-Draft XMPP IM March 2004
2020 MUST send available presence from all of the contact's available
2021 resources to the user:
2023 <iq type='set' to='contact@example.org/resource'>
2024 <query xmlns='jabber:iq:roster'>
2026 jid='user@example.com'
2029 <group>SomeGroup</group>
2034 <iq type='result' to='contact@example.org/resource' id='set2'/>
2037 from='contact@example.org'
2038 to='user@example.com'
2042 from='contact@example.org/resource'
2043 to='user@example.com'/>
2045 Note: If the contact's server receives a presence stanza of type
2046 "error" from the user's server, it MUST deliver the error stanza
2047 to the contact, whose client MAY determine that the error is in
2048 response to the outgoing presence stanza of type "subscribed" it
2049 sent previously (e.g., by tracking an 'id' attribute) and then
2050 choose to resend the "subscribed" notification or revert the
2051 roster to its previous state by sending a presence stanza of type
2052 "unsubscribed" to the user.
2054 8. Upon receiving the presence stanza of type "subscribed" addressed
2055 to the user, the user's server MUST first verify that the contact
2056 is in the user's roster with either of the following states: (a)
2057 subscription='none' and ask='subscribe' or (b)
2058 subscription='from' and ask='subscribe'. If the contact is not
2059 in the user's roster with either of those states, the user's
2060 server MUST silently ignore the presence stanza of type
2061 "subscribed" (i.e., it MUST NOT route it to the user, modify the
2062 user's roster, or generate a roster push to the user's available
2063 resources). If the contact is in the user's roster with either
2064 of those states, the user's server (1) MUST deliver the presence
2065 stanza of type "subscribed" from the contact to the user; (2)
2066 MUST initiate a roster push to all of the user's available
2067 resources that have requested the roster, containing an updated
2071 Saint-Andre (ed.) Expires September 19, 2004 [Page 37]
2073 Internet-Draft XMPP IM March 2004
2076 roster item for the contact with the 'subscription' attribute set
2077 to a value of "to"; and (3) MUST deliver the available presence
2078 stanza received from each of the contact's available resources to
2079 each of the user's available resources:
2082 to='user@example.com'
2083 from='contact@example.org'
2087 <query xmlns='jabber:iq:roster'>
2089 jid='contact@example.org'
2092 <group>MyBuddies</group>
2098 from='contact@example.org/resource'
2099 to='user@example.com/resource'/>
2101 9. Upon receiving the presence stanza of type "subscribed", the user
2102 SHOULD acknowledge receipt of that subscription state
2103 notification through either "affirming" it by sending a presence
2104 stanza of type "subscribe" to the contact or "denying" it by
2105 sending a presence stanza of type "unsubscribe" to the contact;
2106 this step does not necessarily affect the subscription state (see
2107 Subscription States (Section 9) for details), but instead lets
2108 the user's server know that it MUST no longer send notification
2109 of the subscription state change to the user (see Section 9.4).
2111 From the perspective of the user, there now exists a subscription to
2112 the contact's presence information; from the perspective of the
2113 contact, there now exists a subscription from the user.
2115 8.2.1 Alternate Flow: Contact Declines Subscription Request
2117 The above activity flow represents the "happy path" regarding the
2118 user's subscription request to the contact. The main alternate flow
2119 occurs if the contact refuses the user's subscription request, as
2122 1. If the contact wants to refuse the request, the contact's client
2123 MUST send a presence stanza of type "unsubscribed" to the user
2127 Saint-Andre (ed.) Expires September 19, 2004 [Page 38]
2129 Internet-Draft XMPP IM March 2004
2132 (instead of the presence stanza of type "subscribed" sent in Step
2135 <presence to='user@example.com' type='unsubscribed'/>
2137 2. As a result, the contact's server MUST route the presence stanza
2138 of type "unsubscribed" to the user, first stamping the 'from'
2139 address as the bare JID (<contact@example.org>) of the contact:
2142 from='contact@example.org'
2143 to='user@example.com'
2144 type='unsubscribed'/>
2146 Note: If the contact's server previously added the user to the
2147 contact's roster for tracking purposes, it MUST remove the
2148 relevant item at this time.
2150 3. Upon receiving the presence stanza of type "unsubscribed"
2151 addressed to the user, the user's server (1) MUST deliver that
2152 presence stanza to the user and (2) MUST initiate a roster push
2153 to all of the user's available resources that have requested the
2154 roster, containing an updated roster item for the contact with
2155 the 'subscription' attribute set to a value of "none" and with no
2159 from='contact@example.org'
2160 to='user@example.com'
2161 type='unsubscribed'/>
2164 <query xmlns='jabber:iq:roster'>
2166 jid='contact@example.org'
2169 <group>MyBuddies</group>
2174 4. Upon receiving the presence stanza of type "unsubscribed", the
2175 user SHOULD acknowledge receipt of that subscription state
2176 notification through either "affirming" it by sending a presence
2177 stanza of type "unsubscribe" to the contact or "denying" it by
2178 sending a presence stanza of type "subscribe" to the contact;
2179 this step does not necessarily affect the subscription state (see
2183 Saint-Andre (ed.) Expires September 19, 2004 [Page 39]
2185 Internet-Draft XMPP IM March 2004
2188 Subscription States (Section 9) for details), but instead lets
2189 the user's server know that it MUST no longer send notification
2190 of the subscription state change to the user (see Section 9.4).
2192 As a result of this activity, the contact is now in the user's roster
2193 with a subscription state of "none", whereas the user is not in the
2194 contact's roster at all.
2196 8.3 Creating a Mutual Subscription
2198 The user and contact can build on the "happy path" described above to
2199 create a mutual subscription (i.e., a subscription of type "both").
2200 The process is described below.
2202 1. If the contact wants to create a mutual subscription, the contact
2203 MUST send a subscription request to the user (subject to the
2204 contact's configured preferences, the contact's client MAY send
2205 this automatically):
2207 <presence to='user@example.com' type='subscribe'/>
2209 2. As a result, the contact's server (1) MUST initiate a roster push
2210 to all available resources associated with the contact that have
2211 requested the roster, with the user still in the 'from'
2212 subscription state but with a pending 'to' subscription denoted
2213 by the inclusion of the ask='subscribe' attribute in the roster
2214 item; and (2) MUST route the presence stanza of type "subscribe"
2215 to the user, first stamping the 'from' address as the bare JID
2216 (<contact@example.org>) of the contact:
2219 <query xmlns='jabber:iq:roster'>
2221 jid='user@example.com'
2225 <group>SomeGroup</group>
2231 from='contact@example.org'
2232 to='user@example.com'
2235 Note: If the contact's server receives a presence stanza of type
2239 Saint-Andre (ed.) Expires September 19, 2004 [Page 40]
2241 Internet-Draft XMPP IM March 2004
2244 "error" from the user's server, it MUST deliver the error stanza
2245 to the contact, whose client MAY determine that the error is in
2246 response to the outgoing presence stanza of type "subscribe" it
2247 sent previously (e.g., by tracking an 'id' attribute) and then
2248 choose to resend the "subscribe" request or revert the roster to
2249 its previous state by sending a presence stanza of type
2250 "unsubscribe" to the user.
2252 3. Upon receiving the presence stanza of type "subscribe" addressed
2253 to the user, the user's server must determine if there is at
2254 least one available resource for which the user has requested the
2255 roster. If so, the user's server MUST deliver the subscription
2256 request to the user (if not, it MUST store the subscription
2257 request offline for delivery when this condition is next met).
2258 No matter when the subscription request is delivered, the user
2259 must then decide whether or not to approve it (subject to the
2260 user's configured preferences, the user's client MAY approve or
2261 refuse the subscription request without presenting it to the
2262 user). Here we assume the "happy path" that the user approves
2263 the subscription request (the alternate flow of declining the
2264 subscription request is defined in Section 8.3.1). In this case,
2265 the user's client MUST send a presence stanza of type
2266 "subscribed" to the contact in order to approve the subscription
2269 <presence to='contact@example.org' type='subscribed'/>
2271 4. As a result, the user's server (1) MUST initiate a roster push to
2272 all of the user's available resources that have requested the
2273 roster, containing a roster item for the contact with the
2274 'subscription' attribute set to a value of "both"; (2) MUST route
2275 the presence stanza of type "subscribed" to the contact, first
2276 stamping the 'from' address as the bare JID (<user@example.com>)
2277 of the user; and (3) MUST send to the contact the full XML of the
2278 last presence stanza with no 'to' attribute received by the
2279 server from each of the user's available resources (subject to
2280 privacy lists in force for each session):
2283 <query xmlns='jabber:iq:roster'>
2285 jid='contact@example.org'
2288 <group>MyBuddies</group>
2295 Saint-Andre (ed.) Expires September 19, 2004 [Page 41]
2297 Internet-Draft XMPP IM March 2004
2301 from='user@example.com'
2302 to='contact@example.org'
2306 from='user@example.com/resource'
2307 to='contact@example.org'/>
2309 Note: If the user's server receives a presence stanza of type
2310 "error" from the contact's server, it MUST deliver the error
2311 stanza to the user, whose client MAY determine that the error is
2312 in response to the outgoing presence stanza of type "subscribed"
2313 it sent previously (e.g., by tracking an 'id' attribute) and then
2314 choose to resend the subscription request or revert the roster to
2315 its previous state by sending a presence stanza of type
2316 "unsubscribed" to the contact.
2318 5. Upon receiving the presence stanza of type "subscribed" addressed
2319 to the contact, the contact's server MUST first verify that the
2320 user is in the contact's roster with either of the following
2321 states: (a) subscription='none' and ask='subscribe' or (b)
2322 subscription='from' and ask='subscribe'. If the user is not in
2323 the contact's roster with either of those states, the contact's
2324 server MUST silently ignore the presence stanza of type
2325 "subscribed" (i.e., it MUST NOT route it to the contact, modify
2326 the contact's roster, or generate a roster push to the contact's
2327 available resources). If the user is in the contact's roster
2328 with either of those states, the contact's server (1) MUST
2329 deliver the presence stanza of type "subscribed" from the user to
2330 the contact; (2) MUST initiate a roster push to all available
2331 resources associated with the contact that have requested the
2332 roster, containing an updated roster item for the user with the
2333 'subscription' attribute set to a value of "both"; and (3) MUST
2334 deliver the available presence stanza received from each of the
2335 user's available resources to each of the contact's available
2339 from='user@example.com'
2340 to='contact@example.org'
2344 <query xmlns='jabber:iq:roster'>
2346 jid='user@example.com'
2351 Saint-Andre (ed.) Expires September 19, 2004 [Page 42]
2353 Internet-Draft XMPP IM March 2004
2357 <group>SomeGroup</group>
2363 from='user@example.com/resource'
2364 to='contact@example.org/resource'/>
2366 6. Upon receiving the presence stanza of type "subscribed", the
2367 contact SHOULD acknowledge receipt of that subscription state
2368 notification through either "affirming" it by sending a presence
2369 stanza of type "subscribe" to the user or "denying" it by sending
2370 a presence stanza of type "unsubscribe" to the user; this step
2371 does not necessarily affect the subscription state (see
2372 Subscription States (Section 9) for details), but instead lets
2373 the contact's server know that it MUST no longer send
2374 notification of the subscription state change to the contact (see
2377 The user and the contact now have a mutual subscription to each
2378 other's presence -- i.e., the subscription is of type "both".
2380 8.3.1 Alternate Flow: User Declines Subscription Request
2382 The above activity flow represents the "happy path" regarding the
2383 contact's subscription request to the user. The main alternate flow
2384 occurs if the user refuses the contact's subscription request, as
2387 1. If the user wants to refuse the request, the user's client MUST
2388 send a presence stanza of type "unsubscribed" to the contact
2389 (instead of the presence stanza of type "subscribed" sent in Step
2392 <presence to='contact@example.org' type='unsubscribed'/>
2394 2. As a result, the user's server MUST route the presence stanza of
2395 type "unsubscribed" to the contact, first stamping the 'from'
2396 address as the bare JID (<user@example.com>) of the user:
2399 from='user@example.com'
2400 to='contact@example.org'
2401 type='unsubscribed'/>
2407 Saint-Andre (ed.) Expires September 19, 2004 [Page 43]
2409 Internet-Draft XMPP IM March 2004
2412 3. Upon receiving the presence stanza of type "unsubscribed"
2413 addressed to the contact, the contact's server (1) MUST deliver
2414 that presence stanza to the contact; and (2) MUST initiate a
2415 roster push to all available resources associated with the
2416 contact that have requested the roster, containing an updated
2417 roster item for the user with the 'subscription' attribute set to
2418 a value of "from" and with no 'ask' attribute:
2421 from='user@example.com'
2422 to='contact@example.org'
2423 type='unsubscribed'/>
2426 <query xmlns='jabber:iq:roster'>
2428 jid='user@example.com'
2431 <group>SomeGroup</group>
2436 4. Upon receiving the presence stanza of type "unsubscribed", the
2437 contact SHOULD acknowledge receipt of that subscription state
2438 notification through either "affirming" it by sending a presence
2439 stanza of type "unsubscribe" to the user or "denying" it by
2440 sending a presence stanza of type "subscribe" to the user; this
2441 step does not necessarily affect the subscription state (see
2442 Subscription States (Section 9) for details), but instead lets
2443 the contact's server know that it MUST no longer send
2444 notification of the subscription state change to the contact (see
2447 As a result of this activity, there has been no change in the
2448 subscription state; i.e., the contact is in the user's roster with a
2449 subscription state of "to" and the user is in the contact's roster
2450 with a subscription state of "from".
2454 At any time after subscribing to a contact's presence information, a
2455 user MAY unsubscribe. While the XML that the user sends to make this
2456 happen is the same in all instances, the subsequent subscription
2457 state is different depending on the subscription state obtaining when
2458 the unsubscribe "command" is sent. Both possible scenarios are
2463 Saint-Andre (ed.) Expires September 19, 2004 [Page 44]
2465 Internet-Draft XMPP IM March 2004
2468 8.4.1 Case #1: Unsubscribing When Subscription is Not Mutual
2470 In the first case, the user has a subscription to the contact's
2471 presence information but the contact does not have a subscription to
2472 the user's presence information (i.e., the subscription is not yet
2475 1. If the user wants to unsubscribe from the contact's presence
2476 information, the user MUST send a presence stanza of type
2477 "unsubscribe" to the contact:
2479 <presence to='contact@example.org' type='unsubscribe'/>
2481 2. As a result, the user's server (1) MUST send a roster push to all
2482 of the user's available resources that have requested the roster,
2483 containing an updated roster item for the contact with the
2484 'subscription' attribute set to a value of "none"; and (2) MUST
2485 route the presence stanza of type "unsubscribe" to the contact,
2486 first stamping the 'from' address as the bare JID
2487 (<user@example.com>) of the user:
2490 <query xmlns='jabber:iq:roster'>
2492 jid='contact@example.org'
2495 <group>MyBuddies</group>
2501 from='user@example.com'
2502 to='contact@example.org'
2503 type='unsubscribe'/>
2505 3. Upon receiving the presence stanza of type "unsubscribe"
2506 addressed to the contact, the contact's server (1) MUST initiate
2507 a roster push to all available resources associated with the
2508 contact that have requested the roster, containing an updated
2509 roster item for the user with the 'subscription' attribute set to
2510 a value of "none" (if the contact is unavailable or has not
2511 requested the roster, the contact's server MUST modify the roster
2512 item and send that modified item the next time the contact
2513 requests the roster); and (2) MUST deliver the "unsubscribe"
2514 state change notification to the contact:
2519 Saint-Andre (ed.) Expires September 19, 2004 [Page 45]
2521 Internet-Draft XMPP IM March 2004
2525 <query xmlns='jabber:iq:roster'>
2527 jid='user@example.com'
2530 <group>SomeGroup</group>
2536 from='user@example.com'
2537 to='contact@example.org'
2538 type='unsubscribe'/>
2540 4. Upon receiving the presence stanza of type "unsubscribe", the
2541 contact SHOULD acknowledge receipt of that subscription state
2542 notification through either "affirming" it by sending a presence
2543 stanza of type "unsubscribed" to the user or "denying" it by
2544 sending a presence stanza of type "subscribed" to the user; this
2545 step does not necessarily affect the subscription state (see
2546 Subscription States (Section 9) for details), but instead lets
2547 the contact's server know that it MUST no longer send
2548 notification of the subscription state change to the contact (see
2551 5. The contact's server then (1) MUST send a presence stanza of type
2552 "unsubscribed" to the user; and (2) SHOULD send unavailable
2553 presence from all of the contact's available resources to the
2557 from='contact@example.org'
2558 to='user@example.com'
2559 type='unsubscribed'/>
2562 from='contact@example.org/resource'
2563 to='user@example.com'
2564 type='unavailable'/>
2566 6. When the user's server receives the presence stanzas of type
2567 "unsubscribed" and "unavailable", it MUST deliver them to the
2571 from='contact@example.org'
2575 Saint-Andre (ed.) Expires September 19, 2004 [Page 46]
2577 Internet-Draft XMPP IM March 2004
2580 to='user@example.com'
2581 type='unsubscribed'/>
2584 from='contact@example.org/resource'
2585 to='user@example.com'
2586 type='unavailable'/>
2588 7. Upon receiving the presence stanza of type "unsubscribed", the
2589 user SHOULD acknowledge receipt of that subscription state
2590 notification through either "affirming" it by sending a presence
2591 stanza of type "unsubscribe" to the contact or "denying" it by
2592 sending a presence stanza of type "subscribe" to the contact;
2593 this step does not necessarily affect the subscription state (see
2594 Subscription States (Section 9) for details), but instead lets
2595 the user's server know that it MUST no longer send notification
2596 of the subscription state change to the user (see Section 9.4).
2599 8.4.2 Case #2: Unsubscribing When Subscription is Mutual
2601 In the second case, the user has a subscription to the contact's
2602 presence information and the contact also has a subscription to the
2603 user's presence information (i.e., the subscription is mutual).
2605 1. If the user wants to unsubscribe from the contact's presence
2606 information, the user MUST send a presence stanza of type
2607 "unsubscribe" to the contact:
2609 <presence to='contact@example.org' type='unsubscribe'/>
2611 2. As a result, the user's server (1) MUST send a roster push to all
2612 of the user's available resources that have requested the roster,
2613 containing an updated roster item for the contact with the
2614 'subscription' attribute set to a value of "from"; and (2) MUST
2615 route the presence stanza of type "unsubscribe" to the contact,
2616 first stamping the 'from' address as the bare JID
2617 (<user@example.com>) of the user:
2620 <query xmlns='jabber:iq:roster'>
2622 jid='contact@example.org'
2625 <group>MyBuddies</group>
2631 Saint-Andre (ed.) Expires September 19, 2004 [Page 47]
2633 Internet-Draft XMPP IM March 2004
2639 from='user@example.com'
2640 to='contact@example.org'
2641 type='unsubscribe'/>
2643 3. Upon receiving the presence stanza of type "unsubscribe"
2644 addressed to the contact, the contact's server (1) MUST initiate
2645 a roster push to all available resources associated with the
2646 contact that have requested the roster, containing an updated
2647 roster item for the user with the 'subscription' attribute set to
2648 a value of "to" (if the contact is unavailable or has not
2649 requested the roster, the contact's server MUST modify the roster
2650 item and send that modified item the next time the contact
2651 requests the roster); and (2) MUST deliver the "unsubscribe"
2652 state change notification to the contact:
2655 <query xmlns='jabber:iq:roster'>
2657 jid='user@example.com'
2660 <group>SomeGroup</group>
2666 from='user@example.com'
2667 to='contact@example.org'
2668 type='unsubscribe'/>
2670 4. Upon receiving the presence stanza of type "unsubscribe", the
2671 contact SHOULD acknowledge receipt of that subscription state
2672 notification through either "affirming" it by sending a presence
2673 stanza of type "unsubscribed" to the user or "denying" it by
2674 sending a presence stanza of type "subscribed" to the user; this
2675 step does not necessarily affect the subscription state (see
2676 Subscription States (Section 9) for details), but instead lets
2677 the contact's server know that it MUST no longer send
2678 notification of the subscription state change to the contact (see
2681 5. The contact's server then (1) MUST send a presence stanza of type
2682 "unsubscribed" to the user; and (2) SHOULD send unavailable
2683 presence from all of the contact's available resources to the
2687 Saint-Andre (ed.) Expires September 19, 2004 [Page 48]
2689 Internet-Draft XMPP IM March 2004
2695 from='contact@example.org'
2696 to='user@example.com'
2697 type='unsubscribed'/>
2700 from='contact@example.org/resource'
2701 to='user@example.com'
2702 type='unavailable'/>
2704 6. When the user's server receives the presence stanzas of type
2705 "unsubscribed" and "unavailable", it MUST deliver them to the
2709 from='contact@example.org'
2710 to='user@example.com'
2711 type='unsubscribed'/>
2714 from='contact@example.org/resource'
2715 to='user@example.com'
2716 type='unavailable'/>
2718 7. Upon receiving the presence stanza of type "unsubscribed", the
2719 user SHOULD acknowledge receipt of that subscription state
2720 notification through either "affirming" it by sending a presence
2721 stanza of type "unsubscribe" to the contact or "denying" it by
2722 sending a presence stanza of type "subscribe" to the contact;
2723 this step does not necessarily affect the subscription state (see
2724 Subscription States (Section 9) for details), but instead lets
2725 the user's server know that it MUST no longer send notification
2726 of the subscription state change to the user (see Section 9.4).
2728 Note: Obviously this does not result in removal of the roster item
2729 from the user's roster, and the contact still has a subscription to
2730 the user's presence information. In order to both completely cancel
2731 a mutual subscription and fully remove the roster item from the
2732 user's roster, the user SHOULD update the roster item with
2733 subscription='remove' as defined under Removing a Roster Item and
2734 Cancelling All Subscriptions (Section 8.6).
2736 8.5 Cancelling a Subscription
2738 At any time after approving a subscription request from a user, a
2739 contact MAY cancel that subscription. While the XML that the contact
2743 Saint-Andre (ed.) Expires September 19, 2004 [Page 49]
2745 Internet-Draft XMPP IM March 2004
2748 sends to make this happen is the same in all instances, the
2749 subsequent subscription state is different depending on the
2750 subscription state obtaining when the cancellation was sent. Both
2751 possible scenarios are described below.
2753 8.5.1 Case #1: Cancelling When Subscription is Not Mutual
2755 In the first case, the user has a subscription to the contact's
2756 presence information but the contact does not have a subscription to
2757 the user's presence information (i.e., the subscription is not yet
2760 1. If the contact wants to cancel the user's subscription, the
2761 contact MUST send a presence stanza of type "unsubscribed" to the
2764 <presence to='user@example.com' type='unsubscribed'/>
2766 2. As a result, the contact's server (1) MUST send a roster push to
2767 all of the contact's available resources that have requested the
2768 roster, containing an updated roster item for the user with the
2769 'subscription' attribute set to a value of "none"; (2) MUST route
2770 the presence stanza of type "unsubscribed" to the user, first
2771 stamping the 'from' address as the bare JID
2772 (<contact@example.org>) of the contact; and (3) SHOULD send
2773 unavailable presence from all of the contact's available
2774 resources to the user:
2777 <query xmlns='jabber:iq:roster'>
2779 jid='user@example.com'
2782 <group>SomeGroup</group>
2788 from='contact@example.org'
2789 to='user@example.com'
2790 type='unsubscribed'/>
2793 from='contact@example.org/resource'
2794 to='user@example.com'
2795 type='unavailable'/>
2799 Saint-Andre (ed.) Expires September 19, 2004 [Page 50]
2801 Internet-Draft XMPP IM March 2004
2804 3. Upon receiving the presence stanza of type "unsubscribed"
2805 addressed to the user, the user's server (1) MUST initiate a
2806 roster push to all of the user's available resources that have
2807 requested the roster, containing an updated roster item for the
2808 contact with the 'subscription' attribute set to a value of
2809 "none" (if the user is unavailable or has not requested the
2810 roster, the user's server MUST modify the roster item and send
2811 that modified item the next time the user requests the roster);
2812 (2) MUST deliver the "unsubscribed" state change notification to
2813 all of the user's available resources; and (3) MUST deliver the
2814 unavailable presence to all of the user's available resources:
2817 <query xmlns='jabber:iq:roster'>
2819 jid='contact@example.org'
2822 <group>MyBuddies</group>
2828 from='contact@example.org'
2829 to='user@example.com'
2830 type='unsubscribed'/>
2833 from='contact@example.org/resource'
2834 to='user@example.com'
2835 type='unavailable'/>
2837 4. Upon receiving the presence stanza of type "unsubscribed", the
2838 user SHOULD acknowledge receipt of that subscription state
2839 notification through either "affirming" it by sending a presence
2840 stanza of type "unsubscribe" to the contact or "denying" it by
2841 sending a presence stanza of type "subscribe" to the contact;
2842 this step does not necessarily affect the subscription state (see
2843 Subscription States (Section 9) for details), but instead lets
2844 the user's server know that it MUST no longer send notification
2845 of the subscription state change to the user (see Section 9.4).
2848 8.5.2 Case #2: Cancelling When Subscription is Mutual
2850 In the second case, the user has a subscription to the contact's
2851 presence information and the contact also has a subscription to the
2855 Saint-Andre (ed.) Expires September 19, 2004 [Page 51]
2857 Internet-Draft XMPP IM March 2004
2860 user's presence information (i.e., the subscription is mutual).
2862 1. If the contact wants to cancel the user's subscription, the
2863 contact MUST send a presence stanza of type "unsubscribed" to the
2866 <presence to='user@example.com' type='unsubscribed'/>
2868 2. As a result, the contact's server (1) MUST send a roster push to
2869 all of the contact's available resources that have requested the
2870 roster, containing an updated roster item for the user with the
2871 'subscription' attribute set to a value of "to"; (2) MUST route
2872 the presence stanza of type "unsubscribed" to the user, first
2873 stamping the 'from' address as the bare JID
2874 (<contact@example.org>) of the contact; and (3) SHOULD send
2875 unavailable presence from all of the contact's available
2876 resources to all of the user's available resources:
2879 <query xmlns='jabber:iq:roster'>
2881 jid='user@example.com'
2884 <group>SomeGroup</group>
2890 from='contact@example.org'
2891 to='user@example.com'
2892 type='unsubscribed'/>
2895 from='contact@example.org/resource'
2896 to='user@example.com'
2897 type='unavailable'/>
2899 3. Upon receiving the presence stanza of type "unsubscribed"
2900 addressed to the user, the user's server (1) MUST initiate a
2901 roster push to all of the user's available resources that have
2902 requested the roster, containing an updated roster item for the
2903 contact with the 'subscription' attribute set to a value of
2904 "from" (if the user is unavailable or has not requested the
2905 roster, the user's server MUST modify the roster item and send
2906 that modified item the next time the user requests the roster);
2907 and (2) MUST deliver the "unsubscribed" state change notification
2911 Saint-Andre (ed.) Expires September 19, 2004 [Page 52]
2913 Internet-Draft XMPP IM March 2004
2916 to all of the user's available resources; and (3) MUST deliver
2917 the unavailable presence to all of the user's available
2921 <query xmlns='jabber:iq:roster'>
2923 jid='contact@example.org'
2926 <group>MyBuddies</group>
2932 from='contact@example.org'
2933 to='user@example.com'
2934 type='unsubscribed'/>
2937 from='contact@example.org/resource'
2938 to='user@example.com'
2939 type='unavailable'/>
2941 4. Upon receiving the presence stanza of type "unsubscribed", the
2942 user SHOULD acknowledge receipt of that subscription state
2943 notification through either "affirming" it by sending a presence
2944 stanza of type "unsubscribe" to the contact or "denying" it by
2945 sending a presence stanza of type "subscribe" to the contact;
2946 this step does not necessarily affect the subscription state (see
2947 Subscription States (Section 9) for details), but instead lets
2948 the user's server know that it MUST no longer send notification
2949 of the subscription state change to the user (see Section 9.4).
2951 Note: Obviously this does not result in removal of the roster item
2952 from the contact's roster, and the contact still has a subscription
2953 to the user's presence information. In order to both completely
2954 cancel a mutual subscription and fully remove the roster item from
2955 the contact's roster, the contact should update the roster item with
2956 subscription='remove' as defined under Removing a Roster Item and
2957 Cancelling All Subscriptions (Section 8.6).
2959 8.6 Removing a Roster Item and Cancelling All Subscriptions
2961 Because there may be many steps involved in completely removing a
2962 roster item and cancelling subscriptions in both directions, the
2963 roster management protocol includes a "shortcut" method for doing so.
2967 Saint-Andre (ed.) Expires September 19, 2004 [Page 53]
2969 Internet-Draft XMPP IM March 2004
2972 The process may be initiated no matter what the current subscription
2973 state is by sending a roster set containing an item for the contact
2974 with the 'subscription' attribute set to a value of "remove":
2976 <iq type='set' id='remove1'>
2977 <query xmlns='jabber:iq:roster'>
2979 jid='contact@example.org'
2980 subscription='remove'/>
2984 When the user removes a contact from his or her roster by setting the
2985 'subscription' attribute to a value of "remove", the user's server
2986 (1) MUST automatically cancel any existing presence subscription
2987 between the user and the contact (both 'to' and 'from' as
2988 appropriate); (2) MUST remove the roster item from the user's roster
2989 and inform all of the user's available resources that have requested
2990 the roster of the roster item removal; (3) MUST inform the resource
2991 that initiated the removal of success; and (4) SHOULD send
2992 unavailable presence from all of the user's available resources to
2996 from='user@example.com'
2997 to='contact@example.org'
2998 type='unsubscribe'/>
3001 from='user@example.com'
3002 to='contact@example.org'
3003 type='unsubscribed'/>
3006 <query xmlns='jabber:iq:roster'>
3008 jid='contact@example.org'
3009 subscription='remove'/>
3013 <iq type='result' id='remove1'/>
3016 from='user@example.com/resource'
3017 to='contact@example.org'
3018 type='unavailable'/>
3023 Saint-Andre (ed.) Expires September 19, 2004 [Page 54]
3025 Internet-Draft XMPP IM March 2004
3028 Upon receiving the presence stanza of type "unsubscribe", the
3029 contact's server (1) MUST initiate a roster push to all available
3030 resources associated with the contact that have requested the roster,
3031 containing an updated roster item for the user with the
3032 'subscription' attribute set to a value of "to" (if the contact is
3033 unavailable or has not requested the roster, the contact's server
3034 MUST modify the roster item and send that modified item the next time
3035 the contact requests the roster); and (2) MUST also deliver the
3036 "unsubscribe" state change notification to all of the contact's
3037 available resources:
3040 <query xmlns='jabber:iq:roster'>
3042 jid='user@example.com'
3045 <group>SomeGroup</group>
3051 from='user@example.com'
3052 to='contact@example.org'
3053 type='unsubscribe'/>
3055 Upon receiving the presence stanza of type "unsubscribed", the
3056 contact's server (1) MUST initiate a roster push to all available
3057 resources associated with the contact that have requested the roster,
3058 containing an updated roster item for the user with the
3059 'subscription' attribute set to a value of "none" (if the contact is
3060 unavailable or has not requested the roster, the contact's server
3061 MUST modify the roster item and send that modified item the next time
3062 the contact requests the roster); and (2) MUST also deliver the
3063 "unsubscribe" state change notification to all of the contact's
3064 available resources:
3067 <query xmlns='jabber:iq:roster'>
3069 jid='user@example.com'
3072 <group>SomeGroup</group>
3079 Saint-Andre (ed.) Expires September 19, 2004 [Page 55]
3081 Internet-Draft XMPP IM March 2004
3085 from='user@example.com'
3086 to='contact@example.org'
3087 type='unsubscribed'/>
3089 Upon receiving the presence stanza of type "unavailable" addressed to
3090 the contact, the contact's server MUST deliver the unavailable
3091 presence to all of the user's available resources:
3094 from='user@example.com/resource'
3095 to='contact@example.org'
3096 type='unavailable'/>
3098 Note: When the user removes the contact from the user's roster, the
3099 end state of the contact's roster is that the user is still in the
3100 contact's roster with a subscription state of "none"; in order to
3101 completely remove the roster item for the user, the contact needs to
3102 also send a roster removal request.
3104 9. Subscription States
3106 This section provides detailed information about subscription states
3107 and server handling of subscription-related presence stanzas (i.e.,
3108 presence stanzas of type "subscribe", "subscribed", "unsubscribe",
3109 and "unsubscribed").
3113 There are nine possible subscription states, which are described here
3114 from the user's (not contact's) perspective:
3116 1. "None" = contact and user are not subscribed to each other, and
3117 neither has requested a subscription from the other
3119 2. "None + Pending Out" = contact and user are not subscribed to
3120 each other, and user has sent contact a subscription request but
3121 contact has not replied yet
3123 3. "None + Pending In" = contact and user are not subscribed to each
3124 other, and contact has sent user a subscription request but user
3125 has not replied yet (note: contact's server SHOULD NOT push or
3126 deliver roster items in this state, but instead SHOULD wait until
3127 contact has approved subscription request from user)
3129 4. "None + Pending Out/In" = contact and user are not subscribed to
3130 each other, contact has sent user a subscription request but user
3131 has not replied yet, and user has sent contact a subscription
3135 Saint-Andre (ed.) Expires September 19, 2004 [Page 56]
3137 Internet-Draft XMPP IM March 2004
3140 request but contact has not replied yet
3142 5. "To" = user is subscribed to contact (one-way)
3144 6. "To + Pending In" = user is subscribed to contact, and contact
3145 has sent user a subscription request but user has not replied yet
3147 7. "From" = contact is subscribed to user (one-way)
3149 8. "From + Pending Out" = contact is subscribed to user, and user
3150 has sent contact a subscription request but contact has not
3153 9. "Both" = user and contact are subscribed to each other (two-way)
3156 9.2 Server Handling of Outbound Presence Subscription Stanzas
3158 Outbound presence subscription stanzas enable the user to manage his
3159 or her subscription to the contact's presence information (via the
3160 "subscribe" and "unsubscribe" types), and to manage the contact's
3161 access to the user's presence information (via the "subscribed" and
3162 "unsubscribed" types).
3164 Because it is possible for the user's server and the contact's server
3165 to lose synchronization regarding subscription states, the user's
3166 server MUST without exception route all outbound presence stanzas of
3167 type "subscribe" or "unsubscribe" to the contact so that the user is
3168 able to resynchronize his or her subscription to the contact's
3169 presence information if needed.
3171 The user's server SHOULD NOT route a presence stanza of type
3172 "subscribed" or "unsubscribed" to the contact if the stanza does not
3173 result in a subscription state change from the user's perspective,
3174 and MUST NOT make a state change. If the stanza results in a
3175 subscription state change, the user's server MUST route the stanza to
3176 the contact and MUST make the appropriate state change. These rules
3177 are summarized in the following tables.
3179 Table 1: Recommended handling of outbound "subscribed" stanzas
3181 +----------------------------------------------------------------+
3182 | EXISTING STATE | ROUTE? | NEW STATE |
3183 +----------------------------------------------------------------+
3184 | "None" | no | no state change |
3185 | "None + Pending Out" | no | no state change |
3186 | "None + Pending In" | yes | "From" |
3187 | "None + Pending Out/In" | yes | "From + Pending Out" |
3191 Saint-Andre (ed.) Expires September 19, 2004 [Page 57]
3193 Internet-Draft XMPP IM March 2004
3196 | "To" | no | no state change |
3197 | "To + Pending In" | yes | "Both" |
3198 | "From" | no | no state change |
3199 | "From + Pending Out" | no | no state change |
3200 | "Both" | no | no state change |
3201 +----------------------------------------------------------------+
3203 Table 2: Recommended handling of outbound "unsubscribed" stanzas
3205 +----------------------------------------------------------------+
3206 | EXISTING STATE | ROUTE? | NEW STATE |
3207 +----------------------------------------------------------------+
3208 | "None" | no | no state change |
3209 | "None + Pending Out" | no | no state change |
3210 | "None + Pending In" | yes | "None" |
3211 | "None + Pending Out/In" | yes | "None + Pending Out" |
3212 | "To" | no | no state change |
3213 | "To + Pending In" | yes | "To" |
3214 | "From" | yes | "None" |
3215 | "From + Pending Out" | yes | "None + Pending Out" |
3216 | "Both" | yes | "To" |
3217 +----------------------------------------------------------------+
3220 9.3 Server Handling of Inbound Presence Subscription Stanzas
3222 Inbound presence subscription stanzas request a subscription-related
3223 action from the user (via the "subscribe" type), inform the user of
3224 subscription-related actions taken by the contact (via the
3225 "unsubscribe" type), or enable the contact to manage the user's
3226 access to the contact's presence information (via the "subscribed"
3227 and "unsubscribed" types).
3229 When the user's server receives a subscription request for the user
3230 from the contact (i.e., a presence stanza of type "subscribe"), it
3231 MUST deliver that request to the user for approval if the user has
3232 not already granted the contact access to the user's presence
3233 information and if there is no pending inbound subscription request;
3234 however, the user's server SHOULD NOT deliver the new request if
3235 there is a pending inbound subscription request, since the previous
3236 subscription request will have been recorded. If the user has
3237 already granted the contact access to the user's presence
3238 information, the user's server SHOULD auto-reply to an inbound
3239 presense stanza of type "subscribe" from the contact by sending a
3240 presence stanza of type "subscribed" to the contact on behalf of the
3241 user; this rule enables the contact to resynchronize the subscription
3242 state if needed. These rules are summarized in the following table.
3247 Saint-Andre (ed.) Expires September 19, 2004 [Page 58]
3249 Internet-Draft XMPP IM March 2004
3252 Table 3: Recommended handling of inbound "subscribe" stanzas
3254 +------------------------------------------------------------------+
3255 | EXISTING STATE | DELIVER? | NEW STATE |
3256 +------------------------------------------------------------------+
3257 | "None" | yes | "None + Pending In" |
3258 | "None + Pending Out" | yes | "None + Pending Out/In" |
3259 | "None + Pending In" | no | no state change |
3260 | "None + Pending Out/In" | no | no state change |
3261 | "To" | yes | "To + Pending In" |
3262 | "To + Pending In" | no | no state change |
3263 | "From" | no * | no state change |
3264 | "From + Pending Out" | no * | no state change |
3265 | "Both" | no * | no state change |
3266 +------------------------------------------------------------------+
3268 * Server SHOULD auto-reply with "subscribed" stanza
3270 When the user's server receives a presence stanza of type
3271 "unsubscribe" for the user from the contact, if the stanza results in
3272 a subscription state change from the user's perspective then the
3273 user's server SHOULD auto-reply by sending a presence stanza of type
3274 "unsubscribed" to the contact on behalf of the user, MUST deliver the
3275 "unsubscribe" stanza to the user, and MUST change the state. If no
3276 subscription state change results, the user's server SHOULD NOT
3277 deliver the stanza and MUST NOT change the state. These rules are
3278 summarized in the following table.
3280 Table 4: Recommended handling of inbound "unsubscribe" stanzas
3282 +------------------------------------------------------------------+
3283 | EXISTING STATE | DELIVER? | NEW STATE |
3284 +------------------------------------------------------------------+
3285 | "None" | no | no state change |
3286 | "None + Pending Out" | no | no state change |
3287 | "None + Pending In" | yes * | "None" |
3288 | "None + Pending Out/In" | yes * | "None + Pending Out" |
3289 | "To" | no | no state change |
3290 | "To + Pending In" | yes * | "To" |
3291 | "From" | yes * | "None" |
3292 | "From + Pending Out" | yes * | "None + Pending Out |
3293 | "Both" | yes * | "To" |
3294 +------------------------------------------------------------------+
3296 * Server SHOULD auto-reply with "unsubscribed" stanza
3298 When the user's server receives a presence stanza of type
3299 "subscribed" for the user from the contact, it MUST NOT deliver the
3303 Saint-Andre (ed.) Expires September 19, 2004 [Page 59]
3305 Internet-Draft XMPP IM March 2004
3308 stanza to the user and MUST NOT change the subscription state if
3309 there is no pending outbound request for access to the contact's
3310 presence information. If there is a pending outbound request for
3311 access to the contact's presence information and the inbound presence
3312 stanza of type "subscribed" results in a subscription state change,
3313 the user's server MUST deliver the stanza to the user and MUST change
3314 the subscription state. If the user already has access to the
3315 contact's presence information, the inbound presence stanza of type
3316 "subscribed" does not result in a subscription state change;
3317 therefore the user's server SHOULD NOT deliver the stanza to the user
3318 and MUST NOT change the subscription state. These rules are
3319 summarized in the following table.
3321 Table 5: Recommended handling of inbound "subscribed" stanzas
3323 +------------------------------------------------------------------+
3324 | EXISTING STATE | DELIVER? | NEW STATE |
3325 +------------------------------------------------------------------+
3326 | "None" | no | no state change |
3327 | "None + Pending Out" | yes | "To" |
3328 | "None + Pending In" | no | no state change |
3329 | "None + Pending Out/In" | yes | "To + Pending In" |
3330 | "To" | no | no state change |
3331 | "To + Pending In" | no | no state change |
3332 | "From" | no | no state change |
3333 | "From + Pending Out" | yes | "Both" |
3334 | "Both" | no | no state change |
3335 +------------------------------------------------------------------+
3337 When the user's server receives a presence stanza of type
3338 "unsubscribed" for the user from the contact, it MUST deliver the
3339 stanza to the user and MUST change the subscription state if there is
3340 a pending outbound request for access to the contact's presence
3341 information or if the user currently has access to the contact's
3342 presence information. Otherwise, the user's server SHOULD NOT
3343 deliver the stanza and MUST NOT change the subscription state. These
3344 rules are summarized in the following table.
3346 Table 6: Recommended handling of inbound "unsubscribed" stanzas
3348 +------------------------------------------------------------------+
3349 | EXISTING STATE | DELIVER? | NEW STATE |
3350 +------------------------------------------------------------------+
3351 | "None" | no | no state change |
3352 | "None + Pending Out" | yes | "None" |
3353 | "None + Pending In" | no | no state change |
3354 | "None + Pending Out/In" | yes | "None + Pending In" |
3355 | "To" | yes | "None" |
3359 Saint-Andre (ed.) Expires September 19, 2004 [Page 60]
3361 Internet-Draft XMPP IM March 2004
3364 | "To + Pending In" | yes | "None + Pending In" |
3365 | "From" | no | no state change |
3366 | "From + Pending Out" | yes | "From" |
3367 | "Both" | yes | "From" |
3368 +------------------------------------------------------------------+
3371 9.4 Server Delivery and Client Acknowledgement of Subscription Requests
3372 and State Change Notifications
3374 When a server receives an inbound presence stanza of type "subscribe"
3375 (i.e., a subscription request) or of type "subscribed",
3376 "unsubscribe", or "unsubscribed" (i.e., a subscription state change
3377 notification), in addition to sending the appropriate roster push (or
3378 updated roster when the roster is next requested by an available
3379 resource), it MUST deliver the request or notification to the
3380 intended recipient at least once. A server MAY require the recipient
3381 to acknowledge receipt of all state change notifications (and MUST
3382 require acknowledgement in the case of subscription requests, i.e.,
3383 presence stanzas of type "subscribe"). In order to require
3384 acknowledgement, a server SHOULD send the request or notification to
3385 the recipient each time the recipient logs in, until the recipient
3386 acknowledges receipt of the notification by "affirming" or "denying"
3387 the notification, as shown in the following table:
3389 Table 7: Acknowledgement of subscription state change notifications
3391 +--------------------------------------------------+
3392 | STANZA TYPE | ACCEPT | DENY |
3393 +--------------------------------------------------+
3394 | subscribe | subscribed | unsubscribed |
3395 | subscribed | subscribe | unsubscribe |
3396 | unsubscribe | unsubscribed | subscribed |
3397 | unsubscribed | unsubscribe | subscribe |
3398 +--------------------------------------------------+
3400 Obviously, given the foregoing subscription state charts, some of the
3401 acknowledgement stanzas will be routed to the contact and result in
3402 subscription state changes, while others will not. However, any such
3403 stanzas MUST result in the server's no longer sending the
3404 subscription state notification to the user.
3406 Because a user's server MUST automatically generate outbound presence
3407 stanzas of type "unsubscribe" and "unsubscribed" upon receiving a
3408 roster set with the 'subscription' attribute set to a value of
3409 "remove" (see Removing a Roster Item and Cancelling All Subscriptions
3410 (Section 8.6)), the server MUST treat a roster remove request as
3411 equivalent to sending both of those presence stanzas for purposes of
3415 Saint-Andre (ed.) Expires September 19, 2004 [Page 61]
3417 Internet-Draft XMPP IM March 2004
3420 determining whether to continue sending subscription state change
3421 notifications of type "subscribe" or "subscribed" to the user.
3423 10. Blocking Communication
3425 Most instant messaging systems have found it necessary to implement
3426 some method for users to block communications from particular other
3427 users (this is also required by sections 5.1.5, 5.1.15, 5.3.2, and
3428 5.4.10 of [IMP-REQS]). In XMPP this is done by managing one's
3429 privacy lists using the 'jabber:iq:privacy' namespace.
3431 Server-side privacy lists enable successful completion of the
3432 following use cases:
3434 o Retrieving one's privacy lists.
3436 o Adding, removing, and editing one's privacy lists.
3438 o Setting, changing, or declining active lists.
3440 o Setting, changing, or declining the default list (i.e., the list
3441 that is active by default).
3443 o Allowing or blocking messages based on JID, group, or subscription
3446 o Allowing or blocking inbound presence notifications based on JID,
3447 group, or subscription type (or globally).
3449 o Allowing or blocking outbound presence notifications based on JID,
3450 group, or subscription type (or globally).
3452 o Allowing or blocking IQ stanzas based on JID, group, or
3453 subscription type (or globally).
3455 o Allowing or blocking all communications based on JID, group, or
3456 subscription type (or globally).
3458 Note: Presence notifications do not include presence subscriptions,
3459 only presence information that is broadcasted to entities that are
3460 subscribed to a user's presence information. Thus this includes
3461 presence stanzas with no 'type' attribute or of type='unavailable'
3464 10.1 Syntax and Semantics
3466 A user MAY define one or more privacy lists, which are stored by the
3467 user's server. Each <list/> element contains one or more rules in
3471 Saint-Andre (ed.) Expires September 19, 2004 [Page 62]
3473 Internet-Draft XMPP IM March 2004
3476 the form of <item/> elements, and each <item/> element uses
3477 attributes to define a privacy rule type, a specific value to which
3478 the rule applies, the relevant action, and the place of the item in
3479 the processing order.
3481 The syntax is as follows:
3484 <query xmlns='jabber:iq:privacy'>
3487 type='[jid|group|subscription]'
3489 action='[allow|deny]'
3490 order='unsignedInt'>
3500 If the type is "jid", then the 'value' attribute MUST contain a valid
3501 Jabber ID. JIDs SHOULD be matched in the following order:
3503 1. <user@domain/resource> (only that resource matches)
3505 2. <user@domain> (any resource matches)
3507 3. <domain/resource> (only that resource matches)
3509 4. <domain> (the domain itself matches, as does any user@domain,
3510 domain/resource, or address containing a subdomain)
3512 If the type is "group", then the 'value' attribute SHOULD contain the
3513 name of a group in the user's roster. (If a client attempts to
3514 update, create, or delete a list item with a group that is not in the
3515 user's roster, the server SHOULD return to the client an
3516 <item-not-found/> stanza error.)
3518 If the type is "subscription", then the 'value' attribute MUST be one
3519 of "both", "to", "from", or "none" as defined under Roster Syntax and
3520 Semantics (Section 7.1), where "none" includes entities that are
3521 totally unknown to the user and therefore not in the user's roster at
3527 Saint-Andre (ed.) Expires September 19, 2004 [Page 63]
3529 Internet-Draft XMPP IM March 2004
3532 If no 'type' attribute is included, the rule provides the
3533 "fall-through" case.
3535 The 'action' attribute MUST be included and its value MUST be either
3538 The 'order' attribute MUST be included and its value MUST be a
3539 non-negative integer that is unique among all items in the list. (If
3540 a client attempts to create or update a list with non-unique order
3541 values, the server MUST return to the client a <bad-request/> stanza
3544 The <item/> element MAY contain one or more child elements that
3545 enable an entity to specify more granular control over which kinds of
3546 stanzas are to be blocked (i.e., rather than blocking all stanzas).
3547 The allowable child elements are:
3549 o <message/> -- blocks incoming message stanzas
3551 o <iq/> -- blocks incoming IQ stanzas
3553 o <presence-in/> -- blocks incoming presence notifications
3555 o <presence-out/> -- blocks outgoing presence notifications
3557 Within the 'jabber:iq:privacy' namespace, the <query/> child of an IQ
3558 stanza of type "set" MUST NOT include more than one child element
3559 (i.e., the stanza MUST contain only one <active/> element, one
3560 <default/> element, or one <list/> element); if a sending entity
3561 violates this rule, the receiving entity MUST return a <bad-request/>
3564 When a client adds or updates a privacy list, the <list/> element
3565 SHOULD contain at least one <item/> child element; when a client
3566 removes a privacy list, the <list/> element MUST NOT contain any
3567 <item/> child elements.
3569 When a client updates a privacy list, it must include all of the
3570 desired items (i.e., not a "delta").
3574 1. If there is an active list set for a session, it affects only
3575 the session(s) for which it is activated, and only for the
3576 duration of the session(s); the server MUST apply the active
3577 list only and MUST NOT apply the default list (i.e., there is no
3578 "layering" of lists).
3583 Saint-Andre (ed.) Expires September 19, 2004 [Page 64]
3585 Internet-Draft XMPP IM March 2004
3588 2. The default list applies to the user as a whole, and is
3589 processed if there is no active list set for the target session/
3590 resource to which a stanza is addressed, or if there are no
3591 current sessions for the user.
3593 3. If there is no active list set for a session (or there are no
3594 current sessions for the user), and there is no default list,
3595 then all stanzas SHOULD BE accepted or appropriately processed
3596 by the server on behalf of the user in accordance with the
3597 Server Rules for Handling XML Stanzas (Section 11).
3599 4. Privacy lists MUST be the first delivery rule applied by a
3600 server, superseding (1) the routing and delivery rules specified
3601 in Server Rules for Handling XML Stanzas (Section 11), and (2)
3602 the handling of subscription-related presence stanzas (and
3603 corresponding generation of roster pushes) specified in
3604 Integration of Roster Items and Presence Subscriptions (Section
3607 5. The order in which privacy list items are processed by the
3608 server is important. List items MUST be processed in ascending
3609 order determined by the integer values of the 'order' attribute
3612 6. As soon as a stanza is matched against a privacy list rule, the
3613 server MUST appropriately handle the stanza in accordance with
3614 the rule and cease processing.
3616 7. If no fall-through item is provided in a list, the fall-through
3617 action is assumed to be "allow".
3619 8. If a user updates the definition for an active list, subsequent
3620 processing based on that active list MUST use the updated
3621 definition (for all resources to which that active list
3624 9. If a change to the subscription state or roster group of a
3625 roster item defined in an active or default list occurs during a
3626 user's session, subsequent processing based on that list MUST
3627 take into account the changed state or group (for all resources
3628 to which that list currently applies).
3630 10. When the definition for a rule is modified, the server MUST send
3631 an IQ stanza of type "set" to all connected resources,
3632 containing a <query/> element with only one <list/> child
3633 element, where the 'name' attribute is set to the name of the
3634 modified privacy list. These "privacy list pushes" adhere to
3635 the same semantics as the "roster pushes" used in roster
3639 Saint-Andre (ed.) Expires September 19, 2004 [Page 65]
3641 Internet-Draft XMPP IM March 2004
3644 management, except that only the list name itself (not the full
3645 list definition or the "delta") is pushed to the connected
3646 resources. It is up to the receiving resource to determine
3647 whether to retrieve the modified list definition, although a
3648 connected resource SHOULD do so if the list currently applies to
3651 11. When a resource attempts to remove a list or specify a new
3652 default list while that list applies to a connected resource
3653 other than the sending resource, the server MUST return a
3654 <conflict/> error to the sending resource and MUST NOT make the
3658 10.3 Retrieving One's Privacy Lists
3660 Example: Client requests names of privacy lists from server:
3662 <iq from='romeo@example.net/orchard' type='get' id='getlist1'>
3663 <query xmlns='jabber:iq:privacy'/>
3666 Example: Server sends names of privacy lists to client, preceded by
3667 active list and default list:
3669 <iq type='result' id='getlist1' to='romeo@example.net/orchard'>
3670 <query xmlns='jabber:iq:privacy'>
3671 <active name='private'/>
3672 <default name='public'/>
3673 <list name='public'/>
3674 <list name='private'/>
3675 <list name='special'/>
3679 Example: Client requests a privacy list from server:
3681 <iq from='romeo@example.net/orchard' type='get' id='getlist2'>
3682 <query xmlns='jabber:iq:privacy'>
3683 <list name='public'/>
3687 Example: Server sends a privacy list to client:
3689 <iq type='result' id='getlist2' to='romeo@example.net/orchard'>
3690 <query xmlns='jabber:iq:privacy'>
3691 <list name='public'>
3695 Saint-Andre (ed.) Expires September 19, 2004 [Page 66]
3697 Internet-Draft XMPP IM March 2004
3701 value='tybalt@example.com'
3704 <item action='allow' order='2'/>
3709 Example: Client requests another privacy list from server:
3711 <iq from='romeo@example.net/orchard' type='get' id='getlist3'>
3712 <query xmlns='jabber:iq:privacy'>
3713 <list name='private'/>
3717 Example: Server sends another privacy list to client:
3719 <iq type='result' id='getlist3' to='romeo@example.net/orchard'>
3720 <query xmlns='jabber:iq:privacy'>
3721 <list name='private'>
3722 <item type='subscription'
3726 <item action='deny' order='15'/>
3731 Example: Client requests yet another privacy list from server:
3733 <iq from='romeo@example.net/orchard' type='get' id='getlist4'>
3734 <query xmlns='jabber:iq:privacy'>
3735 <list name='special'/>
3739 Example: Server sends yet another privacy list to client:
3741 <iq type='result' id='getlist4' to='romeo@example.net/orchard'>
3742 <query xmlns='jabber:iq:privacy'>
3743 <list name='special'>
3745 value='juliet@example.com'
3751 Saint-Andre (ed.) Expires September 19, 2004 [Page 67]
3753 Internet-Draft XMPP IM March 2004
3757 value='benvolio@example.org'
3761 value='mercutio@example.org'
3764 <item action='deny' order='666'/>
3769 In this example, the user has three lists: (1) 'public', which allows
3770 communications from everyone except one specific entity (this is the
3771 default list); (2) 'private', which allows communications only with
3772 contacts who have a bidirectional subscription with the user (this is
3773 the active list); and (3) 'special', which allows communications only
3774 with three specific entities.
3776 If the user attempts to retrieve a list but a list by that name does
3777 not exist, the server MUST return an <item-not-found/> stanza error
3780 Example: Client attempts to retrieve non-existent list:
3782 <iq to='romeo@example.net/orchard' type='error' id='getlist5'>
3783 <query xmlns='jabber:iq:privacy'>
3784 <list name='The Empty Set'/>
3786 <error type='cancel'>
3788 xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
3792 The user is allowed to retrieve only one list at a time. If the user
3793 attempts to retrieve more than one list in the same request, the
3794 server MUST return a <bad request/> stanza error to the user:
3796 Example: Client attempts to retrieve more than one list:
3798 <iq to='romeo@example.net/orchard' type='error' id='getlist6'>
3799 <query xmlns='jabber:iq:privacy'>
3800 <list name='public'/>
3801 <list name='private'/>
3802 <list name='special'/>
3807 Saint-Andre (ed.) Expires September 19, 2004 [Page 68]
3809 Internet-Draft XMPP IM March 2004
3812 <error type='modify'>
3814 xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
3819 10.4 Managing Active Lists
3821 In order to set or change the active list currently being applied by
3822 the server, the user MUST send an IQ stanza of type "set" with a
3823 <query/> element qualified by the 'jabber:iq:privacy' namespace that
3824 contains an empty <active/> child element possessing a 'name'
3825 attribute whose value is set to the desired list name.
3827 Example: Client requests change of active list:
3829 <iq from='romeo@example.net/orchard' type='set' id='active1'>
3830 <query xmlns='jabber:iq:privacy'>
3831 <active name='special'/>
3835 The server MUST activate and apply the requested list before sending
3836 the result back to the client.
3838 Example: Server acknowledges success of active list change:
3840 <iq type='result' id='active1' to='romeo@example.net/orchard'/>
3842 If the user attempts to set an active list but a list by that name
3843 does not exist, the server MUST return an <item-not-found/> stanza
3846 Example: Client attempts to set a non-existent list as active:
3848 <iq to='romeo@example.net/orchard' type='error' id='active2'>
3849 <query xmlns='jabber:iq:privacy'>
3850 <active name='The Empty Set'/>
3852 <error type='cancel'>
3854 xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
3858 In order to decline the use of any active list, the connected
3859 resource MUST send an empty <active/> element with no 'name'
3863 Saint-Andre (ed.) Expires September 19, 2004 [Page 69]
3865 Internet-Draft XMPP IM March 2004
3870 Example: Client declines the use of active lists:
3872 <iq from='romeo@example.net/orchard' type='set' id='active3'>
3873 <query xmlns='jabber:iq:privacy'>
3878 Example: Server acknowledges success of declining any active list:
3880 <iq type='result' id='active3' to='romeo@example.net/orchard'/>
3883 10.5 Managing the Default List
3885 In order to change its default list (which applies to the user as a
3886 whole, not only the sending resource), the user MUST send an IQ
3887 stanza of type "set" with a <query/> element qualified by the
3888 'jabber:iq:privacy' namespace that contains an empty <default/> child
3889 element possessing a 'name' attribute whose value is set to the
3892 Example: User requests change of default list:
3894 <iq from='romeo@example.net/orchard' type='set' id='default1'>
3895 <query xmlns='jabber:iq:privacy'>
3896 <default name='special'/>
3900 Example: Server acknowledges success of default list change:
3902 <iq type='result' id='default1' to='romeo@example.net/orchard'/>
3904 If the user attempts to change which list is the default list but the
3905 default list is in use by at least one connected resource other than
3906 the sending resource, the server MUST return a <conflict/> stanza
3907 error to the sending resource:
3909 Example: Client attempts to change the default list but that list is
3910 in use by another resource:
3912 <iq to='romeo@example.net/orchard' type='error' id='default1'>
3913 <query xmlns='jabber:iq:privacy'>
3914 <default name='special'/>
3919 Saint-Andre (ed.) Expires September 19, 2004 [Page 70]
3921 Internet-Draft XMPP IM March 2004
3924 <error type='cancel'>
3926 xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
3930 If the user attempts to set a default list but a list by that name
3931 does not exist, the server MUST return an <item-not-found/> stanza
3934 Example: Client attempts to set a non-existent list as default:
3936 <iq to='romeo@example.net/orchard' type='error' id='default1'>
3937 <query xmlns='jabber:iq:privacy'>
3938 <default name='The Empty Set'/>
3940 <error type='cancel'>
3942 xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
3946 In order to decline the use of a default list (i.e., to use the
3947 domain's stanza routing rules at all times), the user MUST send an
3948 empty <default/> element with no 'name' attribute.
3950 Example: Client declines the use of the default list:
3952 <iq from='romeo@example.net/orchard' type='set' id='default2'>
3953 <query xmlns='jabber:iq:privacy'>
3958 Example: Server acknowledges success of declining any default list:
3960 <iq type='result' id='default2' to='romeo@example.net/orchard'/>
3962 If one connected resource attempts to decline the use of a default
3963 list for the user as a whole but the default list currently applies
3964 to at least one other connected resource, the server MUST return a
3965 <conflict/> error to the sending resource:
3967 Example: Client attempts to decline a default list but that list is
3968 in use by another resource:
3970 <iq to='romeo@example.net/orchard' type='error' id='default3'>
3971 <query xmlns='jabber:iq:privacy'>
3975 Saint-Andre (ed.) Expires September 19, 2004 [Page 71]
3977 Internet-Draft XMPP IM March 2004
3982 <error type='cancel'>
3984 xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
3989 10.6 Editing a Privacy List
3991 In order to edit a privacy list, the user MUST send an IQ stanza of
3992 type "set" with a <query/> element qualified by the
3993 'jabber:iq:privacy' namespace that contains one <list/> child element
3994 possessing a 'name' attribute whose value is set to the list name the
3995 user would like to edit. The <list/> element MUST contain one or
3996 more <item/> elements, which specify the user's desired changes to
3997 the list by including all elements in the list (not the "delta").
3999 Example: Client edits a privacy list:
4001 <iq from='romeo@example.net/orchard' type='set' id='edit1'>
4002 <query xmlns='jabber:iq:privacy'>
4003 <list name='public'>
4005 value='tybalt@example.com'
4009 value='paris@example.org'
4012 <item action='allow' order='68'/>
4017 Example: Server acknowledges success of list edit:
4019 <iq type='result' id='edit1' to='romeo@example.net/orchard'/>
4021 Note: The value of the 'order' attribute for any given item is not
4022 fixed. Thus in the foregoing example if the user would like to add 4
4023 items between the "tybalt@example.com" item and the
4024 "paris@example.org" item, the user's client MUST renumber the
4025 relevant items before submitting the list to the server.
4027 The server MUST now send a "privacy list push" to all connected
4031 Saint-Andre (ed.) Expires September 19, 2004 [Page 72]
4033 Internet-Draft XMPP IM March 2004
4038 Example: Privacy list push on list edit:
4040 <iq to='romeo@example.net/orchard' type='set' id='push1'>
4041 <query xmlns='jabber:iq:privacy'>
4042 <list name='public'/>
4046 <iq to='romeo@example.net/home' type='set' id='push2'>
4047 <query xmlns='jabber:iq:privacy'>
4048 <list name='public'/>
4052 In accordance with the semantics of IQ stanzas defined in
4053 [XMPP-CORE], each connected resource MUST return an IQ result to the
4056 Example: Acknowledging receipt of privacy list pushes:
4058 <iq from='romeo@example.net/orchard'
4062 <iq from='romeo@example.net/home'
4067 10.7 Adding a New Privacy List
4069 The same protocol used to edit an existing list is used to create a
4070 new list. If the list name matches that of an existing list, the
4071 request to add a new list will overwrite the old one. As with list
4072 edits, the server MUST also send a "privacy list push" to all
4073 connected resources.
4075 10.8 Removing a Privacy List
4077 In order to remove a privacy list, the user MUST send an IQ stanza of
4078 type "set" with a <query/> element qualified by the
4079 'jabber:iq:privacy' namespace that contains one empty <list/> child
4080 element possessing a 'name' attribute whose value is set to the list
4081 name the user would like to remove.
4083 Example: Client removes a privacy list:
4087 Saint-Andre (ed.) Expires September 19, 2004 [Page 73]
4089 Internet-Draft XMPP IM March 2004
4092 <iq from='romeo@example.net/orchard' type='set' id='remove1'>
4093 <query xmlns='jabber:iq:privacy'>
4094 <list name='private'/>
4098 Example: Server acknowledges success of list removal:
4100 <iq type='result' id='remove1' to='romeo@example.net/orchard'/>
4102 If a user attempts to remove a list that is currently being applied
4103 to at least one resource other than the sending resource, the server
4104 MUST return a <conflict/> stanza error to the user; i.e., the user
4105 MUST first set another list to active or default before attempting to
4106 remove it. If the user attempts to remove a list but a list by that
4107 name does not exist, the server MUST return an <item-not-found/>
4108 stanza error to the user. If the user attempts to remove more than
4109 one list in the same request, the server MUST return a <bad request/>
4110 stanza error to the user.
4112 10.9 Blocking Messages
4114 Server-side privacy lists enable a user to block incoming messages
4115 from other entities based on the entity's JID, roster group, or
4116 subscription status (or globally). The following examples illustrate
4117 the protocol. (Note: For the sake of brevity, IQ stanzas of type
4118 "result" are not shown in the following examples, nor are "privacy
4121 Example: User blocks based on JID:
4123 <iq from='romeo@example.net/orchard' type='set' id='msg1'>
4124 <query xmlns='jabber:iq:privacy'>
4125 <list name='message-jid-example'>
4127 value='tybalt@example.com'
4136 As a result of creating and applying the foregoing list, the user
4137 will not receive messages from the entity with the specified JID.
4139 Example: User blocks based on roster group:
4143 Saint-Andre (ed.) Expires September 19, 2004 [Page 74]
4145 Internet-Draft XMPP IM March 2004
4148 <iq from='romeo@example.net/orchard' type='set' id='msg2'>
4149 <query xmlns='jabber:iq:privacy'>
4150 <list name='message-group-example'>
4161 As a result of creating and applying the foregoing list, the user
4162 will not receive messages from any entities in the specified roster
4165 Example: User blocks based on subscription type:
4167 <iq from='romeo@example.net/orchard' type='set' id='msg3'>
4168 <query xmlns='jabber:iq:privacy'>
4169 <list name='message-sub-example'>
4170 <item type='subscription'
4180 As a result of creating and applying the foregoing list, the user
4181 will not receive messages from any entities with the specified
4184 Example: User blocks globally:
4186 <iq from='romeo@example.net/orchard' type='set' id='msg4'>
4187 <query xmlns='jabber:iq:privacy'>
4188 <list name='message-global-example'>
4189 <item action='deny' order='6'>
4199 Saint-Andre (ed.) Expires September 19, 2004 [Page 75]
4201 Internet-Draft XMPP IM March 2004
4204 As a result of creating and applying the foregoing list, the user
4205 will not receive messages from any other users.
4207 10.10 Blocking Inbound Presence Notifications
4209 Server-side privacy lists enable a user to block incoming presence
4210 notifications from other entities based on the entity's JID, roster
4211 group, or subscription status (or globally). The following examples
4212 illustrate the protocol.
4214 Note: Presence notifications do not include presence subscriptions,
4215 only presence information that is broadcasted to the user because the
4216 user is currently subscribed to a contact's presence information.
4217 Thus this includes presence stanzas with no 'type' attribute or of
4218 type='unavailable' only.
4220 Example: User blocks based on JID:
4222 <iq from='romeo@example.net/orchard' type='set' id='presin1'>
4223 <query xmlns='jabber:iq:privacy'>
4224 <list name='presin-jid-example'>
4226 value='tybalt@example.com'
4235 As a result of creating and applying the foregoing list, the user
4236 will not receive presence notifications from the entity with the
4239 Example: User blocks based on roster group:
4241 <iq from='romeo@example.net/orchard' type='set' id='presin2'>
4242 <query xmlns='jabber:iq:privacy'>
4243 <list name='presin-group-example'>
4255 Saint-Andre (ed.) Expires September 19, 2004 [Page 76]
4257 Internet-Draft XMPP IM March 2004
4262 As a result of creating and applying the foregoing list, the user
4263 will not receive presence notifications from any entities in the
4264 specified roster group.
4266 Example: User blocks based on subscription type:
4268 <iq from='romeo@example.net/orchard' type='set' id='presin3'>
4269 <query xmlns='jabber:iq:privacy'>
4270 <list name='presin-sub-example'>
4271 <item type='subscription'
4281 As a result of creating and applying the foregoing list, the user
4282 will not receive presence notifications from any entities with the
4283 specified subscription type.
4285 Example: User blocks globally:
4287 <iq from='romeo@example.net/orchard' type='set' id='presin4'>
4288 <query xmlns='jabber:iq:privacy'>
4289 <list name='presin-global-example'>
4290 <item action='deny' order='11'>
4297 As a result of creating and applying the foregoing list, the user
4298 will not receive presence notifications from any other users.
4300 10.11 Blocking Outbound Presence Notifications
4302 Server-side privacy lists enable a user to block outgoing presence
4303 notifications to other entities based on the entity's JID, roster
4304 group, or subscription status (or globally). The following examples
4305 illustrate the protocol.
4307 Note: Presence notifications do not include presence subscriptions,
4311 Saint-Andre (ed.) Expires September 19, 2004 [Page 77]
4313 Internet-Draft XMPP IM March 2004
4316 only presence information that is broadcasted to contacts because
4317 those contacts are currently subscribed to the user's presence
4318 information. Thus this includes presence stanzas with no 'type'
4319 attribute or of type='unavailable' only.
4321 Example: User blocks based on JID:
4323 <iq from='romeo@example.net/orchard' type='set' id='presout1'>
4324 <query xmlns='jabber:iq:privacy'>
4325 <list name='presout-jid-example'>
4327 value='tybalt@example.com'
4336 As a result of creating and applying the foregoing list, the user
4337 will not send presence notifications to the entity with the specified
4340 Example: User blocks based on roster group:
4342 <iq from='romeo@example.net/orchard' type='set' id='presout2'>
4343 <query xmlns='jabber:iq:privacy'>
4344 <list name='presout-group-example'>
4355 As a result of creating and applying the foregoing list, the user
4356 will not send presence notifications to any entities in the specified
4359 Example: User blocks based on subscription type:
4361 <iq from='romeo@example.net/orchard' type='set' id='presout3'>
4362 <query xmlns='jabber:iq:privacy'>
4363 <list name='presout-sub-example'>
4367 Saint-Andre (ed.) Expires September 19, 2004 [Page 78]
4369 Internet-Draft XMPP IM March 2004
4372 <item type='subscription'
4382 As a result of creating and applying the foregoing list, the user
4383 will not send presence notifications to any entities with the
4384 specified subscription type.
4386 Example: User blocks globally:
4388 <iq from='romeo@example.net/orchard' type='set' id='presout4'>
4389 <query xmlns='jabber:iq:privacy'>
4390 <list name='presout-global-example'>
4391 <item action='deny' order='23'>
4398 As a result of creating and applying the foregoing list, the user
4399 will not send presence notifications to any other users.
4401 10.12 Blocking IQ Stanzas
4403 Server-side privacy lists enable a user to block incoming IQ stanzas
4404 from other entities based on the entity's JID, roster group, or
4405 subscription status (or globally). The following examples illustrate
4408 Example: User blocks based on JID:
4410 <iq from='romeo@example.net/orchard' type='set' id='iq1'>
4411 <query xmlns='jabber:iq:privacy'>
4412 <list name='iq-jid-example'>
4414 value='tybalt@example.com'
4423 Saint-Andre (ed.) Expires September 19, 2004 [Page 79]
4425 Internet-Draft XMPP IM March 2004
4431 As a result of creating and applying the foregoing list, the user
4432 will not receive IQ stanzas from the entity with the specified JID.
4434 Example: User blocks based on roster group:
4436 <iq from='romeo@example.net/orchard' type='set' id='iq2'>
4437 <query xmlns='jabber:iq:privacy'>
4438 <list name='iq-group-example'>
4449 As a result of creating and applying the foregoing list, the user
4450 will not receive IQ stanzas from any entities in the specified roster
4453 Example: User blocks based on subscription type:
4455 <iq from='romeo@example.net/orchard' type='set' id='iq3'>
4456 <query xmlns='jabber:iq:privacy'>
4457 <list name='iq-sub-example'>
4458 <item type='subscription'
4468 As a result of creating and applying the foregoing list, the user
4469 will not receive IQ stanzas from any entities with the specified
4472 Example: User blocks globally:
4474 <iq from='romeo@example.net/orchard' type='set' id='iq4'>
4475 <query xmlns='jabber:iq:privacy'>
4479 Saint-Andre (ed.) Expires September 19, 2004 [Page 80]
4481 Internet-Draft XMPP IM March 2004
4484 <list name='iq-global-example'>
4485 <item action='deny' order='1'>
4492 As a result of creating and applying the foregoing list, the user
4493 will not receive IQ stanzas from any other users.
4495 10.13 Blocking All Communication
4497 Server-side privacy lists enable a user to block all stanzas from and
4498 to other entities based on the entity's JID, roster group, or
4499 subscription status (or globally). Note that this includes
4500 subscription-related presence stanzas, which are excluded by Blocking
4501 Inbound Presence Notifications (Section 10.10). The following
4502 examples illustrate the protocol.
4504 Example: User blocks based on JID:
4506 <iq from='romeo@example.net/orchard' type='set' id='all1'>
4507 <query xmlns='jabber:iq:privacy'>
4508 <list name='all-jid-example'>
4510 value='tybalt@example.com'
4517 As a result of creating and applying the foregoing list, the user
4518 will not receive any communications from, nor send any stanzas to,
4519 the entity with the specified JID.
4521 Example: User blocks based on roster group:
4523 <iq from='romeo@example.net/orchard' type='set' id='all2'>
4524 <query xmlns='jabber:iq:privacy'>
4525 <list name='all-group-example'>
4535 Saint-Andre (ed.) Expires September 19, 2004 [Page 81]
4537 Internet-Draft XMPP IM March 2004
4542 As a result of creating and applying the foregoing list, the user
4543 will not receive any communications from, nor send any stanzas to,
4544 any entities in the specified roster group.
4546 Example: User blocks based on subscription type:
4548 <iq from='romeo@example.net/orchard' type='set' id='all3'>
4549 <query xmlns='jabber:iq:privacy'>
4550 <list name='all-sub-example'>
4551 <item type='subscription'
4559 As a result of creating and applying the foregoing list, the user
4560 will not receive any communications from, nor send any stanzas to,
4561 any entities with the specified subscription type.
4563 Example: User blocks globally:
4565 <iq from='romeo@example.net/orchard' type='set' id='all4'>
4566 <query xmlns='jabber:iq:privacy'>
4567 <list name='all-global-example'>
4568 <item action='deny' order='7'/>
4573 As a result of creating and applying the foregoing list, the user
4574 will not receive any communications from, nor send any stanzas to,
4577 10.14 Blocked Entity Attempts to Communicate with User
4579 If a blocked entity attempts to send message or presence stanzas to
4580 the user, the user's server SHOULD silently drop the stanza and MUST
4581 NOT return an error to the sending entity.
4583 If a blocked entity attempts to send an IQ stanza of type "get" or
4584 "set" to the user, the user's server MUST return to the sending
4585 entity a <service-unavailable/> stanza error, since this is the
4586 standard error code sent from a client that does not understand the
4587 namespace of an IQ get or set. IQ stanzas of other types SHOULD be
4591 Saint-Andre (ed.) Expires September 19, 2004 [Page 82]
4593 Internet-Draft XMPP IM March 2004
4596 silently dropped by the server.
4598 Example: Blocked entity attempts to send IQ get:
4601 to='romeo@example.net'
4602 from='tybalt@example.com/pda'
4604 <query xmlns='jabber:iq:version'/>
4607 Example: Server returns error to blocked entity:
4610 from='romeo@example.net'
4611 to='tybalt@example.com/pda'
4613 <query xmlns='jabber:iq:version'/>
4614 <error type='cancel'>
4615 <service-unavailable
4616 xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
4621 10.15 Higher-Level Heuristics
4623 When building a representation of a higher-level privacy heuristic, a
4624 client SHOULD use the simplest possible representation.
4626 For example, the heuristic "block all communications with any user
4627 not in my roster" could be constructed in any of the following ways:
4629 o allow communications from all JIDs in my roster (i.e., listing
4630 each JID as a separate list item), but block communications with
4633 o allow communications from any user who is in one of the groups
4634 that make up my roster (i.e., listing each group as a separate
4635 list item), but block communications from everyone else
4637 o allow communications from any user with whom I have a subscription
4638 of 'both' or 'to' or 'from' (i.e., listing each subscription value
4639 separately), but block communications from everyone else
4641 o block communications from anyone whose subscription state is
4647 Saint-Andre (ed.) Expires September 19, 2004 [Page 83]
4649 Internet-Draft XMPP IM March 2004
4652 The final representation is the simplest and SHOULD be used; here is
4653 the XML that would be sent in this case:
4655 <iq type='set' id='heuristic1'>
4656 <query xmlns='jabber:iq:privacy'>
4657 <list name='heuristic-example'>
4658 <item type='subscription'
4667 11. Server Rules for Handling XML Stanzas
4669 Basic routing and delivery rules for servers are defined in
4670 [XMPP-CORE]. This section defines additional rules for
4671 XMPP-compliant instant messaging and presence servers.
4673 11.1 Inbound Stanzas
4675 If the hostname of the domain identifier portion of the JID contained
4676 in the 'to' attribute of an inbound stanza matches a hostname of the
4677 server itself and the JID contained in the 'to' attribute is of the
4678 form <user@example.com> or <user@example.com/resource>, the server
4679 MUST first apply any privacy lists (Section 10) that are in force,
4680 then follow the rules defined below:
4682 1. If the JID is of the form <user@domain/resource> and an available
4683 resource matches the full JID, the recipient's server MUST
4684 deliver the stanza to that resource.
4686 2. Else if the JID is of the form <user@domain> or <user@domain/
4687 resource> and the associated user account does not exist, the
4688 recipient's server (a) SHOULD silently ignore the stanza (i.e.,
4689 neither deliver it nor return an error) if it is a presence
4690 stanza, (b) MUST return a <service-unavailable/> stanza error to
4691 the sender if it is an IQ stanza, and (c) SHOULD return a
4692 <service-unavailable/> stanza error to the sender if it is a
4695 3. Else if the JID is of the form <user@domain/resource> and no
4696 available resource matches the full JID, the recipient's server
4697 (a) SHOULD silently ignore the stanza (i.e., neither deliver it
4698 nor return an error) if it is a presence stanza, (b) MUST return
4699 a <service-unavailable/> stanza error to the sender if it is an
4703 Saint-Andre (ed.) Expires September 19, 2004 [Page 84]
4705 Internet-Draft XMPP IM March 2004
4708 IQ stanza, and (c) SHOULD treat the stanza as if it were
4709 addressed to <user@domain> if it is a message stanza.
4711 4. Else if the JID is of the form <user@domain> and there is at
4712 least one available resource available for the user, the
4713 recipient's server MUST follow these rules:
4715 1. For message stanzas, the server SHOULD deliver the stanza to
4716 the highest-priority available resource (if the resource did
4717 not provide a value for the <priority/> element, the server
4718 SHOULD consider it to have provided a value of zero). If two
4719 or more available resources have the same priority, the
4720 server MAY use some other rule (e.g., most recent connect
4721 time, most recent activity time, or highest availability as
4722 determined by some hierarchy of <show/> values) to choose
4723 between them or MAY deliver the message to all such
4724 resources. However, the server MUST NOT deliver the stanza
4725 to an available resource with a negative priority; if the
4726 only available resource has a negative priority, the server
4727 SHOULD handle the message as if there were no available
4728 resources (defined below). In addition, the server MUST NOT
4729 rewrite the 'to' attribute (i.e., it MUST leave it as
4730 <user@domain> rather than change it to <user@domain/
4733 2. For presence stanzas other than those of type "probe", the
4734 server MUST deliver the stanza to all available resources;
4735 for presence probes, the server SHOULD reply based on the
4736 rules defined in Presence Probes (Section 5.1.3). In
4737 addition, the server MUST NOT rewrite the 'to' attribute
4738 (i.e., it MUST leave it as <user@domain> rather than change
4739 it to <user@domain/resource>).
4741 3. For IQ stanzas, the server itself MUST reply on behalf of the
4742 user with either an IQ result or an IQ error, and MUST NOT
4743 deliver the IQ stanza to any of the available resources.
4744 Specifically, if the semantics of the qualifying namespace
4745 define a reply that the server can provide, the server MUST
4746 reply to the stanza on behalf of the user; if not, the server
4747 MUST reply with a <service-unavailable/> stanza error.
4749 5. Else if the JID is of the form <user@domain> and there are no
4750 available resources associated with the user, how the stanza is
4751 handled depends on the stanza type:
4753 1. For presence stanzas of type "subscribe", "subscribed",
4754 "unsubscribe", and "unsubscribed", the server MUST maintain a
4755 record of the stanza and deliver the stanza at least once
4759 Saint-Andre (ed.) Expires September 19, 2004 [Page 85]
4761 Internet-Draft XMPP IM March 2004
4764 (i.e., when the user next creates an available resource); in
4765 addition, the server MUST continue to deliver presence
4766 stanzas of type "subscribe" until the user either approves or
4767 denies the subscription request (see also Presence
4768 Subscriptions (Section 5.1.6)).
4770 2. For all other presence stanzas, the server SHOULD silently
4771 ignore the stanza by not storing it for later delivery or
4772 replying to it on behalf of the user.
4774 3. For message stanzas, the server MAY choose to store the
4775 stanza on behalf of the user and deliver it when the user
4776 next becomes available, or forward the message to the user
4777 via some other means (e.g., to the user's email account).
4778 However, if offline message storage or message forwarding is
4779 not enabled, the server MUST return to the sender a
4780 <service-unavailable/> stanza error. (Note: Offline message
4781 storage and message forwarding are not defined in XMPP, since
4782 they are strictly a matter of implementation and service
4785 4. For IQ stanzas, the server itself MUST reply on behalf of the
4786 user with either an IQ result or an IQ error. Specifically,
4787 if the semantics of the qualifying namespace define a reply
4788 that the server can provide, the server MUST reply to the
4789 stanza on behalf of the user; if not, the server MUST reply
4790 with a <service-unavailable/> stanza error.
4793 11.2 Outbound Stanzas
4795 If the hostname of the domain identifier portion of the address
4796 contained in the 'to' attribute of an outbound stanza matches a
4797 hostname of the server itself, the server MUST deliver the stanza to
4798 a local entity according the rules for Inbound Stanzas (Section
4801 If the hostname of the domain identifier portion of the address
4802 contained in the 'to' attribute of an outbound stanza does not match
4803 a hostname of the server itself, the server MUST attempt to route the
4804 stanza to the foreign domain. The recommended order of actions is as
4807 1. First attempt to resolve the foreign hostname using an [SRV]
4808 Service of "xmpp-server" and Proto of "tcp", resulting in
4809 resource records such as "_xmpp-server._tcp.example.com.", as
4810 specified in [XMPP-CORE].
4815 Saint-Andre (ed.) Expires September 19, 2004 [Page 86]
4817 Internet-Draft XMPP IM March 2004
4820 2. If the "xmpp-server" lookup fails, attempt to resolve the "_im"
4821 or "_pres" [SRV] Service as specified in [IMP-SRV], using the
4822 "_im" Service for <message/> stanzas and the "_pres" Service for
4823 <presence/> stanzas (it is up to the implementation how to handle
4824 <iq/> stanzas). This will result in one or more resolutions of
4825 the form "_im.<proto>.example.com." or
4826 "_pres.<proto>.example.com.", where "<proto>" would be a label
4827 registered in the Instant Messaging SRV Protocol Label registry
4828 or the Presence SRV Protocol Label registry: either "_xmpp" for
4829 an XMPP-aware domain or some other IANA-registered label (e.g.,
4830 "_simple") for a non-XMPP-aware domain.
4832 3. If both SRV lookups fail, attempt to perform a normal IPv4/IPv6
4833 address record resolution to determine the IP address using the
4834 "xmpp-server" port of 5269 registered with the IANA, as specified
4837 Administrators of server deployments are strongly encouraged to keep
4838 the _im._xmpp, _pres._xmpp, and _xmpp._tcp SRV records properly
4839 synchronized, since different implementations might perform the "_im"
4840 and "_pres" lookups before the "xmpp-server" lookup.
4842 12. IM and Presence Compliance Requirements
4844 This section summarizes the specific aspects of the Extensible
4845 Messaging and Presence Protocol that MUST be supported by instant
4846 messaging and presence servers and clients in order to be considered
4847 compliant implementations. All such applications MUST comply with
4848 the requirements specified in [XMPP-CORE]. The text in this section
4849 specifies additional compliance requirements for instant messaging
4850 and presence servers and clients; note well that the requirements
4851 described here supplement but do not supersede the core requirements.
4852 Note also that a server or client MAY support only presence or
4853 instant messaging, and is not required to support both if only a
4854 presence service or an instant messaging service is desired.
4858 In addition to core server compliance requirements, an instant
4859 messaging and presence server MUST additionally support the following
4862 o All server-related instant messaging and presence syntax and
4863 semantics defined in this document, including presence broadcast
4864 on behalf of clients, presence subscriptions, roster storage and
4865 manipulation, privacy lists, and IM-specific routing and delivery
4871 Saint-Andre (ed.) Expires September 19, 2004 [Page 87]
4873 Internet-Draft XMPP IM March 2004
4878 In addition to core client compliance requirements, an instant
4879 messaging and presence client MUST additionally support the following
4882 o Generation and handling of the IM-specific semantics of XML
4883 stanzas as defined by the XML schemas, including the 'type'
4884 attribute of message and presence stanzas as well as their child
4887 o All client-related instant messaging syntax and semantics defined
4888 in this document, including presence subscriptions, roster
4889 management, and privacy lists
4891 o End-to-end object encryption as defined in End-to-End Object
4892 Encryption in the Extensible Messaging and Presence Protocol
4895 A client MUST also handle addresses that are encoded as "im:" URIs as
4896 specified in [CPIM], and MAY do so by removing the "im:" scheme and
4897 entrusting address resolution to the server as specified under
4898 Outbound Stanzas (Section 11.2).
4900 13. Internationalization Considerations
4902 For internationalization considerations, refer to the relevant
4903 section of [XMPP-CORE].
4905 14. Security Considerations
4907 Core security considerations for XMPP are defined in the relevant
4908 section of [XMPP-CORE].
4910 Additional considerations that apply only to instant messaging and
4911 presence applications of XMPP are defined in several places within
4912 this memo; specifically:
4914 o When a server processes an inbound stanza of any kind whose
4915 intended recipient is a user associated with one of the server's
4916 hostnames, the server MUST first apply any privacy lists (Section
4917 10) that are in force (see Server Rules for Handling XML Stanzas
4920 o When a server processes an inbound presence stanza of type "probe"
4921 whose intended recipient is a user associated with one of the
4922 server's hostnames, the server MUST NOT reveal the user's presence
4923 information if the sender is an entity that is not authorized to
4927 Saint-Andre (ed.) Expires September 19, 2004 [Page 88]
4929 Internet-Draft XMPP IM March 2004
4932 receive that information as determined by presence subscriptions
4933 (see Client and Server Presence Responsibilities (Section 5.1)).
4935 o When a server processes an outbound presence stanza with no type
4936 or of type "unavailable", it MUST follow the rules defined under
4937 Client and Server Presence Responsibilities (Section 5.1) in order
4938 to ensure that such presence information is not broadcasted to
4939 entities that are not authorized to know such information.
4941 o When a server generates an error stanza in response to receiving a
4942 stanza for a user who does not exist, the use of the
4943 <service-unavailable/> error condition helps protect against
4944 well-known dictionary attacks, since this is the same error
4945 condition that is returned if, for instance, the namespace of an
4946 IQ child element is not understood, or if offline message storage
4947 or message forwarding is not enabled for a domain.
4950 15. IANA Considerations
4952 For a number of related IANA considerations, refer to the relevant
4953 section of [XMPP-CORE].
4955 15.1 XML Namespace Name for Session Data
4957 A URN sub-namespace for session-related data in the Extensible
4958 Messaging and Presence Protocol (XMPP) is defined as follows. (This
4959 namespace name adheres to the format defined in The IETF XML Registry
4962 URI: urn:ietf:params:xml:ns:xmpp-session
4966 Description: This is the XML namespace name for session-related data
4967 in the Extensible Messaging and Presence Protocol (XMPP) as
4970 Registrant Contact: IETF, XMPP Working Group, <xmppwg@jabber.org>
4973 15.2 Instant Messaging SRV Protocol Label Registration
4975 Address Resolution for Instant Messaging and Presence [IMP-SRV]
4976 defines an Instant Messaging SRV Protocol Label registry for
4977 protocols that can provide services that conform to the "_im" SRV
4978 Service label. Because XMPP is one such protocol, the IANA registers
4979 the "_xmpp" protocol label in the appropriate registry, as follows:
4983 Saint-Andre (ed.) Expires September 19, 2004 [Page 89]
4985 Internet-Draft XMPP IM March 2004
4988 Protocol label: _xmpp
4992 Description: Instant messaging protocol label for the Extensible
4993 Messaging and Presence Protocol (XMPP) as defined by XXXX.
4995 Registrant Contact: IETF, XMPP Working Group, <xmppwg@jabber.org>
4998 15.3 Presence SRV Protocol Label Registration
5000 Address Resolution for Instant Messaging and Presence [IMP-SRV]
5001 defines a Presence SRV Protocol Label registry for protocols that can
5002 provide services that conform to the "_pres" SRV Service label.
5003 Because XMPP is one such protocol, the IANA registers the "_xmpp"
5004 protocol label in the appropriate registry, as follows:
5006 Protocol label: _xmpp
5010 Description: Presence protocol label for the Extensible Messaging and
5011 Presence Protocol (XMPP) as defined by XXXX.
5013 Registrant Contact: IETF, XMPP Working Group, <xmppwg@jabber.org>
5015 Normative References
5017 [CPIM] Peterson, J., "Common Profile for Instant Messaging
5018 (CPIM)", draft-ietf-impp-im-04 (work in progress), August
5022 Day, M., Aggarwal, S. and J. Vincent, "Instant Messaging /
5023 Presence Protocol Requirements", RFC 2779, February 2000.
5025 [IMP-SRV] Peterson, J., "Address Resolution for Instant Messaging
5026 and Presence", draft-ietf-impp-srv-04 (work in progress),
5029 [SRV] Gulbrandsen, A., Vixie, P. and L. Esibov, "A DNS RR for
5030 specifying the location of services (DNS SRV)", RFC 2782,
5033 [TERMS] Bradner, S., "Key words for use in RFCs to Indicate
5034 Requirement Levels", BCP 14, RFC 2119, March 1997.
5039 Saint-Andre (ed.) Expires September 19, 2004 [Page 90]
5041 Internet-Draft XMPP IM March 2004
5044 [XML] Bray, T., Paoli, J., Sperberg-McQueen, C. and E. Maler,
5045 "Extensible Markup Language (XML) 1.0 (2nd ed)", W3C
5046 REC-xml, October 2000, <http://www.w3.org/TR/REC-xml>.
5049 Bray, T., Hollander, D. and A. Layman, "Namespaces in
5050 XML", W3C REC-xml-names, January 1999, <http://www.w3.org/
5054 Saint-Andre, P., "Extensible Messaging and Presence
5055 Protocol (XMPP): Core", draft-ietf-xmpp-core-22 (work in
5056 progress), January 2004.
5059 Saint-Andre, P., "End-to-End Object Encryption in the
5060 Extensible Messaging and Presence Protocol (XMPP)",
5061 draft-ietf-xmpp-e2e-07 (work in progress), December 2003.
5063 Informative References
5066 Day, M., Rosenberg, J. and H. Sugano, "A Model for
5067 Presence and Instant Messaging", RFC 2778, February 2000.
5069 [IRC] Oikarinen, J. and D. Reed, "Internet Relay Chat Protocol",
5072 [JSF] Jabber Software Foundation, "Jabber Software Foundation",
5073 <http://www.jabber.org/>.
5075 [VCARD] Dawson, F. and T. Howes, "vCard MIME Directory Profile",
5076 RFC 2426, September 1998.
5078 [XML-REG] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
5085 Jabber Software Foundation
5087 EMail: stpeter@jabber.org
5091 Sections 3.1.3 and 4.1.4 of [IMP-REQS] require that it be possible to
5095 Saint-Andre (ed.) Expires September 19, 2004 [Page 91]
5097 Internet-Draft XMPP IM March 2004
5100 retrieve out-of-band contact information for other users (e.g.,
5101 telephone number or email address). An XML representation of the
5102 vCard specification defined in RFC 2426 [VCARD] is in common use
5103 within the Jabber community to provide such information but is out of
5104 scope for XMPP (documentation of this protocol is contained in
5105 "JEP-0054: vcard-temp", published by the Jabber Software Foundation
5108 Appendix B. XML Schemas
5110 The following XML schemas are descriptive, not normative. For
5111 schemas defining the core features of XMPP, refer to [XMPP-CORE].
5115 <?xml version='1.0' encoding='UTF-8'?>
5118 xmlns:xs='http://www.w3.org/2001/XMLSchema'
5119 targetNamespace='jabber:client'
5120 xmlns='jabber:client'
5121 elementFormDefault='qualified'>
5123 <xs:element name='message'>
5126 <xs:element ref='subject'
5128 maxOccurs='unbounded'/>
5129 <xs:element ref='body'
5131 maxOccurs='unbounded'/>
5132 <xs:element ref='thread'
5134 <xs:any namespace='##other'
5136 maxOccurs='unbounded'/>
5137 <xs:element ref='error'
5140 <xs:attribute name='from'
5143 <xs:attribute name='id'
5146 <xs:attribute name='to'
5151 Saint-Andre (ed.) Expires September 19, 2004 [Page 92]
5153 Internet-Draft XMPP IM March 2004
5157 <xs:attribute name='type' use='optional' default='normal'>
5159 <xs:restriction base='xs:NCName'>
5160 <xs:enumeration value='chat'/>
5161 <xs:enumeration value='error'/>
5162 <xs:enumeration value='groupchat'/>
5163 <xs:enumeration value='headline'/>
5164 <xs:enumeration value='normal'/>
5168 <xs:attribute ref='xml:lang' use='optional'/>
5172 <xs:element name='body'>
5175 <xs:extension base='xs:string'>
5176 <xs:attribute ref='xml:lang' use='optional'/>
5182 <xs:element name='subject'>
5185 <xs:extension base='xs:string'>
5186 <xs:attribute ref='xml:lang' use='optional'/>
5192 <xs:element name='thread' type='xs:NMTOKEN'/>
5194 <xs:element name='presence'>
5197 <xs:element ref='show'
5199 <xs:element ref='status'
5201 maxOccurs='unbounded'/>
5202 <xs:element ref='priority'
5207 Saint-Andre (ed.) Expires September 19, 2004 [Page 93]
5209 Internet-Draft XMPP IM March 2004
5212 <xs:any namespace='##other'
5214 maxOccurs='unbounded'/>
5215 <xs:element ref='error'
5218 <xs:attribute name='from'
5221 <xs:attribute name='id'
5224 <xs:attribute name='to'
5227 <xs:attribute name='type' use='optional'>
5229 <xs:restriction base='xs:NCName'>
5230 <xs:enumeration value='error'/>
5231 <xs:enumeration value='probe'/>
5232 <xs:enumeration value='subscribe'/>
5233 <xs:enumeration value='subscribed'/>
5234 <xs:enumeration value='unavailable'/>
5235 <xs:enumeration value='unsubscribe'/>
5236 <xs:enumeration value='unsubscribed'/>
5240 <xs:attribute ref='xml:lang' use='optional'/>
5244 <xs:element name='show'>
5246 <xs:restriction base='xs:NCName'>
5247 <xs:enumeration value='away'/>
5248 <xs:enumeration value='chat'/>
5249 <xs:enumeration value='dnd'/>
5250 <xs:enumeration value='xa'/>
5255 <xs:element name='status'>
5258 <xs:extension base='xs:string'>
5259 <xs:attribute ref='xml:lang' use='optional'/>
5263 Saint-Andre (ed.) Expires September 19, 2004 [Page 94]
5265 Internet-Draft XMPP IM March 2004
5273 <xs:element name='priority' type='xs:byte'/>
5275 <xs:element name='iq'>
5278 <xs:any namespace='##other'
5280 <xs:element ref='error'
5283 <xs:attribute name='from'
5286 <xs:attribute name='id'
5289 <xs:attribute name='to'
5292 <xs:attribute name='type' use='required'>
5294 <xs:restriction base='xs:NCName'>
5295 <xs:enumeration value='error'/>
5296 <xs:enumeration value='get'/>
5297 <xs:enumeration value='result'/>
5298 <xs:enumeration value='set'/>
5302 <xs:attribute ref='xml:lang' use='optional'/>
5306 <xs:element name='error'>
5308 <xs:sequence xmlns:err='urn:ietf:params:xml:ns:xmpp-streams'>
5309 <xs:group ref='err:errorGroup'/>
5310 <xs:element ref='err:text'
5313 <xs:attribute name='code' type='xs:byte' use='optional'/>
5314 <xs:attribute name='type' use='required'>
5319 Saint-Andre (ed.) Expires September 19, 2004 [Page 95]
5321 Internet-Draft XMPP IM March 2004
5324 <xs:restriction base='xs:NCName'>
5325 <xs:enumeration value='auth'/>
5326 <xs:enumeration value='cancel'/>
5327 <xs:enumeration value='continue'/>
5328 <xs:enumeration value='modify'/>
5329 <xs:enumeration value='wait'/>
5341 <?xml version='1.0' encoding='UTF-8'?>
5344 xmlns:xs='http://www.w3.org/2001/XMLSchema'
5345 targetNamespace='jabber:server'
5346 xmlns='jabber:server'
5347 elementFormDefault='qualified'>
5349 <xs:element name='message'>
5352 <xs:element ref='subject'
5354 maxOccurs='unbounded'/>
5355 <xs:element ref='body'
5357 maxOccurs='unbounded'/>
5358 <xs:element ref='thread'
5360 <xs:any namespace='##other'
5362 maxOccurs='unbounded'/>
5363 <xs:element ref='error'
5366 <xs:attribute name='from'
5369 <xs:attribute name='id'
5375 Saint-Andre (ed.) Expires September 19, 2004 [Page 96]
5377 Internet-Draft XMPP IM March 2004
5380 <xs:attribute name='to'
5383 <xs:attribute name='type' use='optional' default='normal'>
5385 <xs:restriction base='xs:NCName'>
5386 <xs:enumeration value='chat'/>
5387 <xs:enumeration value='error'/>
5388 <xs:enumeration value='groupchat'/>
5389 <xs:enumeration value='headline'/>
5390 <xs:enumeration value='normal'/>
5394 <xs:attribute ref='xml:lang' use='optional'/>
5398 <xs:element name='body'>
5401 <xs:extension base='xs:string'>
5402 <xs:attribute ref='xml:lang' use='optional'/>
5408 <xs:element name='subject'>
5411 <xs:extension base='xs:string'>
5412 <xs:attribute ref='xml:lang' use='optional'/>
5418 <xs:element name='thread' type='xs:NMTOKEN'/>
5420 <xs:element name='presence'>
5423 <xs:element ref='show'
5425 <xs:element ref='status'
5427 maxOccurs='unbounded'/>
5431 Saint-Andre (ed.) Expires September 19, 2004 [Page 97]
5433 Internet-Draft XMPP IM March 2004
5436 <xs:element ref='priority'
5438 <xs:any namespace='##other'
5440 maxOccurs='unbounded'/>
5441 <xs:element ref='error'
5444 <xs:attribute name='from'
5447 <xs:attribute name='id'
5450 <xs:attribute name='to'
5453 <xs:attribute name='type' use='optional'>
5455 <xs:restriction base='xs:NCName'>
5456 <xs:enumeration value='error'/>
5457 <xs:enumeration value='probe'/>
5458 <xs:enumeration value='subscribe'/>
5459 <xs:enumeration value='subscribed'/>
5460 <xs:enumeration value='unavailable'/>
5461 <xs:enumeration value='unsubscribe'/>
5462 <xs:enumeration value='unsubscribed'/>
5466 <xs:attribute ref='xml:lang' use='optional'/>
5470 <xs:element name='show'>
5472 <xs:restriction base='xs:NCName'>
5473 <xs:enumeration value='away'/>
5474 <xs:enumeration value='chat'/>
5475 <xs:enumeration value='dnd'/>
5476 <xs:enumeration value='xa'/>
5481 <xs:element name='status'>
5487 Saint-Andre (ed.) Expires September 19, 2004 [Page 98]
5489 Internet-Draft XMPP IM March 2004
5492 <xs:extension base='xs:string'>
5493 <xs:attribute ref='xml:lang' use='optional'/>
5499 <xs:element name='priority' type='xs:byte'/>
5501 <xs:element name='iq'>
5504 <xs:any namespace='##other'
5506 <xs:element ref='error'
5509 <xs:attribute name='from'
5512 <xs:attribute name='id'
5515 <xs:attribute name='to'
5518 <xs:attribute name='type' use='required'>
5520 <xs:restriction base='xs:NCName'>
5521 <xs:enumeration value='error'/>
5522 <xs:enumeration value='get'/>
5523 <xs:enumeration value='result'/>
5524 <xs:enumeration value='set'/>
5528 <xs:attribute ref='xml:lang' use='optional'/>
5532 <xs:element name='error'>
5534 <xs:sequence xmlns:err='urn:ietf:params:xml:ns:xmpp-streams'>
5535 <xs:group ref='err:errorGroup'/>
5536 <xs:element ref='err:text'
5539 <xs:attribute name='code' type='xs:byte' use='optional'/>
5543 Saint-Andre (ed.) Expires September 19, 2004 [Page 99]
5545 Internet-Draft XMPP IM March 2004
5548 <xs:attribute name='type' use='required'>
5550 <xs:restriction base='xs:NCName'>
5551 <xs:enumeration value='auth'/>
5552 <xs:enumeration value='cancel'/>
5553 <xs:enumeration value='continue'/>
5554 <xs:enumeration value='modify'/>
5555 <xs:enumeration value='wait'/>
5567 <?xml version='1.0' encoding='UTF-8'?>
5570 xmlns:xs='http://www.w3.org/2001/XMLSchema'
5571 targetNamespace='urn:ietf:params:xml:ns:xmpp-session'
5572 xmlns='urn:ietf:params:xml:ns:xmpp-session'
5573 elementFormDefault='qualified'>
5575 <xs:element name='session' type='empty'/>
5577 <xs:simpleType name='empty'>
5578 <xs:restriction base='xs:string'>
5579 <xs:enumeration value=''/>
5586 B.4 jabber:iq:privacy
5588 <?xml version='1.0' encoding='UTF-8'?>
5591 xmlns:xs='http://www.w3.org/2001/XMLSchema'
5592 targetNamespace='jabber:iq:privacy'
5593 xmlns='jabber:iq:privacy'
5594 elementFormDefault='qualified'>
5599 Saint-Andre (ed.) Expires September 19, 2004 [Page 100]
5601 Internet-Draft XMPP IM March 2004
5604 <xs:element name='query'>
5607 <xs:element ref='active'
5609 <xs:element ref='default'
5611 <xs:element ref='list'
5613 maxOccurs='unbounded'/>
5618 <xs:element name='active'>
5621 <xs:extension base='xs:NMTOKEN'>
5622 <xs:attribute name='name'
5630 <xs:element name='default'>
5633 <xs:extension base='xs:NMTOKEN'>
5634 <xs:attribute name='name'
5642 <xs:element name='list'>
5645 <xs:element ref='item'
5647 maxOccurs='unbounded'/>
5649 <xs:attribute name='name'
5655 Saint-Andre (ed.) Expires September 19, 2004 [Page 101]
5657 Internet-Draft XMPP IM March 2004
5663 <xs:element name='item'>
5666 <xs:element name='iq'
5669 <xs:element name='message'
5672 <xs:element name='presence-in'
5675 <xs:element name='presence-out'
5679 <xs:attribute name='action' use='required'>
5681 <xs:restriction base='xs:NCName'>
5682 <xs:enumeration value='allow'/>
5683 <xs:enumeration value='deny'/>
5687 <xs:attribute name='order'
5688 type='xs:unsignedInt'
5690 <xs:attribute name='type' use='optional'>
5692 <xs:restriction base='xs:NCName'>
5693 <xs:enumeration value='group'/>
5694 <xs:enumeration value='jid'/>
5695 <xs:enumeration value='subscription'/>
5699 <xs:attribute name='value'
5705 <xs:simpleType name='empty'>
5706 <xs:restriction base='xs:string'>
5707 <xs:enumeration value=''/>
5711 Saint-Andre (ed.) Expires September 19, 2004 [Page 102]
5713 Internet-Draft XMPP IM March 2004
5722 B.5 jabber:iq:roster
5724 <?xml version='1.0' encoding='UTF-8'?>
5727 xmlns:xs='http://www.w3.org/2001/XMLSchema'
5728 targetNamespace='jabber:iq:roster'
5729 xmlns='jabber:iq:roster'
5730 elementFormDefault='qualified'>
5732 <xs:element name='query'>
5735 <xs:element ref='item'
5737 maxOccurs='unbounded'/>
5742 <xs:element name='item'>
5745 <xs:element ref='group'
5747 maxOccurs='unbounded'/>
5749 <xs:attribute name='ask' use='optional'>
5751 <xs:restriction base='xs:NCName'>
5752 <xs:enumeration value='subscribe'/>
5756 <xs:attribute name='jid' type='xs:string' use='required'/>
5757 <xs:attribute name='name' type='xs:string' use='optional'/>
5758 <xs:attribute name='subscription' use='optional'>
5760 <xs:restriction base='xs:NCName'>
5761 <xs:enumeration value='both'/>
5762 <xs:enumeration value='from'/>
5763 <xs:enumeration value='none'/>
5767 Saint-Andre (ed.) Expires September 19, 2004 [Page 103]
5769 Internet-Draft XMPP IM March 2004
5772 <xs:enumeration value='remove'/>
5773 <xs:enumeration value='to'/>
5780 <xs:element name='group' type='xs:string'/>
5785 Appendix C. Differences Between Jabber IM/Presence Protocols and XMPP
5787 This section is non-normative.
5789 XMPP has been adapted from the protocols originally developed in the
5790 Jabber open-source community, which can be thought of as "XMPP 0.9".
5791 Because there exists a large installed base of Jabber implementations
5792 and deployments, it may be helpful to specify the key differences
5793 between the relevant Jabber protocols and XMPP in order to expedite
5794 and encourage upgrades of those implementations and deployments to
5795 XMPP. This section summarizes the differences that relate
5796 specifically to instant messaging and presence applications, while
5797 the corresponding section of [XMPP-CORE] summarizes the differences
5798 that relate to all XMPP applications.
5800 C.1 Session Establishment
5802 The client-to-server authentication protocol developed in the Jabber
5803 community assumed that every client is an IM client and therefore
5804 initiated an IM session upon successful authentication and resource
5805 binding, which are performed simultaneously (documention of this
5806 protocol is contained in "JEP-0078: Non-SASL Authentication",
5807 published by the Jabber Software Foundation [JSF]). XMPP maintains a
5808 stricter separation between core functionality and IM functionality;
5809 therefore, an IM session is not created until the client specifically
5810 requests one using the protocol defined under Session Establishment
5815 The Jabber community began to define a protocol for communications
5816 blocking (privacy lists) in late 2001, but that effort was deprecated
5817 once the XMPP Working Group was formed. Therefore the protocol
5818 defined under Blocking Communication (Section 10) is the only such
5819 protocol defined for use in the Jabber community.
5823 Saint-Andre (ed.) Expires September 19, 2004 [Page 104]
5825 Internet-Draft XMPP IM March 2004
5828 Intellectual Property Statement
5830 The IETF takes no position regarding the validity or scope of any
5831 intellectual property or other rights that might be claimed to
5832 pertain to the implementation or use of the technology described in
5833 this document or the extent to which any license under such rights
5834 might or might not be available; neither does it represent that it
5835 has made any effort to identify any such rights. Information on the
5836 IETF's procedures with respect to rights in standards-track and
5837 standards-related documentation can be found in BCP-11. Copies of
5838 claims of rights made available for publication and any assurances of
5839 licenses to be made available, or the result of an attempt made to
5840 obtain a general license or permission for the use of such
5841 proprietary rights by implementors or users of this specification can
5842 be obtained from the IETF Secretariat.
5844 The IETF invites any interested party to bring to its attention any
5845 copyrights, patents or patent applications, or other proprietary
5846 rights which may cover technology that may be required to practice
5847 this standard. Please address the information to the IETF Executive
5851 Full Copyright Statement
5853 Copyright (C) The Internet Society (2004). All Rights Reserved.
5855 This document and translations of it may be copied and furnished to
5856 others, and derivative works that comment on or otherwise explain it
5857 or assist in its implementation may be prepared, copied, published
5858 and distributed, in whole or in part, without restriction of any
5859 kind, provided that the above copyright notice and this paragraph are
5860 included on all such copies and derivative works. However, this
5861 document itself may not be modified in any way, such as by removing
5862 the copyright notice or references to the Internet Society or other
5863 Internet organizations, except as needed for the purpose of
5864 developing Internet standards in which case the procedures for
5865 copyrights defined in the Internet Standards process must be
5866 followed, or as required to translate it into languages other than
5869 The limited permissions granted above are perpetual and will not be
5870 revoked by the Internet Society or its successors or assignees.
5872 This document and the information contained herein is provided on an
5873 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
5874 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
5875 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
5879 Saint-Andre (ed.) Expires September 19, 2004 [Page 105]
5881 Internet-Draft XMPP IM March 2004
5884 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
5885 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
5890 Funding for the RFC Editor function is currently provided by the
5935 Saint-Andre (ed.) Expires September 19, 2004 [Page 106]