diff options
author | James Crayne <jim.crayne@gmail.com> | 2019-09-28 13:43:29 -0400 |
---|---|---|
committer | Joe Crayne <joe@jerkface.net> | 2020-01-01 19:27:53 -0500 |
commit | 11987749fc6e6d3e53ea737d46d5ab13a16faeb8 (patch) | |
tree | 5716463275c2d3e902889db619908ded2a73971c /dht/doc/rfc6121.html | |
parent | add2c76bced51fde5e9917e7449ef52be70faf87 (diff) |
Factor out some new libraries
word64-map:
Data.Word64Map
network-addr:
Network.Address
tox-crypto:
Crypto.Tox
lifted-concurrent:
Control.Concurrent.Lifted.Instrument
Control.Concurrent.Async.Lifted.Instrument
psq-wrap:
Data.Wrapper.PSQInt
Data.Wrapper.PSQ
minmax-psq:
Data.MinMaxPSQ
tasks:
Control.Concurrent.Tasks
kad:
Network.Kademlia
Network.Kademlia.Bootstrap
Network.Kademlia.Routing
Network.Kademlia.CommonAPI
Network.Kademlia.Persistence
Network.Kademlia.Search
Diffstat (limited to 'dht/doc/rfc6121.html')
-rw-r--r-- | dht/doc/rfc6121.html | 4738 |
1 files changed, 4738 insertions, 0 deletions
diff --git a/dht/doc/rfc6121.html b/dht/doc/rfc6121.html new file mode 100644 index 00000000..bd00706c --- /dev/null +++ b/dht/doc/rfc6121.html | |||
@@ -0,0 +1,4738 @@ | |||
1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ||
2 | <html lang="en"><head><title>Extensible Messaging and Presence Protocol | ||
3 | (XMPP): Instant Messaging and Presence</title> | ||
4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> | ||
5 | <meta name="description" content="Extensible Messaging and Presence Protocol | ||
6 | (XMPP): Instant Messaging and Presence"> | ||
7 | <meta name="keywords" content="XMPP, Extensible Messaging and Presence Protocol, Jabber, IM, Instant Messaging, Presence, XML, Extensible Markup Language"> | ||
8 | <meta name="generator" content="xml2rfc v1.36 (http://xml.resource.org/)"> | ||
9 | <style type='text/css'><!-- | ||
10 | body { | ||
11 | font-family: verdana, charcoal, helvetica, arial, sans-serif; | ||
12 | font-size: small; color: #000; background-color: #FFF; | ||
13 | margin: 2em; | ||
14 | } | ||
15 | h1, h2, h3, h4, h5, h6 { | ||
16 | font-family: helvetica, monaco, "MS Sans Serif", arial, sans-serif; | ||
17 | font-weight: bold; font-style: normal; | ||
18 | } | ||
19 | h1 { color: #900; background-color: transparent; text-align: right; } | ||
20 | h3 { color: #333; background-color: transparent; } | ||
21 | |||
22 | td.RFCbug { | ||
23 | font-size: x-small; text-decoration: none; | ||
24 | width: 30px; height: 30px; padding-top: 2px; | ||
25 | text-align: justify; vertical-align: middle; | ||
26 | background-color: #000; | ||
27 | } | ||
28 | td.RFCbug span.RFC { | ||
29 | font-family: monaco, charcoal, geneva, "MS Sans Serif", helvetica, verdana, sans-serif; | ||
30 | font-weight: bold; color: #666; | ||
31 | } | ||
32 | td.RFCbug span.hotText { | ||
33 | font-family: charcoal, monaco, geneva, "MS Sans Serif", helvetica, verdana, sans-serif; | ||
34 | font-weight: normal; text-align: center; color: #FFF; | ||
35 | } | ||
36 | |||
37 | table.TOCbug { width: 30px; height: 15px; } | ||
38 | td.TOCbug { | ||
39 | text-align: center; width: 30px; height: 15px; | ||
40 | color: #FFF; background-color: #900; | ||
41 | } | ||
42 | td.TOCbug a { | ||
43 | font-family: monaco, charcoal, geneva, "MS Sans Serif", helvetica, sans-serif; | ||
44 | font-weight: bold; font-size: x-small; text-decoration: none; | ||
45 | color: #FFF; background-color: transparent; | ||
46 | } | ||
47 | |||
48 | td.header { | ||
49 | font-family: arial, helvetica, sans-serif; font-size: x-small; | ||
50 | vertical-align: top; width: 33%; | ||
51 | color: #FFF; background-color: #666; | ||
52 | } | ||
53 | td.author { font-weight: bold; font-size: x-small; margin-left: 4em; } | ||
54 | td.author-text { font-size: x-small; } | ||
55 | |||
56 | /* info code from SantaKlauss at http://www.madaboutstyle.com/tooltip2.html */ | ||
57 | a.info { | ||
58 | /* This is the key. */ | ||
59 | position: relative; | ||
60 | z-index: 24; | ||
61 | text-decoration: none; | ||
62 | } | ||
63 | a.info:hover { | ||
64 | z-index: 25; | ||
65 | color: #FFF; background-color: #900; | ||
66 | } | ||
67 | a.info span { display: none; } | ||
68 | a.info:hover span.info { | ||
69 | /* The span will display just on :hover state. */ | ||
70 | display: block; | ||
71 | position: absolute; | ||
72 | font-size: smaller; | ||
73 | top: 2em; left: -5em; width: 15em; | ||
74 | padding: 2px; border: 1px solid #333; | ||
75 | color: #900; background-color: #EEE; | ||
76 | text-align: left; | ||
77 | } | ||
78 | |||
79 | a { font-weight: bold; } | ||
80 | a:link { color: #900; background-color: transparent; } | ||
81 | a:visited { color: #633; background-color: transparent; } | ||
82 | a:active { color: #633; background-color: transparent; } | ||
83 | |||
84 | p { margin-left: 2em; margin-right: 2em; } | ||
85 | p.copyright { font-size: x-small; } | ||
86 | p.toc { font-size: small; font-weight: bold; margin-left: 3em; } | ||
87 | table.toc { margin: 0 0 0 3em; padding: 0; border: 0; vertical-align: text-top; } | ||
88 | td.toc { font-size: small; font-weight: bold; vertical-align: text-top; } | ||
89 | |||
90 | ol.text { margin-left: 2em; margin-right: 2em; } | ||
91 | ul.text { margin-left: 2em; margin-right: 2em; } | ||
92 | li { margin-left: 3em; } | ||
93 | |||
94 | /* RFC-2629 <spanx>s and <artwork>s. */ | ||
95 | em { font-style: italic; } | ||
96 | strong { font-weight: bold; } | ||
97 | dfn { font-weight: bold; font-style: normal; } | ||
98 | cite { font-weight: normal; font-style: normal; } | ||
99 | tt { color: #036; } | ||
100 | tt, pre, pre dfn, pre em, pre cite, pre span { | ||
101 | font-family: "Courier New", Courier, monospace; font-size: small; | ||
102 | } | ||
103 | pre { | ||
104 | text-align: left; padding: 4px; | ||
105 | color: #000; background-color: #CCC; | ||
106 | } | ||
107 | pre dfn { color: #900; } | ||
108 | pre em { color: #66F; background-color: #FFC; font-weight: normal; } | ||
109 | pre .key { color: #33C; font-weight: bold; } | ||
110 | pre .id { color: #900; } | ||
111 | pre .str { color: #000; background-color: #CFF; } | ||
112 | pre .val { color: #066; } | ||
113 | pre .rep { color: #909; } | ||
114 | pre .oth { color: #000; background-color: #FCF; } | ||
115 | pre .err { background-color: #FCC; } | ||
116 | |||
117 | /* RFC-2629 <texttable>s. */ | ||
118 | table.all, table.full, table.headers, table.none { | ||
119 | font-size: small; text-align: center; border-width: 2px; | ||
120 | vertical-align: top; border-collapse: collapse; | ||
121 | } | ||
122 | table.all, table.full { border-style: solid; border-color: black; } | ||
123 | table.headers, table.none { border-style: none; } | ||
124 | th { | ||
125 | font-weight: bold; border-color: black; | ||
126 | border-width: 2px 2px 3px 2px; | ||
127 | } | ||
128 | table.all th, table.full th { border-style: solid; } | ||
129 | table.headers th { border-style: none none solid none; } | ||
130 | table.none th { border-style: none; } | ||
131 | table.all td { | ||
132 | border-style: solid; border-color: #333; | ||
133 | border-width: 1px 2px; | ||
134 | } | ||
135 | table.full td, table.headers td, table.none td { border-style: none; } | ||
136 | |||
137 | hr { height: 1px; } | ||
138 | hr.insert { | ||
139 | width: 80%; border-style: none; border-width: 0; | ||
140 | color: #CCC; background-color: #CCC; | ||
141 | } | ||
142 | --></style> | ||
143 | </head> | ||
144 | <body> | ||
145 | |||
146 | <table border="0" cellpadding="0" cellspacing="2" width="30" align="right"> | ||
147 | <tr> | ||
148 | <td class="RFCbug"> | ||
149 | <span class="RFC"> RFC </span><br /><span class="hotText"> 6121 </span> | ||
150 | </td> | ||
151 | </tr> | ||
152 | <tr><td class="TOCbug"><a href="#toc"> TOC </a><br /></td></tr> | ||
153 | </table> | ||
154 | <table summary="layout" width="66%" border="0" cellpadding="0" cellspacing="0"><tr><td><table summary="layout" width="100%" border="0" cellpadding="2" cellspacing="1"> | ||
155 | <tr><td class="header">Internet Engineering Task Force (IETF)</td><td class="header">P. Saint-Andre</td></tr> | ||
156 | <tr><td class="header">Request for Comments: 6121</td><td class="header">Cisco</td></tr> | ||
157 | <tr><td class="header">Obsoletes: <a href='http://tools.ietf.org/html/rfc3921'>3921</a></td><td class="header">March 2011</td></tr> | ||
158 | <tr><td class="header">Category: Standards Track</td><td class="header"> </td></tr> | ||
159 | <tr><td class="header">ISSN: 2070-1721</td><td class="header"> </td></tr> | ||
160 | </table></td></tr></table> | ||
161 | <h1><br />Extensible Messaging and Presence Protocol | ||
162 | (XMPP): Instant Messaging and Presence</h1> | ||
163 | |||
164 | <h3>Abstract</h3> | ||
165 | |||
166 | <p>This document defines extensions to core features of the Extensible Messaging and Presence Protocol (XMPP) that provide basic instant messaging (IM) and presence functionality in conformance with the requirements in RFC 2779. This document obsoletes RFC 3921. | ||
167 | </p> | ||
168 | <h3>Status of This Memo</h3> | ||
169 | <p> | ||
170 | This is an Internet Standards Track document.</p> | ||
171 | <p> | ||
172 | This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.</p> | ||
173 | <p> | ||
174 | Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc6121.</p> | ||
175 | |||
176 | <h3>Copyright Notice</h3> | ||
177 | <p> | ||
178 | Copyright (c) 2011 IETF Trust and the persons identified as the | ||
179 | document authors. All rights reserved.</p> | ||
180 | <p> | ||
181 | This document is subject to BCP 78 and the IETF Trust's Legal | ||
182 | Provisions Relating to IETF Documents | ||
183 | (http://trustee.ietf.org/license-info) in effect on the date of | ||
184 | publication of this document. Please review these documents | ||
185 | carefully, as they describe your rights and restrictions with respect | ||
186 | to this document. Code Components extracted from this document must | ||
187 | include Simplified BSD License text as described in Section 4.e of | ||
188 | the Trust Legal Provisions and are provided without warranty as | ||
189 | described in the Simplified BSD License.</p> | ||
190 | <a name="toc"></a><hr /> | ||
191 | |||
192 | <table border="0" cellpadding="0" cellspacing="2" width="30" align="right"> | ||
193 | <tr> | ||
194 | <td class="RFCbug"> | ||
195 | <span class="RFC"> RFC </span><br /><span class="hotText"> 6121 </span> | ||
196 | </td> | ||
197 | </tr> | ||
198 | <tr><td class="TOCbug"><a href="#toc"> TOC </a><br /></td></tr> | ||
199 | </table> | ||
200 | <h3>Table of Contents</h3> | ||
201 | <p class="toc"> | ||
202 | <a href="#intro">1.</a> | ||
203 | Introduction<br /> | ||
204 | <a href="#intro-overview">1.1.</a> | ||
205 | Overview<br /> | ||
206 | <a href="#intro-history">1.2.</a> | ||
207 | History<br /> | ||
208 | <a href="#intro-requirements">1.3.</a> | ||
209 | Requirements<br /> | ||
210 | <a href="#intro-summary">1.4.</a> | ||
211 | Functional Summary<br /> | ||
212 | <a href="#intro-terms">1.5.</a> | ||
213 | Terminology<br /> | ||
214 | <a href="#roster">2.</a> | ||
215 | Managing the Roster<br /> | ||
216 | <a href="#roster-syntax">2.1.</a> | ||
217 | Syntax and Semantics<br /> | ||
218 | <a href="#roster-syntax-ver">2.1.1.</a> | ||
219 | Ver Attribute<br /> | ||
220 | <a href="#roster-syntax-items">2.1.2.</a> | ||
221 | Roster Items<br /> | ||
222 | <a href="#roster-syntax-items-approved">2.1.2.1.</a> | ||
223 | Approved Attribute<br /> | ||
224 | <a href="#roster-syntax-items-ask">2.1.2.2.</a> | ||
225 | Ask Attribute<br /> | ||
226 | <a href="#roster-syntax-items-jid">2.1.2.3.</a> | ||
227 | JID Attribute<br /> | ||
228 | <a href="#roster-syntax-items-name">2.1.2.4.</a> | ||
229 | Name Attribute<br /> | ||
230 | <a href="#roster-syntax-items-subscription">2.1.2.5.</a> | ||
231 | Subscription Attribute<br /> | ||
232 | <a href="#roster-syntax-items-group">2.1.2.6.</a> | ||
233 | Group Element<br /> | ||
234 | <a href="#roster-syntax-actions-get">2.1.3.</a> | ||
235 | Roster Get<br /> | ||
236 | <a href="#roster-syntax-actions-result">2.1.4.</a> | ||
237 | Roster Result<br /> | ||
238 | <a href="#roster-syntax-actions-set">2.1.5.</a> | ||
239 | Roster Set<br /> | ||
240 | <a href="#roster-syntax-actions-push">2.1.6.</a> | ||
241 | Roster Push<br /> | ||
242 | <a href="#roster-login">2.2.</a> | ||
243 | Retrieving the Roster on Login<br /> | ||
244 | <a href="#roster-add">2.3.</a> | ||
245 | Adding a Roster Item<br /> | ||
246 | <a href="#roster-add-request">2.3.1.</a> | ||
247 | Request<br /> | ||
248 | <a href="#roster-add-success">2.3.2.</a> | ||
249 | Success Case<br /> | ||
250 | <a href="#roster-add-errors">2.3.3.</a> | ||
251 | Error Cases<br /> | ||
252 | <a href="#roster-update">2.4.</a> | ||
253 | Updating a Roster Item<br /> | ||
254 | <a href="#roster-update-request">2.4.1.</a> | ||
255 | Request<br /> | ||
256 | <a href="#roster-update-success">2.4.2.</a> | ||
257 | Success Case<br /> | ||
258 | <a href="#roster-update-error">2.4.3.</a> | ||
259 | Error Cases<br /> | ||
260 | <a href="#roster-delete">2.5.</a> | ||
261 | Deleting a Roster Item<br /> | ||
262 | <a href="#roster-delete-request">2.5.1.</a> | ||
263 | Request<br /> | ||
264 | <a href="#roster-delete-success">2.5.2.</a> | ||
265 | Success Case<br /> | ||
266 | <a href="#roster-delete-error">2.5.3.</a> | ||
267 | Error Cases<br /> | ||
268 | <a href="#roster-versioning">2.6.</a> | ||
269 | Roster Versioning<br /> | ||
270 | <a href="#roster-versioning-feature">2.6.1.</a> | ||
271 | Stream Feature<br /> | ||
272 | <a href="#roster-versioning-request">2.6.2.</a> | ||
273 | Request<br /> | ||
274 | <a href="#roster-versioning-success">2.6.3.</a> | ||
275 | Success Case<br /> | ||
276 | <a href="#sub">3.</a> | ||
277 | Managing Presence Subscriptions<br /> | ||
278 | <a href="#sub-request">3.1.</a> | ||
279 | Requesting a Subscription<br /> | ||
280 | <a href="#sub-request-gen">3.1.1.</a> | ||
281 | Client Generation of Outbound Subscription Request<br /> | ||
282 | <a href="#sub-request-outbound">3.1.2.</a> | ||
283 | Server Processing of Outbound Subscription Request<br /> | ||
284 | <a href="#sub-request-inbound">3.1.3.</a> | ||
285 | Server Processing of Inbound Subscription Request<br /> | ||
286 | <a href="#sub-request-handle">3.1.4.</a> | ||
287 | Client Processing of Inbound Subscription Request<br /> | ||
288 | <a href="#sub-request-approvalout">3.1.5.</a> | ||
289 | Server Processing of Outbound Subscription Approval<br /> | ||
290 | <a href="#sub-request-approvalin">3.1.6.</a> | ||
291 | Server Processing of Inbound Subscription Approval<br /> | ||
292 | <a href="#sub-cancel">3.2.</a> | ||
293 | Canceling a Subscription<br /> | ||
294 | <a href="#sub-cancel-gen">3.2.1.</a> | ||
295 | Client Generation of Subscription Cancellation<br /> | ||
296 | <a href="#sub-cancel-outbound">3.2.2.</a> | ||
297 | Server Processing of Outbound Subscription Cancellation<br /> | ||
298 | <a href="#sub-cancel-inbound">3.2.3.</a> | ||
299 | Server Processing of Inbound Subscription Cancellation<br /> | ||
300 | <a href="#sub-unsub">3.3.</a> | ||
301 | Unsubscribing<br /> | ||
302 | <a href="#sub-unsub-gen">3.3.1.</a> | ||
303 | Client Generation of Unsubscribe<br /> | ||
304 | <a href="#sub-unsub-outbound">3.3.2.</a> | ||
305 | Server Processing of Outbound Unsubscribe<br /> | ||
306 | <a href="#sub-unsub-inbound">3.3.3.</a> | ||
307 | Server Processing of Inbound Unsubscribe<br /> | ||
308 | <a href="#sub-preapproval">3.4.</a> | ||
309 | Pre-Approving a Subscription Request<br /> | ||
310 | <a href="#sub-preapproval-gen">3.4.1.</a> | ||
311 | Client Generation of Subscription Pre-Approval<br /> | ||
312 | <a href="#sub-preapproval-proc">3.4.2.</a> | ||
313 | Server Processing of Subscription Pre-Approval<br /> | ||
314 | <a href="#presence">4.</a> | ||
315 | Exchanging Presence Information<br /> | ||
316 | <a href="#presence-fundamentals">4.1.</a> | ||
317 | Presence Fundamentals<br /> | ||
318 | <a href="#presence-initial">4.2.</a> | ||
319 | Initial Presence<br /> | ||
320 | <a href="#presence-initial-gen">4.2.1.</a> | ||
321 | Client Generation of Initial Presence<br /> | ||
322 | <a href="#presence-initial-outbound">4.2.2.</a> | ||
323 | Server Processing of Outbound Initial Presence<br /> | ||
324 | <a href="#presence-initial-inbound">4.2.3.</a> | ||
325 | Server Processing of Inbound Initial Presence<br /> | ||
326 | <a href="#presence-initial-client">4.2.4.</a> | ||
327 | Client Processing of Initial Presence<br /> | ||
328 | <a href="#presence-probe">4.3.</a> | ||
329 | Presence Probes<br /> | ||
330 | <a href="#presence-probe-outbound">4.3.1.</a> | ||
331 | Server Generation of Outbound Presence Probe<br /> | ||
332 | <a href="#presence-probe-inbound">4.3.2.</a> | ||
333 | Server Processing of Inbound Presence Probe<br /> | ||
334 | <a href="#presence-probe-inbound-id">4.3.2.1.</a> | ||
335 | Handling of the 'id' Attribute<br /> | ||
336 | <a href="#presence-broadcast">4.4.</a> | ||
337 | Subsequent Presence Broadcast<br /> | ||
338 | <a href="#presence-broadcast-gen">4.4.1.</a> | ||
339 | Client Generation of Subsequent Presence Broadcast<br /> | ||
340 | <a href="#presence-broadcast-outbound">4.4.2.</a> | ||
341 | Server Processing of Subsequent Outbound Presence<br /> | ||
342 | <a href="#presence-broadcast-inbound">4.4.3.</a> | ||
343 | Server Processing of Subsequent Inbound Presence<br /> | ||
344 | <a href="#presence-broadcast-client">4.4.4.</a> | ||
345 | Client Processing of Subsequent Presence<br /> | ||
346 | <a href="#presence-unavailable">4.5.</a> | ||
347 | Unavailable Presence<br /> | ||
348 | <a href="#presence-unavailable-gen">4.5.1.</a> | ||
349 | Client Generation of Unavailable Presence<br /> | ||
350 | <a href="#presence-unavailable-outbound">4.5.2.</a> | ||
351 | Server Processing of Outbound Unavailable Presence<br /> | ||
352 | <a href="#presence-unavailable-inbound">4.5.3.</a> | ||
353 | Server Processing of Inbound Unavailable Presence<br /> | ||
354 | <a href="#presence-unavailable-client">4.5.4.</a> | ||
355 | Client Processing of Unavailable Presence<br /> | ||
356 | <a href="#presence-directed">4.6.</a> | ||
357 | Directed Presence<br /> | ||
358 | <a href="#presence-directed-considerations">4.6.1.</a> | ||
359 | General Considerations<br /> | ||
360 | <a href="#presence-directed-gen">4.6.2.</a> | ||
361 | Client Generation of Directed Presence<br /> | ||
362 | <a href="#presence-directed-outbound">4.6.3.</a> | ||
363 | Server Processing of Outbound Directed Presence<br /> | ||
364 | <a href="#presence-directed-inbound">4.6.4.</a> | ||
365 | Server Processing of Inbound Directed Presence<br /> | ||
366 | <a href="#presence-directed-client">4.6.5.</a> | ||
367 | Client Processing of Inbound Directed Presence<br /> | ||
368 | <a href="#presence-directed-probe">4.6.6.</a> | ||
369 | Server Processing of Presence Probes<br /> | ||
370 | <a href="#presence-syntax">4.7.</a> | ||
371 | Presence Syntax<br /> | ||
372 | <a href="#presence-syntax-type">4.7.1.</a> | ||
373 | Type Attribute<br /> | ||
374 | <a href="#presence-syntax-children">4.7.2.</a> | ||
375 | Child Elements<br /> | ||
376 | <a href="#presence-syntax-children-show">4.7.2.1.</a> | ||
377 | Show Element<br /> | ||
378 | <a href="#presence-syntax-children-status">4.7.2.2.</a> | ||
379 | Status Element<br /> | ||
380 | <a href="#presence-syntax-children-priority">4.7.2.3.</a> | ||
381 | Priority Element<br /> | ||
382 | <a href="#presence-extended">4.7.3.</a> | ||
383 | Extended Content<br /> | ||
384 | <a href="#message">5.</a> | ||
385 | Exchanging Messages<br /> | ||
386 | <a href="#message-chat">5.1.</a> | ||
387 | One-to-One Chat Sessions<br /> | ||
388 | <a href="#message-syntax">5.2.</a> | ||
389 | Message Syntax<br /> | ||
390 | <a href="#message-syntax-to">5.2.1.</a> | ||
391 | To Attribute<br /> | ||
392 | <a href="#message-syntax-type">5.2.2.</a> | ||
393 | Type Attribute<br /> | ||
394 | <a href="#message-syntax-body">5.2.3.</a> | ||
395 | Body Element<br /> | ||
396 | <a href="#message-syntax-subject">5.2.4.</a> | ||
397 | Subject Element<br /> | ||
398 | <a href="#message-syntax-thread">5.2.5.</a> | ||
399 | Thread Element<br /> | ||
400 | <a href="#message-syntax-extended">5.3.</a> | ||
401 | Extended Content<br /> | ||
402 | <a href="#iq">6.</a> | ||
403 | Exchanging IQ Stanzas<br /> | ||
404 | <a href="#session">7.</a> | ||
405 | A Sample Session<br /> | ||
406 | <a href="#rules">8.</a> | ||
407 | Server Rules for Processing XML Stanzas<br /> | ||
408 | <a href="#rules-general">8.1.</a> | ||
409 | General Considerations<br /> | ||
410 | <a href="#rules-noto">8.2.</a> | ||
411 | No 'to' Address<br /> | ||
412 | <a href="#rules-remote">8.3.</a> | ||
413 | Remote Domain<br /> | ||
414 | <a href="#rules-local">8.4.</a> | ||
415 | Local Domain<br /> | ||
416 | <a href="#rules-localpart">8.5.</a> | ||
417 | Local User<br /> | ||
418 | <a href="#rules-localpart-nosuchuser">8.5.1.</a> | ||
419 | No Such User<br /> | ||
420 | <a href="#rules-localpart-barejid">8.5.2.</a> | ||
421 | localpart@domainpart<br /> | ||
422 | <a href="#rules-localpart-barejid-resource">8.5.2.1.</a> | ||
423 | Available or Connected Resources<br /> | ||
424 | <a href="#rules-localpart-barejid-noresource">8.5.2.2.</a> | ||
425 | No Available or Connected Resources<br /> | ||
426 | <a href="#rules-localpart-fulljid">8.5.3.</a> | ||
427 | localpart@domainpart/resourcepart<br /> | ||
428 | <a href="#rules-localpart-fulljid-match">8.5.3.1.</a> | ||
429 | Resource Matches<br /> | ||
430 | <a href="#rules-localpart-fulljid-nomatch">8.5.3.2.</a> | ||
431 | No Resource Matches<br /> | ||
432 | <a href="#rules-local-message">8.5.4.</a> | ||
433 | Summary of Message Delivery Rules<br /> | ||
434 | <a href="#uri">9.</a> | ||
435 | Handling of URIs<br /> | ||
436 | <a href="#i18n">10.</a> | ||
437 | Internationalization Considerations<br /> | ||
438 | <a href="#security">11.</a> | ||
439 | Security Considerations<br /> | ||
440 | <a href="#conformance">12.</a> | ||
441 | Conformance Requirements<br /> | ||
442 | <a href="#rfc.references1">13.</a> | ||
443 | References<br /> | ||
444 | <a href="#rfc.references1">13.1.</a> | ||
445 | Normative References<br /> | ||
446 | <a href="#rfc.references2">13.2.</a> | ||
447 | Informative References<br /> | ||
448 | <a href="#substates">Appendix A.</a> | ||
449 | Subscription States<br /> | ||
450 | <a href="#substates-defined">A.1.</a> | ||
451 | Defined States<br /> | ||
452 | <a href="#substates-out">A.2.</a> | ||
453 | Server Processing of Outbound Presence Subscription Stanzas<br /> | ||
454 | <a href="#substates-out-subscribe">A.2.1.</a> | ||
455 | Subscribe<br /> | ||
456 | <a href="#substates-out-unsubscribe">A.2.2.</a> | ||
457 | Unsubscribe<br /> | ||
458 | <a href="#substates-out-subscribed">A.2.3.</a> | ||
459 | Subscribed<br /> | ||
460 | <a href="#substates-out-unsubscribed">A.2.4.</a> | ||
461 | Unsubscribed<br /> | ||
462 | <a href="#substates-in">A.3.</a> | ||
463 | Server Processing of Inbound Presence Subscription Stanzas<br /> | ||
464 | <a href="#substates-in-subscribe">A.3.1.</a> | ||
465 | Subscribe<br /> | ||
466 | <a href="#substates-in-unsubscribe">A.3.2.</a> | ||
467 | Unsubscribe<br /> | ||
468 | <a href="#substates-in-subscribed">A.3.3.</a> | ||
469 | Subscribed<br /> | ||
470 | <a href="#substates-in-unsubscribed">A.3.4.</a> | ||
471 | Unsubscribed<br /> | ||
472 | <a href="#blocking">Appendix B.</a> | ||
473 | Blocking Communication<br /> | ||
474 | <a href="#vcard">Appendix C.</a> | ||
475 | vCards<br /> | ||
476 | <a href="#schema">Appendix D.</a> | ||
477 | XML Schema for jabber:iq:roster<br /> | ||
478 | <a href="#diffs">Appendix E.</a> | ||
479 | Differences From RFC 3921<br /> | ||
480 | <a href="#acks">Appendix F.</a> | ||
481 | Acknowledgements<br /> | ||
482 | </p> | ||
483 | <br clear="all" /> | ||
484 | |||
485 | <a name="intro"></a><br /><hr /> | ||
486 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
487 | <a name="rfc.section.1"></a><h3>1. | ||
488 | Introduction</h3> | ||
489 | |||
490 | <a name="intro-overview"></a><br /><hr /> | ||
491 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
492 | <a name="rfc.section.1.1"></a><h3>1.1. | ||
493 | Overview</h3> | ||
494 | |||
495 | <p>The Extensible Messaging and Presence Protocol (XMPP) is an application profile of the Extensible Markup Language <a class='info' href='#XML'>[XML]<span> (</span><span class='info'>Maler, E., Yergeau, F., Sperberg-McQueen, C., Paoli, J., and T. Bray, “Extensible Markup Language (XML) 1.0 (Fifth Edition),” November 2008.</span><span>)</span></a> that enables the near-real-time exchange of structured yet extensible data between any two or more network entities. The core features of XMPP defined in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a> provide the building blocks for many types of near-real-time applications, which can be layered on top of the core by sending application-specific data qualified by particular XML namespaces (refer to <a class='info' href='#XML-NAMES'>[XML‑NAMES]<span> (</span><span class='info'>Bray, T., Hollander, D., and A. Layman, “Namespaces in XML,” January 1999.</span><span>)</span></a>). This document defines XMPP extensions that provide the basic functionality expected of an instant messaging (IM) and presence application as described in <a class='info' href='#IMP-REQS'>[IMP‑REQS]<span> (</span><span class='info'>Day, M., Aggarwal, S., and J. Vincent, “Instant Messaging / Presence Protocol Requirements,” February 2000.</span><span>)</span></a>. | ||
496 | </p> | ||
497 | <a name="intro-history"></a><br /><hr /> | ||
498 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
499 | <a name="rfc.section.1.2"></a><h3>1.2. | ||
500 | History</h3> | ||
501 | |||
502 | <p>The basic syntax and semantics of XMPP were developed originally within the Jabber open-source community, mainly in 1999. In late 2002, the XMPP Working Group was chartered with developing an adaptation of the core Jabber protocol that would be suitable as an IETF IM and presence technology in accordance with <a class='info' href='#IMP-REQS'>[IMP‑REQS]<span> (</span><span class='info'>Day, M., Aggarwal, S., and J. Vincent, “Instant Messaging / Presence Protocol Requirements,” February 2000.</span><span>)</span></a>. In October 2004, <a class='info' href='#RFC3920'>[RFC3920]<span> (</span><span class='info'>Saint-Andre, P., Ed., “Extensible Messaging and Presence Protocol (XMPP): Core,” October 2004.</span><span>)</span></a> and <a class='info' href='#RFC3921'>[RFC3921]<span> (</span><span class='info'>Saint-Andre, P., Ed., “Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence,” October 2004.</span><span>)</span></a> were published, representing the most complete definition of XMPP at that time. | ||
503 | </p> | ||
504 | <p>Since 2004 the Internet community has gained extensive implementation and deployment experience with XMPP, including formal interoperability testing carried out under the auspices of the XMPP Standards Foundation (XSF). This document incorporates comprehensive feedback from software developers and service providers, including a number of backward-compatible modifications summarized under <a class='info' href='#diffs'>Appendix E<span> (</span><span class='info'>Differences From RFC 3921</span><span>)</span></a>. As a result, this document reflects the rough consensus of the Internet community regarding the IM and presence features of XMPP 1.0, thus obsoleting RFC 3921. | ||
505 | </p> | ||
506 | <a name="intro-requirements"></a><br /><hr /> | ||
507 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
508 | <a name="rfc.section.1.3"></a><h3>1.3. | ||
509 | Requirements</h3> | ||
510 | |||
511 | <p>Traditionally, IM applications have combined the following factors: | ||
512 | </p> | ||
513 | <p> | ||
514 | </p> | ||
515 | <ol class="text"> | ||
516 | <li>The central point of focus is a list of one's contacts or "buddies" (in XMPP this list is called a "roster"). | ||
517 | </li> | ||
518 | <li>The purpose of using such an application is to exchange relatively brief text messages with particular contacts in close to real time -- often relatively large numbers of such messages in rapid succession, in the form of a one-to-one "chat session" as described under <a class='info' href='#message-chat'>Section 5.1<span> (</span><span class='info'>One-to-One Chat Sessions</span><span>)</span></a>. | ||
519 | </li> | ||
520 | <li>The catalyst for exchanging messages is "presence" -- i.e., information about the network availability of particular contacts (thus knowing who is online and available for a one-to-one chat session). | ||
521 | </li> | ||
522 | <li>Presence information is provided only to contacts that one has authorized by means of an explicit agreement called a "presence subscription". | ||
523 | </li> | ||
524 | </ol><p> | ||
525 | |||
526 | </p> | ||
527 | <p>Thus at a high level this document assumes that a user needs to be able to complete the following use cases: | ||
528 | </p> | ||
529 | <p> | ||
530 | </p> | ||
531 | <ul class="text"> | ||
532 | <li>Manage items in one's contact list | ||
533 | </li> | ||
534 | <li>Exchange messages with one's contacts | ||
535 | </li> | ||
536 | <li>Exchange presence information with one's contacts | ||
537 | </li> | ||
538 | <li>Manage presence subscriptions to and from one's contacts | ||
539 | </li> | ||
540 | </ul><p> | ||
541 | |||
542 | </p> | ||
543 | <p>Detailed definitions of these functionality areas are contained in RFC 2779 <a class='info' href='#IMP-REQS'>[IMP‑REQS]<span> (</span><span class='info'>Day, M., Aggarwal, S., and J. Vincent, “Instant Messaging / Presence Protocol Requirements,” February 2000.</span><span>)</span></a>, and the interested reader is referred to that document regarding in-depth requirements. Although the XMPP IM and presence extensions specified herein meet the requirements of RFC 2779, they were not designed explicitly with that specification in mind, since the base protocol evolved through an open development process within the Jabber open-source community before RFC 2779 was written. Although XMPP protocol extensions addressing many other functionality areas have been defined in the XMPP Standards Foundation's XEP series (e.g., multi-user text chat as specified in <a class='info' href='#XEP-0045'>[XEP‑0045]<span> (</span><span class='info'>Saint-Andre, P., “Multi-User Chat,” July 2008.</span><span>)</span></a>), such extensions are not specified in this document because they are not mandated by RFC 2779. | ||
544 | </p> | ||
545 | <p></p> | ||
546 | <blockquote class="text"> | ||
547 | <p>Implementation Note: RFC 2779 stipulates that presence services must be separable from IM services and vice-versa; i.e., it must be possible to use the protocol to provide a presence service, a messaging service, or both. Although the text of this document assumes that implementations and deployments will want to offer a unified IM and presence service, it is not mandatory for an XMPP service to offer both a presence service and a messaging service, and the protocol makes it possible to offer separate and distinct services for presence and for messaging. (For example, a presence-only service could return a <service-unavailable/> stanza error if a client attempts to send a <message/> stanza.) | ||
548 | </p> | ||
549 | </blockquote> | ||
550 | |||
551 | <a name="intro-summary"></a><br /><hr /> | ||
552 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
553 | <a name="rfc.section.1.4"></a><h3>1.4. | ||
554 | Functional Summary</h3> | ||
555 | |||
556 | <p>This non-normative section provides a developer-friendly, functional summary of XMPP-based IM and presence features; consult the sections that follow for a normative definition of these features. | ||
557 | </p> | ||
558 | <p><a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a> specifies how an XMPP client connects to an XMPP server. In particular, it specifies the preconditions that need to be fulfilled before a client is allowed to send XML stanzas (the basic unit of meaning in XMPP) to other entities on an XMPP network. These preconditions comprise negotiation of the XML stream and include exchange of XML stream headers, optional channel encryption via Transport Layer Security <a class='info' href='#TLS'>[TLS]<span> (</span><span class='info'>Dierks, T. and E. Rescorla, “The Transport Layer Security (TLS) Protocol Version 1.2,” August 2008.</span><span>)</span></a>, mandatory authentication via Simple Authentication and Security Layer <a class='info' href='#SASL'>[SASL]<span> (</span><span class='info'>Melnikov, A. and K. Zeilenga, “Simple Authentication and Security Layer (SASL),” June 2006.</span><span>)</span></a>, and binding of a resource to the stream for client addressing. The reader is referred to <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a> for details regarding these preconditions, and knowledge of <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a> is assumed herein. | ||
559 | </p> | ||
560 | <p></p> | ||
561 | <blockquote class="text"> | ||
562 | <p>Interoperability Note: <a class='info' href='#RFC3921'>[RFC3921]<span> (</span><span class='info'>Saint-Andre, P., Ed., “Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence,” October 2004.</span><span>)</span></a> specified one additional precondition: formal establishment of an instant messaging and presence session. Implementation and deployment experience has shown that this additional step is unnecessary. However, for backward compatibility an implementation MAY still offer that feature. This enables older software to connect while letting newer software save a round trip. | ||
563 | </p> | ||
564 | </blockquote> | ||
565 | |||
566 | <p>Upon fulfillment of the preconditions specified in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>, an XMPP client has a long-lived XML stream with an XMPP server, which enables the user controlling that client to send and receive a potentially unlimited number of XML stanzas over the stream. Such a stream can be used to exchange messages, share presence information, and engage in structured request-response interactions in close to real time. After negotiation of the XML stream, the typical flow for an instant messaging and presence session is as follows: | ||
567 | </p> | ||
568 | <p> | ||
569 | </p> | ||
570 | <ol class="text"> | ||
571 | <li>Retrieve one's roster. (See <a class='info' href='#roster-login'>Section 2.2<span> (</span><span class='info'>Retrieving the Roster on Login</span><span>)</span></a>.) | ||
572 | </li> | ||
573 | <li>Send initial presence to the server for broadcast to all subscribed contacts, thus "going online" from the perspective of XMPP communication. (See <a class='info' href='#presence-initial'>Section 4.2<span> (</span><span class='info'>Initial Presence</span><span>)</span></a>.) | ||
574 | </li> | ||
575 | <li>Exchange messages, manage presence subscriptions, perform roster | ||
576 | updates, and in general process and generate other XML stanzas with particular | ||
577 | semantics throughout the life of the session. (See Sections <a class='info' href='#message'>5<span> (</span><span class='info'>Exchanging Messages</span><span>)</span></a>, <a class='info' href='#sub'>3<span> (</span><span class='info'>Managing Presence Subscriptions</span><span>)</span></a>, | ||
578 | <a class='info' href='#roster'>2<span> (</span><span class='info'>Managing the Roster</span><span>)</span></a>, and <a class='info' href='#iq'>6<span> (</span><span class='info'>Exchanging IQ Stanzas</span><span>)</span></a>.) | ||
579 | </li> | ||
580 | <li>Terminate the session when desired by sending unavailable presence and closing the underlying XML stream. (See <a class='info' href='#presence-unavailable'>Section 4.5<span> (</span><span class='info'>Unavailable Presence</span><span>)</span></a>.) | ||
581 | </li> | ||
582 | </ol><p> | ||
583 | |||
584 | </p> | ||
585 | <a name="intro-terms"></a><br /><hr /> | ||
586 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
587 | <a name="rfc.section.1.5"></a><h3>1.5. | ||
588 | Terminology</h3> | ||
589 | |||
590 | <p>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 <a class='info' href='#KEYWORDS'>[KEYWORDS]<span> (</span><span class='info'>Bradner, S., “Key words for use in RFCs to Indicate Requirement Levels,” March 1997.</span><span>)</span></a>. | ||
591 | </p> | ||
592 | <p>This document inherits the terminology defined in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>. | ||
593 | </p> | ||
594 | <p>The terms "automated client" and "interactive client" are to be understood in the sense defined in <a class='info' href='#TLS-CERTS'>[TLS‑CERTS]<span> (</span><span class='info'>Saint-Andre, P. and J. Hodges, “Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS),” March 2011.</span><span>)</span></a>. | ||
595 | </p> | ||
596 | <p>For convenience, this document employs the term "user" to refer to the owner of an XMPP account; however, account owners need not be humans and can be bots, devices, or other automated applications. | ||
597 | </p> | ||
598 | <p>Several other terms, such as "interested resource", are defined within the body of this document. | ||
599 | </p> | ||
600 | <p>Following the "XML Notation" used in <a class='info' href='#IRI'>[IRI]<span> (</span><span class='info'>Duerst, M. and M. Suignard, “Internationalized Resource Identifiers (IRIs),” January 2005.</span><span>)</span></a> to represent characters that cannot be rendered in ASCII-only documents, some examples in this document use the form "&#x...." as a notational device to represent <a class='info' href='#UNICODE'>[UNICODE]<span> (</span><span class='info'>The Unicode Consortium, “The Unicode Standard, Version 6.0,” 2010.</span><span>)</span></a> characters (e.g., the string "&#x0159;" stands for the Unicode character LATIN SMALL LETTER R WITH CARON); this form is definitely not to be sent over the wire in XMPP systems. | ||
601 | </p> | ||
602 | <p>In examples, lines have been wrapped for improved readability, "[...]" means elision, and the following prepended strings are used (these prepended strings are not to be sent over the wire): | ||
603 | </p> | ||
604 | <p> | ||
605 | </p> | ||
606 | <ul class="text"> | ||
607 | <li>C: = client | ||
608 | </li> | ||
609 | <li>CC: = contact's client | ||
610 | </li> | ||
611 | <li>CS: = contact's server | ||
612 | </li> | ||
613 | <li>S: = server | ||
614 | </li> | ||
615 | <li>UC: = user's client | ||
616 | </li> | ||
617 | <li>US: = user's server | ||
618 | </li> | ||
619 | </ul><p> | ||
620 | |||
621 | </p> | ||
622 | <p>Readers need to be aware that the examples are not exhaustive | ||
623 | and that, in examples for some protocol flows, the alternate | ||
624 | steps shown would not necessarily be triggered by the exact data | ||
625 | sent in the previous step; in all cases, the protocol definitions specified in this document or in normatively referenced documents rule over any examples provided here. All examples are fictional and the information exchanged (e.g., usernames and passwords) does not represent any existing users or servers. | ||
626 | </p> | ||
627 | <a name="roster"></a><br /><hr /> | ||
628 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
629 | <a name="rfc.section.2"></a><h3>2. | ||
630 | Managing the Roster</h3> | ||
631 | |||
632 | <p>In XMPP, a user's roster contains any number of specific contacts. A user's roster is stored by the user's server on the user's behalf so that the user can access roster information from any device. When the user adds items to the roster or modifies existing items, if an error does not occur then the server SHOULD store that data unmodified if at all possible and MUST return the data it has stored when an authorized client requests the roster. | ||
633 | </p> | ||
634 | <p></p> | ||
635 | <blockquote class="text"> | ||
636 | <p>Security Warning: Because the user's roster can contain confidential data, the server MUST restrict access to this data so that only authorized entities (typically limited to the account owner) are able to retrieve, modify, or delete it. | ||
637 | </p> | ||
638 | </blockquote> | ||
639 | |||
640 | <p>RFC 3921 assumed that the only place where a user stores their roster is the server where the user's account is registered and at which the user authenticates for access to the XMPP network. This specification removes that strict coupling of roster storage to account registration and network authentication, with the result that a user could store their roster at another location, or could have multiple rosters that are stored in multiple locations. However, in the absence of implementation and deployment experience with a more flexible roster storage model, this specification retains the terminology of RFC 3921 by using the terms "client" and "server" (and "the roster" instead of "a roster"), rather than coining a new term for "a place where a user stores a roster". Future documents might provide normative rules for non-server roster storage or for the management of multiple rosters, but such rules are out of scope for this document. | ||
641 | </p> | ||
642 | <a name="roster-syntax"></a><br /><hr /> | ||
643 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
644 | <a name="rfc.section.2.1"></a><h3>2.1. | ||
645 | Syntax and Semantics</h3> | ||
646 | |||
647 | <p>Rosters are managed using <iq/> stanzas (see Section 8.2.3 of | ||
648 | <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>), specifically by means of a <query/> child element qualified by the 'jabber:iq:roster' namespace. The detailed syntax and semantics are defined in the following sections. | ||
649 | </p> | ||
650 | <a name="roster-syntax-ver"></a><br /><hr /> | ||
651 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
652 | <a name="rfc.section.2.1.1"></a><h3>2.1.1. | ||
653 | Ver Attribute</h3> | ||
654 | |||
655 | <p>The 'ver' attribute is a string that identifies a particular version of the roster information. The value MUST be generated only by the server and MUST be treated by the client as opaque. The server can use any appropriate method for generating the version ID, such as a hash of the roster data or a strictly increasing sequence number. | ||
656 | </p> | ||
657 | <p>Inclusion of the 'ver' attribute is RECOMMENDED. | ||
658 | </p> | ||
659 | <p>Use of the 'ver' attribute is described more fully under <a class='info' href='#roster-versioning'>Section 2.6<span> (</span><span class='info'>Roster Versioning</span><span>)</span></a>. | ||
660 | </p> | ||
661 | <p></p> | ||
662 | <blockquote class="text"> | ||
663 | <p>Interoperability Note: The 'ver' attribute of the <query/> element was not defined in RFC 3921 and is newly defined in this specification. | ||
664 | </p> | ||
665 | </blockquote> | ||
666 | |||
667 | <a name="roster-syntax-items"></a><br /><hr /> | ||
668 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
669 | <a name="rfc.section.2.1.2"></a><h3>2.1.2. | ||
670 | Roster Items</h3> | ||
671 | |||
672 | <p>The <query/> element inside a <a class='info' href='#roster-syntax-actions-set'>roster set<span> (</span><span class='info'>Roster Set</span><span>)</span></a> contains one <item/> child, and a <a class='info' href='#roster-syntax-actions-result'>roster result<span> (</span><span class='info'>Roster Result</span><span>)</span></a> typically contains multiple <item/> children. Each <item/> element describes a unique "roster item" (sometimes also called a "contact"). | ||
673 | </p> | ||
674 | <p>The syntax of the <item/> element is described in the following sections. | ||
675 | </p> | ||
676 | <a name="roster-syntax-items-approved"></a><br /><hr /> | ||
677 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
678 | <a name="rfc.section.2.1.2.1"></a><h3>2.1.2.1. | ||
679 | Approved Attribute</h3> | ||
680 | |||
681 | <p>The boolean 'approved' attribute with a value of "true" is used to signal subscription pre-approval as described under <a class='info' href='#sub-preapproval'>Section 3.4<span> (</span><span class='info'>Pre-Approving a Subscription Request</span><span>)</span></a> (the default is "false", in accordance with <a class='info' href='#XML-DATATYPES'>[XML‑DATATYPES]<span> (</span><span class='info'>Biron, P. and A. Malhotra, “XML Schema Part 2: Datatypes Second Edition,” October 2004.</span><span>)</span></a>). | ||
682 | </p> | ||
683 | <p>A server SHOULD include the 'approved' attribute to inform the client of subscription pre-approvals. A client MUST NOT include the 'approved' attribute in the roster sets it sends to the server, but instead MUST use presence stanzas of type "subscribed" and "unsubscribed" to manage pre-approvals as described under <a class='info' href='#sub-preapproval'>Section 3.4<span> (</span><span class='info'>Pre-Approving a Subscription Request</span><span>)</span></a>. | ||
684 | </p> | ||
685 | <p></p> | ||
686 | <blockquote class="text"> | ||
687 | <p>Interoperability Note: The 'approved' attribute of the <item/> element was not defined in RFC 3921 and is newly defined in this specification. | ||
688 | </p> | ||
689 | </blockquote> | ||
690 | |||
691 | <a name="roster-syntax-items-ask"></a><br /><hr /> | ||
692 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
693 | <a name="rfc.section.2.1.2.2"></a><h3>2.1.2.2. | ||
694 | Ask Attribute</h3> | ||
695 | |||
696 | <p>The 'ask' attribute of the <item/> element with a value of "subscribe" is used to signal various subscription sub-states that include a "Pending Out" aspect as described under <a class='info' href='#sub-request-outbound'>Section 3.1.2<span> (</span><span class='info'>Server Processing of Outbound Subscription Request</span><span>)</span></a>. | ||
697 | </p> | ||
698 | <p>A server SHOULD include the 'ask' attribute to inform the client of "Pending Out" sub-states. A client MUST NOT include the 'ask' attribute in the roster sets it sends to the server, but instead MUST use presence stanzas of type "subscribe" and "unsubscribe" to manage such sub-states as described under <a class='info' href='#sub-request-outbound'>Section 3.1.2<span> (</span><span class='info'>Server Processing of Outbound Subscription Request</span><span>)</span></a>. | ||
699 | </p> | ||
700 | <a name="roster-syntax-items-jid"></a><br /><hr /> | ||
701 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
702 | <a name="rfc.section.2.1.2.3"></a><h3>2.1.2.3. | ||
703 | JID Attribute</h3> | ||
704 | |||
705 | <p>The 'jid' attribute of the <item/> element specifies the Jabber Identifier (JID) that uniquely identifies the roster item. | ||
706 | </p> | ||
707 | <p>The 'jid' attribute is REQUIRED whenever a client or server adds, updates, deletes, or returns a roster item. | ||
708 | </p> | ||
709 | <a name="roster-syntax-items-name"></a><br /><hr /> | ||
710 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
711 | <a name="rfc.section.2.1.2.4"></a><h3>2.1.2.4. | ||
712 | Name Attribute</h3> | ||
713 | |||
714 | <p>The 'name' attribute of the <item/> element specifies the "handle" to be associated with the JID, as determined by the user (not the contact). Although the value of the 'name' attribute MAY have meaning to a human user, it is opaque to the server. However, the 'name' attribute MAY be used by the server for matching purposes within the context of various XMPP extensions (one possible comparison method is that described for XMPP resourceparts in <a class='info' href='#XMPP-ADDR'>[XMPP‑ADDR]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Address Format,” March 2011.</span><span>)</span></a>). | ||
715 | </p> | ||
716 | <p>It is OPTIONAL for a client to include the 'name' attribute when adding or updating a roster item. | ||
717 | </p> | ||
718 | <a name="roster-syntax-items-subscription"></a><br /><hr /> | ||
719 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
720 | <a name="rfc.section.2.1.2.5"></a><h3>2.1.2.5. | ||
721 | Subscription Attribute</h3> | ||
722 | |||
723 | <p>The state of the presence subscription is captured in the 'subscription' attribute of the <item/> element. The defined subscription-related values are: | ||
724 | </p> | ||
725 | <p> | ||
726 | </p> | ||
727 | <blockquote class="text"><dl> | ||
728 | <dt>none:</dt> | ||
729 | <dd>the user does not have a subscription to the contact's presence, and the contact does not have a subscription to the user's presence; this is the default value, so if the subscription attribute is not included then the state is to be understood as "none" | ||
730 | </dd> | ||
731 | <dt>to:</dt> | ||
732 | <dd>the user has a subscription to the contact's presence, but the contact does not have a subscription to the user's presence | ||
733 | </dd> | ||
734 | <dt>from:</dt> | ||
735 | <dd>the contact has a subscription to the user's presence, but the user does not have a subscription to the contact's presence | ||
736 | </dd> | ||
737 | <dt>both:</dt> | ||
738 | <dd>the user and the contact have subscriptions to each other's presence (also called a "mutual subscription") | ||
739 | </dd> | ||
740 | </dl></blockquote><p> | ||
741 | |||
742 | </p> | ||
743 | <p>In a <a class='info' href='#roster-syntax-actions-result'>roster result<span> (</span><span class='info'>Roster Result</span><span>)</span></a>, the client MUST ignore values of the 'subscription' attribute other than "none", "to", "from", or "both". | ||
744 | </p> | ||
745 | <p>In a <a class='info' href='#roster-syntax-actions-push'>roster push<span> (</span><span class='info'>Roster Push</span><span>)</span></a>, the client MUST ignore values of the 'subscription' attribute other than "none", "to", "from", "both", or "remove". | ||
746 | </p> | ||
747 | <p>In a <a class='info' href='#roster-syntax-actions-set'>roster set<span> (</span><span class='info'>Roster Set</span><span>)</span></a>, the 'subscription' attribute MAY be included with a value of "remove", which indicates that the item is to be removed from the roster; in a roster set the server MUST ignore all values of the 'subscription' attribute other than "remove". | ||
748 | </p> | ||
749 | <p>Inclusion of the 'subscription' attribute is OPTIONAL. | ||
750 | </p> | ||
751 | <a name="roster-syntax-items-group"></a><br /><hr /> | ||
752 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
753 | <a name="rfc.section.2.1.2.6"></a><h3>2.1.2.6. | ||
754 | Group Element</h3> | ||
755 | |||
756 | <p>The <group/> child element specifies a category or "bucket" into which the roster item is to be grouped by a client. An <item/> element MAY contain more than one <group/> element, which means that roster groups are not exclusive. Although the XML character data of the <group/> element MAY have meaning to a human user, it is opaque to the server. However, the <group/> element MAY be used by the server for matching purposes within the context of various XMPP extensions (one possible comparison method is that described for XMPP resourceparts in <a class='info' href='#XMPP-ADDR'>[XMPP‑ADDR]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Address Format,” March 2011.</span><span>)</span></a>). | ||
757 | </p> | ||
758 | <p>It is OPTIONAL for a client to include the <group/> element when adding or updating a roster item. If a <a class='info' href='#roster-syntax-actions-set'>roster set<span> (</span><span class='info'>Roster Set</span><span>)</span></a> includes no <group/> element, then the item is to be interpreted as being affiliated with no group. | ||
759 | </p> | ||
760 | <a name="roster-syntax-actions-get"></a><br /><hr /> | ||
761 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
762 | <a name="rfc.section.2.1.3"></a><h3>2.1.3. | ||
763 | Roster Get</h3> | ||
764 | |||
765 | <p>A "roster get" is a client's request for the server to return the roster; syntactically it is an IQ stanza of type "get" sent from client to server and containing a <query/> element qualified by the 'jabber:iq:roster' namespace, where the <query/> element MUST NOT contain any <item/> child elements. | ||
766 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
767 | C: <iq from='juliet@example.com/balcony' | ||
768 | id='bv1bs71f' | ||
769 | type='get'> | ||
770 | <query xmlns='jabber:iq:roster'/> | ||
771 | </iq> | ||
772 | </pre></div> | ||
773 | <p>The expected outcome of sending a roster get is for the server to return a roster result. | ||
774 | </p> | ||
775 | <a name="roster-syntax-actions-result"></a><br /><hr /> | ||
776 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
777 | <a name="rfc.section.2.1.4"></a><h3>2.1.4. | ||
778 | Roster Result</h3> | ||
779 | |||
780 | <p>A "roster result" is the server's response to a roster get; syntactically it is an IQ stanza of type "result" sent from server to client and containing a <query/> element qualified by the 'jabber:iq:roster' namespace. | ||
781 | </p> | ||
782 | <p>The <query/> element in a roster result contains one <item/> element for each contact and therefore can contain more than one <item/> element. | ||
783 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
784 | S: <iq id='bv1bs71f' | ||
785 | to='juliet@example.com/chamber' | ||
786 | type='result'> | ||
787 | <query xmlns='jabber:iq:roster' ver='ver7'> | ||
788 | <item jid='nurse@example.com'/> | ||
789 | <item jid='romeo@example.net'/> | ||
790 | </query> | ||
791 | </iq> | ||
792 | </pre></div> | ||
793 | <p>If the roster exists but there are no contacts in the roster, then the server MUST return an IQ-result containing a child <query/> element that in turn contains no <item/> children (i.e., the server MUST NOT return an empty <iq/> stanza of type "error"). | ||
794 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
795 | S: <iq id='bv1bs71f' | ||
796 | to='juliet@example.com/chamber' | ||
797 | type='result'> | ||
798 | <query xmlns='jabber:iq:roster' ver='ver9'/> | ||
799 | </iq> | ||
800 | </pre></div> | ||
801 | <p>If the roster does not exist, then the server MUST return a stanza error with a condition of <item-not-found/>. | ||
802 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
803 | S: <iq id='bv1bs71f' | ||
804 | to='juliet@example.com/chamber' | ||
805 | type='error'> | ||
806 | <error type='cancel'> | ||
807 | <item-not-found | ||
808 | xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> | ||
809 | </error> | ||
810 | </iq> | ||
811 | </pre></div> | ||
812 | <a name="roster-syntax-actions-set"></a><br /><hr /> | ||
813 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
814 | <a name="rfc.section.2.1.5"></a><h3>2.1.5. | ||
815 | Roster Set</h3> | ||
816 | |||
817 | <p>A "roster set" is a client's request for the server to modify (i.e., create, update, or delete) a roster item; syntactically it is an IQ stanza of type "set" sent from client to server and containing a <query/> element qualified by the 'jabber:iq:roster' namespace. | ||
818 | </p> | ||
819 | <p>The following rules apply to roster sets: | ||
820 | </p> | ||
821 | <p> | ||
822 | </p> | ||
823 | <ol class="text"> | ||
824 | <li>The <query/> element MUST contain one and only one <item/> element. | ||
825 | </li> | ||
826 | <li>The server MUST ignore any value of the 'subscription' attribute other than "remove" (see <a class='info' href='#roster-syntax-items-subscription'>Section 2.1.2.5<span> (</span><span class='info'>Subscription Attribute</span><span>)</span></a>). | ||
827 | </li> | ||
828 | </ol><p> | ||
829 | |||
830 | </p> | ||
831 | <p></p> | ||
832 | <blockquote class="text"> | ||
833 | <p>Security Warning: Traditionally, the IQ stanza of the roster set included no 'to' address, with the result that all roster sets were sent from an authenticated resource (full JID) of the account whose roster was being updated. Furthermore, RFC 3921 required a server to perform special-case checking of roster sets to ignore the 'to' address; however, this specification has removed that special-casing, which means that a roster set might include a 'to' address other than that of the sender. Therefore, the entity that processes a roster set MUST verify that the sender of the roster set is authorized to update the roster, and if not return a <forbidden/> error. | ||
834 | </p> | ||
835 | </blockquote> | ||
836 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
837 | C: <iq from='juliet@example.com/balcony' | ||
838 | id='rs1' | ||
839 | type='set'> | ||
840 | <query xmlns='jabber:iq:roster'> | ||
841 | <item jid='nurse@example.com'/> | ||
842 | </query> | ||
843 | </iq> | ||
844 | </pre></div> | ||
845 | <a name="roster-syntax-actions-push"></a><br /><hr /> | ||
846 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
847 | <a name="rfc.section.2.1.6"></a><h3>2.1.6. | ||
848 | Roster Push</h3> | ||
849 | |||
850 | <p>A "roster push" is a newly created, updated, or deleted roster item that is sent from the server to the client; syntactically it is an IQ stanza of type "set" sent from server to client and containing a <query/> element qualified by the 'jabber:iq:roster' namespace. | ||
851 | </p> | ||
852 | <p>The following rules apply to roster pushes: | ||
853 | </p> | ||
854 | <p> | ||
855 | </p> | ||
856 | <ol class="text"> | ||
857 | <li>The <query/> element in a roster push MUST contain one and only one <item/> element. | ||
858 | </li> | ||
859 | <li>A receiving client MUST ignore the stanza unless it has no 'from' attribute (i.e., implicitly from the bare JID of the user's account) or it has a 'from' attribute whose value matches the user's bare JID <user@domainpart>. | ||
860 | </li> | ||
861 | </ol><p> | ||
862 | |||
863 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
864 | S: <iq id='a78b4q6ha463' | ||
865 | to='juliet@example.com/chamber' | ||
866 | type='set'> | ||
867 | <query xmlns='jabber:iq:roster'> | ||
868 | <item jid='nurse@example.com'/> | ||
869 | </query> | ||
870 | </iq> | ||
871 | </pre></div> | ||
872 | <p>As mandated by the semantics of the IQ stanza as defined in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>, each resource that receives a roster push from the server is supposed to reply with an IQ stanza of type "result" or "error" (however, it is known that many existing clients do not reply to roster pushes). | ||
873 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
874 | C: <iq from='juliet@example.com/balcony' | ||
875 | id='a78b4q6ha463' | ||
876 | type='result'/> | ||
877 | |||
878 | C: <iq from='juliet@example.com/chamber' | ||
879 | id='a78b4q6ha463' | ||
880 | type='result'/> | ||
881 | </pre></div> | ||
882 | <p></p> | ||
883 | <blockquote class="text"> | ||
884 | <p>Security Warning: Traditionally, a roster push included no 'from' address, with the result that all roster pushes were sent implicitly from the bare JID of the account itself. However, this specification allows entities other than the user's server to maintain roster information, which means that a roster push might include a 'from' address other than the bare JID of the user's account. Therefore, the client MUST check the 'from' address to verify that the sender of the roster push is authorized to update the roster. If the client receives a roster push from an unauthorized entity, it MUST NOT process the pushed data; in addition, the client can either return a stanza error of <service-unavailable/> error or refuse to return a stanza error at all (the latter behavior overrides a MUST-level requirement from <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a> for the purpose of preventing a presence leak). | ||
885 | </p> | ||
886 | </blockquote> | ||
887 | |||
888 | <p></p> | ||
889 | <blockquote class="text"> | ||
890 | <p>Implementation Note: There is no error case for client processing of roster pushes; if the server receives an IQ of type "error" in response to a roster push then it SHOULD ignore the error. | ||
891 | </p> | ||
892 | </blockquote> | ||
893 | |||
894 | <a name="roster-login"></a><br /><hr /> | ||
895 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
896 | <a name="rfc.section.2.2"></a><h3>2.2. | ||
897 | Retrieving the Roster on Login</h3> | ||
898 | |||
899 | <p>Upon authenticating with a server and binding a resource (thus becoming a connected resource as defined in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>), a client SHOULD request the roster before sending initial presence (however, because receiving the roster is not necessarily desirable for all resources, e.g., a connection with limited bandwidth, the client's request for the roster is not mandatory). After a connected resource sends initial presence (see <a class='info' href='#presence-initial'>Section 4.2<span> (</span><span class='info'>Initial Presence</span><span>)</span></a>), it is referred to as an "available resource". If a connected resource or available resource requests the roster, it is referred to as an "interested resource". The server MUST send roster pushes to all interested resources. | ||
900 | </p> | ||
901 | <p></p> | ||
902 | <blockquote class="text"> | ||
903 | <p>Implementation Note: Presence subscription requests are sent to available resources, whereas the roster pushes associated with subscription state changes are sent to interested resources. Therefore, if a resource wishes to receive both subscription requests and roster pushes, it MUST both send initial presence and request the roster. | ||
904 | </p> | ||
905 | </blockquote> | ||
906 | |||
907 | <p>A client requests the roster by sending a roster get over its stream with the server. | ||
908 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
909 | C: <iq from='juliet@example.com/balcony' | ||
910 | id='hu2bac18' | ||
911 | type='get'> | ||
912 | <query xmlns='jabber:iq:roster'/> | ||
913 | </iq> | ||
914 | </pre></div><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
915 | S: <iq id='hu2bac18' | ||
916 | to='juliet@example.com/balcony' | ||
917 | type='result'> | ||
918 | <query xmlns='jabber:iq:roster' ver='ver11'> | ||
919 | <item jid='romeo@example.net' | ||
920 | name='Romeo' | ||
921 | subscription='both'> | ||
922 | <group>Friends</group> | ||
923 | </item> | ||
924 | <item jid='mercutio@example.com' | ||
925 | name='Mercutio' | ||
926 | subscription='from'/> | ||
927 | <item jid='benvolio@example.net' | ||
928 | name='Benvolio' | ||
929 | subscription='both'/> | ||
930 | </query> | ||
931 | </iq> | ||
932 | </pre></div> | ||
933 | <p>If the server cannot process the roster get, it MUST return an appropriate stanza error as described in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a> (such as <service-unavailable/> if the roster namespace is not supported or <internal-server-error/> if the server experiences trouble processing or returning the roster). | ||
934 | </p> | ||
935 | <a name="roster-add"></a><br /><hr /> | ||
936 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
937 | <a name="rfc.section.2.3"></a><h3>2.3. | ||
938 | Adding a Roster Item</h3> | ||
939 | |||
940 | <a name="roster-add-request"></a><br /><hr /> | ||
941 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
942 | <a name="rfc.section.2.3.1"></a><h3>2.3.1. | ||
943 | Request</h3> | ||
944 | |||
945 | <p>At any time, a client can add an item to the roster. This is done by sending a roster set containing a new item. | ||
946 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
947 | C: <iq from='juliet@example.com/balcony' | ||
948 | id='ph1xaz53' | ||
949 | type='set'> | ||
950 | <query xmlns='jabber:iq:roster'> | ||
951 | <item jid='nurse@example.com' | ||
952 | name='Nurse'> | ||
953 | <group>Servants</group> | ||
954 | </item> | ||
955 | </query> | ||
956 | </iq> | ||
957 | </pre></div> | ||
958 | <a name="roster-add-success"></a><br /><hr /> | ||
959 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
960 | <a name="rfc.section.2.3.2"></a><h3>2.3.2. | ||
961 | Success Case</h3> | ||
962 | |||
963 | <p>If the server can successfully process the roster set for the new item (i.e., if no error occurs), it MUST create the item in the user's roster and proceed as follows. | ||
964 | </p> | ||
965 | <p>The server MUST return an IQ stanza of type "result" to the connected resource that sent the roster set. | ||
966 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
967 | S: <iq id='ph1xaz53' | ||
968 | to='juliet@example.com/balcony' | ||
969 | type='result'/> | ||
970 | </pre></div> | ||
971 | <p>The server MUST also send a roster push containing the new roster item to all of the user's interested resources, including the resource that generated the roster set. | ||
972 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
973 | S: <iq to='juliet@example.com/balcony' | ||
974 | id='a78b4q6ha463' | ||
975 | type='set'> | ||
976 | <query xmlns='jabber:iq:roster' ver='ver13'> | ||
977 | <item jid='nurse@example.com' | ||
978 | name='Nurse' | ||
979 | subscription='none'> | ||
980 | <group>Servants</group> | ||
981 | </item> | ||
982 | </query> | ||
983 | </iq> | ||
984 | |||
985 | S: <iq to='juliet@example.com/chamber' | ||
986 | id='x81g3bdy4n19' | ||
987 | type='set'> | ||
988 | <query xmlns='jabber:iq:roster' ver='ver13'> | ||
989 | <item jid='nurse@example.com' | ||
990 | name='Nurse' | ||
991 | subscription='none'> | ||
992 | <group>Servants</group> | ||
993 | </item> | ||
994 | </query> | ||
995 | </iq> | ||
996 | </pre></div> | ||
997 | <p>As mandated by the semantics of the IQ stanza as defined in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>, each resource that receives a roster push from the server is supposed to reply with an IQ stanza of type "result" or "error" (however, it is known that many existing clients do not reply to roster pushes). | ||
998 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
999 | C: <iq from='juliet@example.com/balcony' | ||
1000 | id='a78b4q6ha463' | ||
1001 | type='result'/> | ||
1002 | |||
1003 | C: <iq from='juliet@example.com/chamber' | ||
1004 | id='x81g3bdy4n19' | ||
1005 | type='result'/> | ||
1006 | </pre></div> | ||
1007 | <a name="roster-add-errors"></a><br /><hr /> | ||
1008 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1009 | <a name="rfc.section.2.3.3"></a><h3>2.3.3. | ||
1010 | Error Cases</h3> | ||
1011 | |||
1012 | <p>If the server cannot successfully process the roster set, it MUST return a stanza error. The following error cases are defined. Naturally, other stanza errors can occur, such as <internal-server-error/> if the server experiences an internal problem with processing the roster get, or even <not-allowed/> if the server only allows roster modifications by means of a non-XMPP method such as a web interface. | ||
1013 | </p> | ||
1014 | <p>The server MUST return a <forbidden/> stanza error to the client if the sender of the roster set is not authorized to update the roster (where typically only an authenticated resource of the account itself is authorized). | ||
1015 | </p> | ||
1016 | <p>The server MUST return a <bad-request/> stanza error to the client if the roster set contains any of the following violations: | ||
1017 | </p> | ||
1018 | <p> | ||
1019 | </p> | ||
1020 | <ol class="text"> | ||
1021 | <li>The <query/> element contains more than one <item/> child element. | ||
1022 | </li> | ||
1023 | <li>The <item/> element contains more than one <group/> element, but there are duplicate groups (one possible comparison method for determining duplicates is that described for XMPP resourceparts in <a class='info' href='#XMPP-ADDR'>[XMPP‑ADDR]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Address Format,” March 2011.</span><span>)</span></a>). | ||
1024 | </li> | ||
1025 | </ol><p> | ||
1026 | |||
1027 | </p> | ||
1028 | <p>The server MUST return a <not-acceptable/> stanza error to the client if the roster set contains any of the following violations: | ||
1029 | </p> | ||
1030 | <p> | ||
1031 | </p> | ||
1032 | <ol class="text"> | ||
1033 | <li>The length of the 'name' attribute is greater than a server-configured limit. | ||
1034 | </li> | ||
1035 | <li>The XML character data of the <group/> element is of zero length (to remove an item from all groups, the client instead needs to exclude any <group/> element from the roster set). | ||
1036 | </li> | ||
1037 | <li>The XML character data of the <group/> element is larger than a server-configured limit. | ||
1038 | </li> | ||
1039 | </ol><p> | ||
1040 | |||
1041 | </p> | ||
1042 | <p>Error: Roster set initiated by unauthorized entity | ||
1043 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1044 | C: <iq from='juliet@example.com/balcony' | ||
1045 | id='ix7s53v2' | ||
1046 | to='romeo@example.net' | ||
1047 | type='set'> | ||
1048 | <query xmlns='jabber:iq:roster'> | ||
1049 | <item jid='nurse@example.com'/> | ||
1050 | </query> | ||
1051 | </iq> | ||
1052 | |||
1053 | S: <iq id='ix7s53v2' | ||
1054 | to='juliet@example.com/balcony' | ||
1055 | type='error'> | ||
1056 | <error type='auth'> | ||
1057 | <forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> | ||
1058 | </error> | ||
1059 | </iq> | ||
1060 | </pre></div> | ||
1061 | <p>Error: Roster set contains more than one item | ||
1062 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1063 | C: <iq from='juliet@example.com/balcony' | ||
1064 | id='nw83vcj4' | ||
1065 | type='set'> | ||
1066 | <query xmlns='jabber:iq:roster'> | ||
1067 | <item jid='nurse@example.com' | ||
1068 | name='Nurse'> | ||
1069 | <group>Servants</group> | ||
1070 | </item> | ||
1071 | <item jid='mother@example.com' | ||
1072 | name='Mom'> | ||
1073 | <group>Family</group> | ||
1074 | </item> | ||
1075 | </query> | ||
1076 | </iq> | ||
1077 | |||
1078 | S: <iq id='nw83vcj4' | ||
1079 | to='juliet@example.com/balcony' | ||
1080 | type='error'> | ||
1081 | <error type='modify'> | ||
1082 | <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> | ||
1083 | </error> | ||
1084 | </iq> | ||
1085 | </pre></div> | ||
1086 | <p>Error: Roster set contains item with oversized handle | ||
1087 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1088 | C: <iq from='juliet@example.com/balcony' | ||
1089 | id='yl491b3d' | ||
1090 | type='set'> | ||
1091 | <query xmlns='jabber:iq:roster'> | ||
1092 | <item jid='nurse@example.com' | ||
1093 | name='[ ... some-very-long-handle ... ]'> | ||
1094 | <group>Servants</group> | ||
1095 | </item> | ||
1096 | </query> | ||
1097 | </iq> | ||
1098 | |||
1099 | S: <iq id='yl491b3d' | ||
1100 | to='juliet@example.com/balcony' | ||
1101 | type='error'> | ||
1102 | <error type='modify'> | ||
1103 | <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> | ||
1104 | </error> | ||
1105 | </iq> | ||
1106 | </pre></div> | ||
1107 | <p>Error: Roster set contains duplicate groups | ||
1108 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1109 | C: <iq from='juliet@example.com/balcony' | ||
1110 | id='tk3va749' | ||
1111 | type='set'> | ||
1112 | <query xmlns='jabber:iq:roster'> | ||
1113 | <item jid='nurse@example.com' | ||
1114 | name='Nurse'> | ||
1115 | <group>Servants</group> | ||
1116 | <group>Servants</group> | ||
1117 | </item> | ||
1118 | </query> | ||
1119 | </iq> | ||
1120 | |||
1121 | S: <iq id='tk3va749' | ||
1122 | to='juliet@example.com/balcony' | ||
1123 | type='error'> | ||
1124 | <error type='modify'> | ||
1125 | <bad-request xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> | ||
1126 | </error> | ||
1127 | </iq> | ||
1128 | </pre></div> | ||
1129 | <p>Error: Roster set contains empty group | ||
1130 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1131 | C: <iq from='juliet@example.com/balcony' | ||
1132 | id='fl3b486u' | ||
1133 | type='set'> | ||
1134 | <query xmlns='jabber:iq:roster'> | ||
1135 | <item jid='nurse@example.com' | ||
1136 | name='Nurse'> | ||
1137 | <group></group> | ||
1138 | </item> | ||
1139 | </query> | ||
1140 | </iq> | ||
1141 | |||
1142 | S: <iq id='fl3b486u' | ||
1143 | to='juliet@example.com/balcony' | ||
1144 | type='error'> | ||
1145 | <error type='modify'> | ||
1146 | <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> | ||
1147 | </error> | ||
1148 | </iq> | ||
1149 | </pre></div> | ||
1150 | <p>Error: Roster set contains oversized group name | ||
1151 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1152 | C: <iq from='juliet@example.com/balcony' | ||
1153 | id='qh3b4v19' | ||
1154 | type='set'> | ||
1155 | <query xmlns='jabber:iq:roster'> | ||
1156 | <item jid='nurse@example.com' | ||
1157 | name='Nurse'> | ||
1158 | <group>[ ... some-very-long-group-name ... ]</group> | ||
1159 | </item> | ||
1160 | </query> | ||
1161 | </iq> | ||
1162 | |||
1163 | S: <iq id='qh3b4v19' | ||
1164 | to='juliet@example.com/balcony' | ||
1165 | type='error'> | ||
1166 | <error type='modify'> | ||
1167 | <not-acceptable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> | ||
1168 | </error> | ||
1169 | </iq> | ||
1170 | </pre></div> | ||
1171 | <p></p> | ||
1172 | <blockquote class="text"> | ||
1173 | <p>Interoperability Note: Some servers return a <not-allowed/> stanza error to the client if the value of the <item/> element's 'jid' attribute matches the bare JID <localpart@domainpart> of the user's account. | ||
1174 | </p> | ||
1175 | </blockquote> | ||
1176 | |||
1177 | <a name="roster-update"></a><br /><hr /> | ||
1178 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1179 | <a name="rfc.section.2.4"></a><h3>2.4. | ||
1180 | Updating a Roster Item</h3> | ||
1181 | |||
1182 | <a name="roster-update-request"></a><br /><hr /> | ||
1183 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1184 | <a name="rfc.section.2.4.1"></a><h3>2.4.1. | ||
1185 | Request</h3> | ||
1186 | |||
1187 | <p>Updating an existing roster item is done in the same way as adding a new roster item, i.e., by sending a roster set to the server. Because a roster item is atomic, the item MUST be updated exactly as provided in the roster set. | ||
1188 | </p> | ||
1189 | <p>There are several reasons why a client might update a roster item: | ||
1190 | </p> | ||
1191 | <p> | ||
1192 | </p> | ||
1193 | <ol class="text"> | ||
1194 | <li>Adding a group | ||
1195 | </li> | ||
1196 | <li>Deleting a group | ||
1197 | </li> | ||
1198 | <li>Changing the handle | ||
1199 | </li> | ||
1200 | <li>Deleting the handle | ||
1201 | </li> | ||
1202 | </ol><p> | ||
1203 | |||
1204 | </p> | ||
1205 | <p>Consider a roster item that is defined as follows: | ||
1206 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1207 | <item jid='romeo@example.net' | ||
1208 | name='Romeo'> | ||
1209 | <group>Friends</group> | ||
1210 | </item> | ||
1211 | </pre></div> | ||
1212 | <p>The user who has this item in her roster might want to add the item to another group. | ||
1213 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1214 | C: <iq from='juliet@example.com/balcony' | ||
1215 | id='di43b2x9' | ||
1216 | type='set'> | ||
1217 | <query xmlns='jabber:iq:roster'> | ||
1218 | <item jid='romeo@example.net' | ||
1219 | name='Romeo'> | ||
1220 | <group>Friends</group> | ||
1221 | <group>Lovers</group> | ||
1222 | </item> | ||
1223 | </query> | ||
1224 | </iq> | ||
1225 | </pre></div> | ||
1226 | <p>Sometime later, the user might want to remove the item from the original group. | ||
1227 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1228 | C: <iq from='juliet@example.com/balcony' | ||
1229 | id='lf72v157' | ||
1230 | type='set'> | ||
1231 | <query xmlns='jabber:iq:roster'> | ||
1232 | <item jid='romeo@example.net' | ||
1233 | name='Romeo'> | ||
1234 | <group>Lovers</group> | ||
1235 | </item> | ||
1236 | </query> | ||
1237 | </iq> | ||
1238 | </pre></div> | ||
1239 | <p>The user might want to remove the item from all groups. | ||
1240 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1241 | C: <iq from='juliet@example.com/balcony' | ||
1242 | id='ju4b62a5' | ||
1243 | type='set'> | ||
1244 | <query xmlns='jabber:iq:roster'> | ||
1245 | <item jid='romeo@example.net'/> | ||
1246 | </query> | ||
1247 | </iq> | ||
1248 | </pre></div> | ||
1249 | <p>The user might also want to change the handle for the item. | ||
1250 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1251 | C: <iq from='juliet@example.com/balcony' | ||
1252 | id='gb3sv487' | ||
1253 | type='set'> | ||
1254 | <query xmlns='jabber:iq:roster'> | ||
1255 | <item jid='romeo@example.net' | ||
1256 | name='MyRomeo'/> | ||
1257 | </query> | ||
1258 | </iq> | ||
1259 | </pre></div> | ||
1260 | <p>The user might then want to remove the handle altogether. | ||
1261 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1262 | C: <iq from='juliet@example.com/balcony' | ||
1263 | id='o3bx66s5' | ||
1264 | type='set'> | ||
1265 | <query xmlns='jabber:iq:roster'> | ||
1266 | <item jid='romeo@example.net' | ||
1267 | name=''/> | ||
1268 | </query> | ||
1269 | </iq> | ||
1270 | </pre></div> | ||
1271 | <p></p> | ||
1272 | <blockquote class="text"> | ||
1273 | <p>Implementation Note: Including an empty 'name' attribute is equivalent to including no 'name' attribute; both actions set the name to the empty string. | ||
1274 | </p> | ||
1275 | </blockquote> | ||
1276 | |||
1277 | <a name="roster-update-success"></a><br /><hr /> | ||
1278 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1279 | <a name="rfc.section.2.4.2"></a><h3>2.4.2. | ||
1280 | Success Case</h3> | ||
1281 | |||
1282 | <p>As with adding a roster item, if the roster item can be successfully processed then the server MUST update the item in the user's roster, send a roster push to all of the user's interested resources, and send an IQ result to the initiating resource; details are provided under <a class='info' href='#roster-add'>Section 2.3<span> (</span><span class='info'>Adding a Roster Item</span><span>)</span></a>. | ||
1283 | </p> | ||
1284 | <a name="roster-update-error"></a><br /><hr /> | ||
1285 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1286 | <a name="rfc.section.2.4.3"></a><h3>2.4.3. | ||
1287 | Error Cases</h3> | ||
1288 | |||
1289 | <p>The error cases described under <a class='info' href='#roster-add-errors'>Section 2.3.3<span> (</span><span class='info'>Error Cases</span><span>)</span></a> also apply to updating a roster item. | ||
1290 | </p> | ||
1291 | <a name="roster-delete"></a><br /><hr /> | ||
1292 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1293 | <a name="rfc.section.2.5"></a><h3>2.5. | ||
1294 | Deleting a Roster Item</h3> | ||
1295 | |||
1296 | <a name="roster-delete-request"></a><br /><hr /> | ||
1297 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1298 | <a name="rfc.section.2.5.1"></a><h3>2.5.1. | ||
1299 | Request</h3> | ||
1300 | |||
1301 | <p>At any time, a client can delete an item from his or her roster by sending a roster set and specifying a value of "remove" for the 'subscription' attribute. | ||
1302 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1303 | C: <iq from='juliet@example.com/balcony' | ||
1304 | id='hm4hs97y' | ||
1305 | type='set'> | ||
1306 | <query xmlns='jabber:iq:roster'> | ||
1307 | <item jid='nurse@example.com' | ||
1308 | subscription='remove'/> | ||
1309 | </query> | ||
1310 | </iq> | ||
1311 | </pre></div> | ||
1312 | <a name="roster-delete-success"></a><br /><hr /> | ||
1313 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1314 | <a name="rfc.section.2.5.2"></a><h3>2.5.2. | ||
1315 | Success Case</h3> | ||
1316 | |||
1317 | <p>As with adding a roster item, if the server can successfully process the roster set then it MUST update the item in the user's roster, send a roster push to all of the user's interested resources (with the 'subscription' attribute set to a value of "remove"), and send an IQ result to the initiating resource; details are provided under <a class='info' href='#roster-add'>Section 2.3<span> (</span><span class='info'>Adding a Roster Item</span><span>)</span></a>. | ||
1318 | </p> | ||
1319 | <p>In addition, the user's server might need to generate one or more subscription-related presence stanzas, as follows: | ||
1320 | </p> | ||
1321 | <p> | ||
1322 | </p> | ||
1323 | <ol class="text"> | ||
1324 | <li>If the user has a presence subscription to the contact, then the user's server MUST send a presence stanza of type "unsubscribe" to the contact (in order to unsubscribe from the contact's presence). | ||
1325 | </li> | ||
1326 | <li>If the contact has a presence subscription to the user, then the user's server MUST send a presence stanza of type "unsubscribed" to the contact (in order to cancel the contact's subscription to the user). | ||
1327 | </li> | ||
1328 | <li>If the presence subscription is mutual, then the user's server MUST send both a presence stanza of type "unsubscribe" and a presence stanza of type "unsubscribed" to the contact. | ||
1329 | </li> | ||
1330 | </ol><p> | ||
1331 | |||
1332 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1333 | S: <presence from='juliet@example.com' | ||
1334 | id='lm3ba81g' | ||
1335 | to='nurse@example.com' | ||
1336 | type='unsubscribe'/> | ||
1337 | |||
1338 | S: <presence from='juliet@example.com' | ||
1339 | id='xb2c1v4k' | ||
1340 | to='nurse@example.com' | ||
1341 | type='unsubscribed'/> | ||
1342 | </pre></div> | ||
1343 | <a name="roster-delete-error"></a><br /><hr /> | ||
1344 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1345 | <a name="rfc.section.2.5.3"></a><h3>2.5.3. | ||
1346 | Error Cases</h3> | ||
1347 | |||
1348 | <p>If the value of the 'jid' attribute specifies an item that is not in the roster, then the server MUST return an <item-not-found/> stanza error. | ||
1349 | </p> | ||
1350 | <p>Error: Roster item not found | ||
1351 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1352 | C: <iq from='juliet@example.com/balcony' | ||
1353 | id='uj4b1ca8' | ||
1354 | type='set'> | ||
1355 | <query xmlns='jabber:iq:roster'> | ||
1356 | <item jid='[ ... non-existent-jid ... ]' | ||
1357 | subscription='remove'/> | ||
1358 | </query> | ||
1359 | </iq> | ||
1360 | |||
1361 | S: <iq id='uj4b1ca8' | ||
1362 | to='juliet@example.com/balcony' | ||
1363 | type='error'> | ||
1364 | <error type='modify'> | ||
1365 | <item-not-found | ||
1366 | xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> | ||
1367 | </error> | ||
1368 | </iq> | ||
1369 | </pre></div> | ||
1370 | <a name="roster-versioning"></a><br /><hr /> | ||
1371 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1372 | <a name="rfc.section.2.6"></a><h3>2.6. | ||
1373 | Roster Versioning</h3> | ||
1374 | |||
1375 | <a name="roster-versioning-feature"></a><br /><hr /> | ||
1376 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1377 | <a name="rfc.section.2.6.1"></a><h3>2.6.1. | ||
1378 | Stream Feature</h3> | ||
1379 | |||
1380 | <p>If a server supports roster versioning, then it MUST advertise the following stream feature during stream negotiation. | ||
1381 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1382 | <ver xmlns='urn:xmpp:features:rosterver'/> | ||
1383 | </pre></div> | ||
1384 | <p> The roster versioning stream feature is merely informative and | ||
1385 | therefore is never mandatory-to-negotiate. | ||
1386 | </p> | ||
1387 | <a name="roster-versioning-request"></a><br /><hr /> | ||
1388 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1389 | <a name="rfc.section.2.6.2"></a><h3>2.6.2. | ||
1390 | Request</h3> | ||
1391 | |||
1392 | <p>If a client supports roster versioning and the server to which it has connected advertises support for roster versioning as described in the foregoing section, then the client SHOULD include the 'ver' element in its request for the roster. If the server does not advertise support for roster versioning, the client MUST NOT include the 'ver' attribute. If the client includes the 'ver' attribute in its roster get, it sets the attribute's value to the version ID associated with its last cache of the roster. | ||
1393 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1394 | C: <iq from='romeo@example.net/home' | ||
1395 | id='r1h3vzp7' | ||
1396 | to='romeo@example.net' | ||
1397 | type='get'> | ||
1398 | <query xmlns='jabber:iq:roster' ver='ver14'/> | ||
1399 | </iq> | ||
1400 | </pre></div> | ||
1401 | <p>If the client has not yet cached the roster or the cache is lost or corrupted, but the client wishes to bootstrap the use of roster versioning, it MUST set the 'ver' attribute to the empty string (i.e., ver=""). | ||
1402 | </p> | ||
1403 | <p>Naturally, if the client does not support roster versioning or does not wish to bootstrap the use of roster versioning, it will not include the 'ver' attribute. | ||
1404 | </p> | ||
1405 | <a name="roster-versioning-success"></a><br /><hr /> | ||
1406 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1407 | <a name="rfc.section.2.6.3"></a><h3>2.6.3. | ||
1408 | Success Case</h3> | ||
1409 | |||
1410 | <p>Whether or not the roster has been modified since the version ID enumerated by the client, the server MUST either return the complete roster as described under <a class='info' href='#roster-syntax-actions-result'>Section 2.1.4<span> (</span><span class='info'>Roster Result</span><span>)</span></a> (including a 'ver' attribute that signals the latest version) or return an empty IQ-result (thus indicating that any roster modifications will be sent via roster pushes, as described below). In general, unless returning the complete roster would (1) use less bandwidth than sending individual roster pushes to the client (e.g., if the roster contains only a few items) or (2) the server cannot associate the version ID with any previous version it has on file, the server SHOULD send an empty IQ-result and then send the modifications (if any) via roster pushes. | ||
1411 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1412 | S: <iq from='romeo@example.net' | ||
1413 | id='r1h3vzp7' | ||
1414 | to='romeo@example.net/home' | ||
1415 | type='result'/> | ||
1416 | </pre></div> | ||
1417 | <p></p> | ||
1418 | <blockquote class="text"> | ||
1419 | <p>Implementation Note: This empty IQ-result is different from an empty <query/> element, thus disambiguating this usage from an empty roster. | ||
1420 | </p> | ||
1421 | </blockquote> | ||
1422 | |||
1423 | <p>If roster versioning is enabled and the roster has not been modified since the version ID enumerated by the client, the server will simply not send any roster pushes to the client (until and unless some relevant event triggers a roster push during the lifetime of the client's session). | ||
1424 | </p> | ||
1425 | <p>If the roster has been modified since the version ID enumerated by the client, the server MUST then send one roster push to the client for each roster item that has been modified since the version ID enumerated by the client. (We call a roster push that is sent for purposes of roster version synchronization an "interim roster push".) | ||
1426 | </p> | ||
1427 | <p></p> | ||
1428 | <blockquote class="text"> | ||
1429 | <p>Definition: A "roster modification" is any change to the roster data that would result in a roster push to a connected client. Therefore, internal states related to roster processing within the server that would not result in a roster push to a connected client do not necessitate a change to the version. | ||
1430 | </p> | ||
1431 | </blockquote> | ||
1432 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1433 | S: <iq from='romeo@example.net' | ||
1434 | id='ah382g67' | ||
1435 | to='romeo@example.net/home' | ||
1436 | type='set'> | ||
1437 | <query xmlns='jabber:iq:roster' ver='ver34'> | ||
1438 | <item jid='tybalt@example.org' subscription='remove'/> | ||
1439 | </query> | ||
1440 | </iq> | ||
1441 | |||
1442 | S: <iq from='romeo@example.net' | ||
1443 | id='b2gs90j5' | ||
1444 | to='romeo@example.net/home' | ||
1445 | type='set'> | ||
1446 | <query xmlns='jabber:iq:roster' ver='ver42'> | ||
1447 | <item jid='bill@example.org' subscription='both'/> | ||
1448 | </query> | ||
1449 | </iq> | ||
1450 | |||
1451 | S: <iq from='romeo@example.net' | ||
1452 | id='c73gs419' | ||
1453 | to='romeo@example.net/home' | ||
1454 | type='set'> | ||
1455 | <query xmlns='jabber:iq:roster' ver='ver72'> | ||
1456 | <item jid='nurse@example.org' | ||
1457 | name='Nurse' | ||
1458 | subscription='to'> | ||
1459 | <group>Servants</group> | ||
1460 | </item> | ||
1461 | </query> | ||
1462 | </iq> | ||
1463 | |||
1464 | S: <iq from='romeo@example.net' | ||
1465 | id='dh361f35' | ||
1466 | to='romeo@example.net/home' | ||
1467 | type='set'> | ||
1468 | <query xmlns='jabber:iq:roster' ver='ver96'> | ||
1469 | <item jid='juliet@example.org' | ||
1470 | name='Juliet' | ||
1471 | subscription='both'> | ||
1472 | <group>VIPs</group> | ||
1473 | </item> | ||
1474 | </query> | ||
1475 | </iq> | ||
1476 | </pre></div> | ||
1477 | <p>These "interim roster pushes" can be understood as follows: | ||
1478 | </p> | ||
1479 | <p> | ||
1480 | </p> | ||
1481 | <ol class="text"> | ||
1482 | <li>Imagine that the client had an active presence session for the entire time between its cached roster version (say, "ver14") and the new roster version (say, "ver96"). | ||
1483 | </li> | ||
1484 | <li>During that time, the client might have received roster pushes related to various roster versions (which might have been, say, "ver51" and "ver79"). However, some of those roster pushes might have contained intermediate updates to the same roster item (e.g., modifications to the subscription state for bill@example.org from "none" to "to" and from "to" to "both"). | ||
1485 | </li> | ||
1486 | <li>The interim roster pushes would not include all of the intermediate steps, only the final result of all modifications applied to each item while the client was in fact offline (which might have been, say, "ver34", "ver42", "ver72", and "ver96"). | ||
1487 | </li> | ||
1488 | </ol><p> | ||
1489 | |||
1490 | </p> | ||
1491 | <p>The client MUST handle an "interim roster push" in the same way it handles any roster push (indeed, from the client's perspective it cannot tell the difference between an "interim" roster push and a "live" roster push and therefore it has no way of knowing when it has received all of the interim roster pushes). When requesting the roster after reconnection, the client SHOULD request the version associated with the last roster push it received during its previous session, not the version associated with the roster result it received at the start of its previous session. | ||
1492 | </p> | ||
1493 | <p>When roster versioning is enabled, the server MUST include the updated roster version with each roster push. Roster pushes MUST occur in order of modification and the version contained in a roster push MUST be unique. Even if the client has not included the 'ver' attribute in its roster gets or sets, the server SHOULD include the 'ver' attribute on all roster pushes and results that it sends to the client. | ||
1494 | </p> | ||
1495 | <p></p> | ||
1496 | <blockquote class="text"> | ||
1497 | <p>Implementation Note: Guidelines and more detailed examples for roster versioning are provided in <a class='info' href='#XEP-0237'>[XEP‑0237]<span> (</span><span class='info'>Saint-Andre, P. and D. Cridland, “Roster Versioning,” March 2010.</span><span>)</span></a>. | ||
1498 | </p> | ||
1499 | </blockquote> | ||
1500 | |||
1501 | <a name="sub"></a><br /><hr /> | ||
1502 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1503 | <a name="rfc.section.3"></a><h3>3. | ||
1504 | Managing Presence Subscriptions</h3> | ||
1505 | |||
1506 | <p>In order to protect the privacy of XMPP users, presence information is disclosed only to other entities that a user has approved. When a user has agreed that another entity is allowed to view its presence, the entity is said to have a "subscription" to the user's presence. An entity that has a subscription to a user's presence or to which a user has a presence subscription is called a "contact" (in this document the term "contact" is also used in a less strict sense to refer to a potential contact or any item in a user's roster). | ||
1507 | </p> | ||
1508 | <p>In XMPP, a subscription lasts across presence sessions; indeed, it lasts until the contact unsubscribes or the user cancels the previously granted subscription. (This model is different from that used for presence subscriptions in the Session Initiation Protocol (SIP), as defined in <a class='info' href='#SIP-PRES'>[SIP‑PRES]<span> (</span><span class='info'>Rosenberg, J., “A Presence Event Package for the Session Initiation Protocol (SIP),” August 2004.</span><span>)</span></a>.) | ||
1509 | </p> | ||
1510 | <p>Subscriptions are managed within XMPP by sending presence stanzas containing specially defined attributes ("subscribe", "unsubscribe", "subscribed", and "unsubscribed"). | ||
1511 | </p> | ||
1512 | <p></p> | ||
1513 | <blockquote class="text"> | ||
1514 | <p>Implementation Note: When a server processes or generates an outbound presence stanza of type "subscribe", "subscribed", "unsubscribe", or "unsubscribed", the server MUST stamp the outgoing presence stanza with the bare JID <localpart@domainpart> of the sending entity, not the full JID <localpart@domainpart/resourcepart>. Enforcement of this rule simplifies the presence subscription model and helps to prevent presence leaks; for information about presence leaks, refer to the security considerations of <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>. | ||
1515 | </p> | ||
1516 | </blockquote> | ||
1517 | |||
1518 | <p>Subscription states are reflected in the rosters of both the user and the contact. This section does not cover every possible case related to presence subscriptions, and mainly narrates the protocol flows for bootstrapping a mutual subscription between a user and a contact. Complete details regarding subscription states can be found under <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>. | ||
1519 | </p> | ||
1520 | <a name="sub-request"></a><br /><hr /> | ||
1521 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1522 | <a name="rfc.section.3.1"></a><h3>3.1. | ||
1523 | Requesting a Subscription</h3> | ||
1524 | |||
1525 | <p>A "subscription request" is a request from a user for authorization to permanently subscribe to a contact's presence information; syntactically it is a presence stanza whose 'type' attribute has a value of "subscribe". A subscription request is generated by a user's client, processed by the (potential) contact's server, and acted on by the contact via the contact's client. The workflow is described in the following sections. | ||
1526 | </p> | ||
1527 | <p></p> | ||
1528 | <blockquote class="text"> | ||
1529 | <p>Implementation Note: Presence subscription requests are sent to available resources, whereas the roster pushes associated with subscription state changes are sent to interested resources. Therefore, if a resource wishes to receive both subscription requests and roster pushes, it MUST both send initial presence and request the roster. | ||
1530 | </p> | ||
1531 | </blockquote> | ||
1532 | |||
1533 | <a name="sub-request-gen"></a><br /><hr /> | ||
1534 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1535 | <a name="rfc.section.3.1.1"></a><h3>3.1.1. | ||
1536 | Client Generation of Outbound Subscription Request</h3> | ||
1537 | |||
1538 | <p>A user's client generates a subscription request by sending a presence stanza of type "subscribe" and specifying a 'to' address of the potential contact's bare JID <contact@domainpart>. | ||
1539 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1540 | UC: <presence id='xk3h1v69' | ||
1541 | to='juliet@example.com' | ||
1542 | type='subscribe'/> | ||
1543 | </pre></div> | ||
1544 | <p>When a user sends a presence subscription request to a potential instant messaging and presence contact, the value of the 'to' attribute MUST be a bare JID <contact@domainpart> rather than a full JID <contact@domainpart/resourcepart>, since the desired result is for the user to receive presence from all of the contact's resources, not merely the particular resource specified in the 'to' attribute. Use of bare JIDs also simplifies subscription processing, presence probes, and presence notifications by the user's server and the contact's server. | ||
1545 | </p> | ||
1546 | <p>For tracking purposes, a client SHOULD include an 'id' attribute in a presence subscription request. | ||
1547 | </p> | ||
1548 | <p></p> | ||
1549 | <blockquote class="text"> | ||
1550 | <p>Implementation Note: Many XMPP clients prompt the user for information about the potential contact (e.g., "handle" and desired roster group) when generating an outbound presence subscription request and therefore send a roster set before sending the outbound presence subscription request. This behavior is OPTIONAL, because a client MAY instead wait until receiving the initial roster push from the server before uploading user-provided information about the contact. A server MUST process a roster set and outbound presence subscription request in either order (i.e., in whatever order generated by the client). | ||
1551 | </p> | ||
1552 | </blockquote> | ||
1553 | |||
1554 | <a name="sub-request-outbound"></a><br /><hr /> | ||
1555 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1556 | <a name="rfc.section.3.1.2"></a><h3>3.1.2. | ||
1557 | Server Processing of Outbound Subscription Request</h3> | ||
1558 | |||
1559 | <p>Upon receiving the outbound presence subscription request, the user's server MUST proceed as follows. | ||
1560 | </p> | ||
1561 | <p> | ||
1562 | </p> | ||
1563 | <ol class="text"> | ||
1564 | <li>Before processing the request, the user's server MUST check the syntax of the JID contained in the 'to' attribute (however, it is known that some existing implementations do not perform this check). If the JID is of the form <contact@domainpart/resourcepart> instead of <contact@domainpart>, the user's server SHOULD treat it as if the request had been directed to the contact's bare JID and modify the 'to' address accordingly. The server MAY also verify that the JID adheres to the format defined in <a class='info' href='#XMPP-ADDR'>[XMPP‑ADDR]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Address Format,” March 2011.</span><span>)</span></a> and possibly return a <jid-malformed/> stanza error. | ||
1565 | </li> | ||
1566 | <li>If the potential contact is hosted on the same server as the | ||
1567 | user, then the server MUST adhere to the rules specified under <a class='info' href='#sub-request-inbound'>Section 3.1.3<span> (</span><span class='info'>Server Processing of Inbound Subscription Request</span><span>)</span></a> when processing the subscription request and delivering it to the (local) contact. | ||
1568 | </li> | ||
1569 | <li>If the potential contact is hosted on a remote server, subject to local service policies the user's server MUST then route the stanza to that remote domain in accordance with core XMPP stanza processing rules. (This can result in returning an appropriate stanza error to the user, such as <remote-server-timeout/>.) | ||
1570 | </li> | ||
1571 | </ol><p> | ||
1572 | |||
1573 | </p> | ||
1574 | <p>As mentioned, before locally delivering or remotely routing the presence subscription request, the user's server MUST stamp the outbound subscription request with the bare JID <user@domainpart> of the user. | ||
1575 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1576 | US: <presence from='romeo@example.net' | ||
1577 | id='xk3h1v69' | ||
1578 | to='juliet@example.com' | ||
1579 | type='subscribe'/> | ||
1580 | </pre></div> | ||
1581 | <p>If the presence subscription request cannot be locally delivered or remotely routed (e.g., because the request is malformed, the local contact does not exist, the remote server does not exist, an attempt to contact the remote server times out, or any other error is determined or experienced by the user's server), then the user's server MUST return an appropriate error stanza to the user. An example follows. | ||
1582 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1583 | US: <presence from='juliet@example.com' | ||
1584 | id='xk3h1v69' | ||
1585 | to='romeo@example.net' | ||
1586 | type='error'> | ||
1587 | <error type='modify'> | ||
1588 | <remote-server-not-found | ||
1589 | xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/> | ||
1590 | </error> | ||
1591 | </presence> | ||
1592 | </pre></div> | ||
1593 | <p>After locally delivering or remotely routing the presence subscription request, the user's server MUST then send a roster push to all of the user's interested resources, containing the potential contact with a subscription state of "none" and with notation that the subscription is pending (via an 'ask' attribute whose value is "subscribe"). | ||
1594 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1595 | US: <iq id='b89c5r7ib574' | ||
1596 | to='romeo@example.net/foo' | ||
1597 | type='set'> | ||
1598 | <query xmlns='jabber:iq:roster'> | ||
1599 | <item ask='subscribe' | ||
1600 | jid='juliet@example.com' | ||
1601 | subscription='none'/> | ||
1602 | </query> | ||
1603 | </iq> | ||
1604 | |||
1605 | US: <iq id='b89c5r7ib575' | ||
1606 | to='romeo@example.net/bar' | ||
1607 | type='set'> | ||
1608 | <query xmlns='jabber:iq:roster'> | ||
1609 | <item ask='subscribe' | ||
1610 | jid='juliet@example.com' | ||
1611 | subscription='none'/> | ||
1612 | </query> | ||
1613 | </iq> | ||
1614 | </pre></div> | ||
1615 | <p>If a remote contact does not approve or deny the subscription request within some configurable amount of time, the user's server SHOULD resend the subscription request to the contact based on an implementation-specific algorithm (e.g., whenever a new resource becomes available for the user, or after a certain amount of time has elapsed); this helps to recover from transient, silent errors that might have occurred when the original subscription request was routed to the remote domain. When doing so, it is RECOMMENDED for the server to include an 'id' attribute so that it can track responses to the resent subscription request. | ||
1616 | </p> | ||
1617 | <a name="sub-request-inbound"></a><br /><hr /> | ||
1618 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1619 | <a name="rfc.section.3.1.3"></a><h3>3.1.3. | ||
1620 | Server Processing of Inbound Subscription Request</h3> | ||
1621 | |||
1622 | <p>Before processing the inbound presence subscription request, the contact's server SHOULD check the syntax of the JID contained in the 'to' attribute. If the JID is of the form <contact@domainpart/resourcepart> instead of <contact@domainpart>, the contact's server SHOULD treat it as if the request had been directed to the contact's bare JID and modify the 'to' address accordingly. The server MAY also verify that the JID adheres to the format defined in <a class='info' href='#XMPP-ADDR'>[XMPP‑ADDR]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Address Format,” March 2011.</span><span>)</span></a> and possibly return a <jid-malformed/> stanza error. | ||
1623 | </p> | ||
1624 | <p>When processing the inbound presence subscription request, the contact's server MUST adhere to the following rules: | ||
1625 | </p> | ||
1626 | <p> | ||
1627 | </p> | ||
1628 | <ol class="text"> | ||
1629 | <li>Above all, the contact's server MUST NOT automatically approve subscription requests on the contact's behalf -- unless the contact has (a) pre-approved subscription requests from the user as described under <a class='info' href='#sub-preapproval'>Section 3.4<span> (</span><span class='info'>Pre-Approving a Subscription Request</span><span>)</span></a>, (b) configured its account to automatically approve subscription requests, or (c) accepted an agreement with its service provider that allows automatic approval (for instance, via an employment agreement within an enterprise deployment). Instead, if a subscription request requires approval then the contact's server MUST deliver that request to the contact's available resource(s) for approval or denial by the contact. | ||
1630 | </li> | ||
1631 | <li>If the contact exists and the user already has a subscription to the contact's presence, then the contact's server MUST auto-reply on behalf of the contact by sending a presence stanza of type "subscribed" from the contact's bare JID to the user's bare JID. Likewise, if the contact previously sent a presence stanza of type "subscribed" and the contact's server treated that as indicating "pre-approval" for the user's presence subscription (see <a class='info' href='#sub-preapproval'>Section 3.4<span> (</span><span class='info'>Pre-Approving a Subscription Request</span><span>)</span></a>), then the contact's server SHOULD also auto-reply on behalf of the contact. | ||
1632 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1633 | CS: <presence from='juliet@example.com' | ||
1634 | id='xk3h1v69' | ||
1635 | to='romeo@example.net' | ||
1636 | type='subscribed'/> | ||
1637 | </pre></div> | ||
1638 | |||
1639 | </li> | ||
1640 | <li>Otherwise, if there is at least one available resource associated with the contact when the subscription request is received by the contact's server, then the contact's server MUST send that subscription request to all available resources in accordance with <a class='info' href='#rules'>Section 8<span> (</span><span class='info'>Server Rules for Processing XML Stanzas</span><span>)</span></a>. | ||
1641 | |||
1642 | As a way of acknowledging receipt of the presence subscription request, the contact's server MAY send a presence stanza of type "unavailable" from the bare JID of the contact to the bare JID of the user (the user's client MUST NOT assume that this acknowledgement provides presence information about the contact, since it comes from the contact's bare JID and is received before the subscription request has been approved). | ||
1643 | </li> | ||
1644 | <li>Otherwise, if the contact has no available resources when the subscription request is received by the contact's server, then the contact's server MUST keep a record of the complete presence stanza comprising the subscription request, including any extended content contained therein (see Section 8.4 of <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>), and then deliver the request when the contact next has an available resource. The contact's server MUST continue to deliver the subscription request whenever the contact creates an available resource, until the contact either approves or denies the request. (The contact's server MUST NOT deliver more than one subscription request from any given user when the contact next has an available resource; e.g., if the user sends multiple subscription requests to the contact while the contact is offline, the contact's server SHOULD store only one of those requests, such as the first request or last request, and MUST deliver only one of the requests when the contact next has an available resource; this helps to prevent "subscription request spam".) | ||
1645 | </li> | ||
1646 | </ol><p> | ||
1647 | |||
1648 | </p> | ||
1649 | <p></p> | ||
1650 | <blockquote class="text"> | ||
1651 | <p>Security Warning: Until and unless the contact approves the subscription request as described under <a class='info' href='#sub-request-handle'>Section 3.1.4<span> (</span><span class='info'>Client Processing of Inbound Subscription Request</span><span>)</span></a>, the contact's server MUST NOT add an item for the user to the contact's roster. | ||
1652 | </p> | ||
1653 | </blockquote> | ||
1654 | |||
1655 | <p></p> | ||
1656 | <blockquote class="text"> | ||
1657 | <p>Security Warning: The mandate for the contact's server to store the complete stanza of the presence subscription request introduces the possibility of an application resource exhaustion attack (see Section 2.1.2 of <a class='info' href='#DOS'>[DOS]<span> (</span><span class='info'>Handley, M., Rescorla, E., and IAB, “Internet Denial-of-Service Considerations,” December 2006.</span><span>)</span></a>), for example, by a rogue server or a coordinated group of users (e.g., a botnet) against the contact's server or particular contact. Server implementers are advised to consider the possibility of such attacks and provide tools for counteracting it, such as enabling service administrators to set limits on the number or size of inbound presence subscription requests that the server will store in aggregate or for any given contact. | ||
1658 | </p> | ||
1659 | </blockquote> | ||
1660 | |||
1661 | <a name="sub-request-handle"></a><br /><hr /> | ||
1662 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1663 | <a name="rfc.section.3.1.4"></a><h3>3.1.4. | ||
1664 | Client Processing of Inbound Subscription Request</h3> | ||
1665 | |||
1666 | <p>When an interactive client receives a subscription request, it MUST present the request to the natural person controlling the client (i.e., the "contact") for approval, unless the contact has explicitly configured the client to automatically approve or deny some or all subscription requests as described above. An automated client that is not controlled by a natural person will have its own application-specific rules for approving or denying subscription requests. | ||
1667 | </p> | ||
1668 | <p>A client approves a subscription request by sending a presence stanza of type "subscribed", which is processed as described under <a class='info' href='#sub-request-approvalout'>Section 3.1.5<span> (</span><span class='info'>Server Processing of Outbound Subscription Approval</span><span>)</span></a> for the contact's server and <a class='info' href='#sub-request-approvalin'>Section 3.1.6<span> (</span><span class='info'>Server Processing of Inbound Subscription Approval</span><span>)</span></a> for the user's server. | ||
1669 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1670 | CC: <presence id='h4v1c4kj' | ||
1671 | to='romeo@example.net' | ||
1672 | type='subscribed'/> | ||
1673 | </pre></div> | ||
1674 | <p>A client denies a subscription request by sending a presence stanza of type "unsubscribed", which is processed as described under <a class='info' href='#sub-cancel'>Section 3.2<span> (</span><span class='info'>Canceling a Subscription</span><span>)</span></a> for both the contact's server and the user's server. | ||
1675 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1676 | CC: <presence id='tb2m1b59' | ||
1677 | to='romeo@example.net' | ||
1678 | type='unsubscribed'/> | ||
1679 | </pre></div> | ||
1680 | <p>For tracking purposes, a client SHOULD include an 'id' attribute in a subscription approval or subscription denial; this 'id' attribute MUST NOT mirror the 'id' attribute of the subscription request. | ||
1681 | </p> | ||
1682 | <a name="sub-request-approvalout"></a><br /><hr /> | ||
1683 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1684 | <a name="rfc.section.3.1.5"></a><h3>3.1.5. | ||
1685 | Server Processing of Outbound Subscription Approval</h3> | ||
1686 | |||
1687 | <p>When the contact's client sends the subscription approval, the contact's server MUST stamp the outbound stanza with the bare JID <contact@domainpart> of the contact and locally deliver or remotely route the stanza to the user. | ||
1688 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1689 | CS: <presence from='juliet@example.com' | ||
1690 | id='h4v1c4kj' | ||
1691 | to='romeo@example.net' | ||
1692 | type='subscribed'/> | ||
1693 | </pre></div> | ||
1694 | <p>The contact's server then MUST send an updated roster push to all of the contact's interested resources, with the 'subscription' attribute set to a value of "from". (Here we assume that the contact does not already have a subscription to the user; if that were the case, the 'subscription' attribute would be set to a value of "both", as explained under <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>.) | ||
1695 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1696 | CS: <iq id='a78b4q6ha463' | ||
1697 | to='juliet@example.com/balcony' | ||
1698 | type='set'> | ||
1699 | <query xmlns='jabber:iq:roster'> | ||
1700 | <item jid='romeo@example.net' | ||
1701 | subscription='from'/> | ||
1702 | </query> | ||
1703 | </iq> | ||
1704 | |||
1705 | CS: <iq id='x81g3bdy4n19' | ||
1706 | to='juliet@example.com/chamber' | ||
1707 | type='set'> | ||
1708 | <query xmlns='jabber:iq:roster'> | ||
1709 | <item jid='romeo@example.net' | ||
1710 | subscription='from'/> | ||
1711 | </query> | ||
1712 | </iq> | ||
1713 | </pre></div> | ||
1714 | <p>From the perspective of the contact, there now exists a subscription from the user, which is why the 'subscription' attribute is set to a value of "from". (Here we assume that the contact does not already have a subscription to the user; if that were the case, the 'subscription' attribute would be set to a value of "both", as explained under <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>.) | ||
1715 | </p> | ||
1716 | <p>The contact's server MUST then also send current presence to the user from each of the contact's available resources. | ||
1717 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1718 | CS: <presence from='juliet@example.com/balcony' | ||
1719 | id='pw72bc5j' | ||
1720 | to='romeo@example.net'/> | ||
1721 | |||
1722 | CS: <presence from='juliet@example.com/chamber' | ||
1723 | id='ux31da4q' | ||
1724 | to='romeo@example.net'/> | ||
1725 | </pre></div> | ||
1726 | <p>In order to subscribe to the user's presence, the contact would then need to send a subscription request to the user. (XMPP clients will often automatically send the subscription request instead of requiring the contact to initiate the subscription request, since it is assumed that the desired end state is a mutual subscription.) Naturally, when the contact sends a subscription request to the user, the subscription states will be different from those shown in the foregoing examples (see <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>) and the roles will be reversed. | ||
1727 | </p> | ||
1728 | <a name="sub-request-approvalin"></a><br /><hr /> | ||
1729 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1730 | <a name="rfc.section.3.1.6"></a><h3>3.1.6. | ||
1731 | Server Processing of Inbound Subscription Approval</h3> | ||
1732 | |||
1733 | <p>When the user's server receives a subscription approval, it MUST first check if the contact is in the user's roster with subscription='none' or subscription='from' and the 'ask' flag set to "subscribe" (i.e., a subscription state of "None + Pending Out", "None + Pending Out+In", or "From + Pending Out"; see <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>). If this check is successful, then the user's server MUST: | ||
1734 | </p> | ||
1735 | <p> | ||
1736 | </p> | ||
1737 | <ol class="text"> | ||
1738 | <li>Deliver the inbound subscription approval to all of the user's interested resources (this helps to give the user's client(s) proper context regarding the subscription approval so that they can differentiate between a roster push originated by another of the user's resources and a subscription approval received from the contact). This MUST occur before sending the roster push described in the next step. | ||
1739 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1740 | US: <presence from='juliet@example.com' | ||
1741 | id='h4v1c4kj' | ||
1742 | to='romeo@example.net' | ||
1743 | type='subscribed'/> | ||
1744 | </pre></div> | ||
1745 | |||
1746 | </li> | ||
1747 | <li>Initiate a roster push to all of the user's interested resources, containing an updated roster item for the contact with the 'subscription' attribute set to a value of "to" (if the subscription state was "None + Pending Out" or "None + Pending Out+In") or "both" (if the subscription state was "From + Pending Out"). | ||
1748 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1749 | US: <iq id='b89c5r7ib576' | ||
1750 | to='romeo@example.net/foo' | ||
1751 | type='set'> | ||
1752 | <query xmlns='jabber:iq:roster'> | ||
1753 | <item jid='juliet@example.com' | ||
1754 | subscription='to'/> | ||
1755 | </query> | ||
1756 | </iq> | ||
1757 | |||
1758 | US: <iq id='b89c5r7ib577' | ||
1759 | to='romeo@example.net/bar' | ||
1760 | type='set'> | ||
1761 | <query xmlns='jabber:iq:roster'> | ||
1762 | <item jid='juliet@example.com' | ||
1763 | subscription='to'/> | ||
1764 | </query> | ||
1765 | </iq> | ||
1766 | </pre></div> | ||
1767 | |||
1768 | |||
1769 | </li> | ||
1770 | <li>The user's server MUST also deliver the available presence stanza received from each of the contact's available resources to each of the user's available resources. | ||
1771 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1772 | [ ... to resource1 ... ] | ||
1773 | |||
1774 | US: <presence from='juliet@example.com/balcony' | ||
1775 | id='pw72bc5j' | ||
1776 | to='romeo@example.net'/> | ||
1777 | |||
1778 | [ ... to resource2 ... ] | ||
1779 | |||
1780 | US: <presence from='juliet@example.com/balcony' | ||
1781 | id='pw72bc5j' | ||
1782 | to='romeo@example.net'/> | ||
1783 | |||
1784 | [ ... to resource1 ... ] | ||
1785 | |||
1786 | US: <presence from='juliet@example.com/chamber' | ||
1787 | id='ux31da4q' | ||
1788 | to='romeo@example.net'/> | ||
1789 | |||
1790 | [ ... to resource2 ... ] | ||
1791 | |||
1792 | US: <presence from='juliet@example.com/chamber' | ||
1793 | id='ux31da4q' | ||
1794 | to='romeo@example.net'/> | ||
1795 | </pre></div> | ||
1796 | |||
1797 | </li> | ||
1798 | </ol><p> | ||
1799 | |||
1800 | </p> | ||
1801 | <p></p> | ||
1802 | <blockquote class="text"> | ||
1803 | <p>Implementation Note: If the user's account has no available resources when the inbound subscription approval notification is received, the user's server MAY keep a record of the notification (ideally the complete presence stanza) and then deliver the notification when the account next has an available resource. This behavior provides more complete signaling to the user regarding the reasons for the roster change that occurred while the user was offline. | ||
1804 | </p> | ||
1805 | </blockquote> | ||
1806 | |||
1807 | <p>Otherwise -- that is, if the user does not exist, if the contact is not in the user's roster, or if the contact is in the user's roster with a subscription state other than those described in the foregoing check -- then the user's server MUST silently ignore the subscription approval notification by not delivering it to the user, not modifying the user's roster, and not generating a roster push to the user's interested resources. | ||
1808 | </p> | ||
1809 | <p>From the perspective of the user, there now exists a subscription to the contact's presence (which is why the 'subscription' attribute is set to a value of "to"). | ||
1810 | </p> | ||
1811 | <a name="sub-cancel"></a><br /><hr /> | ||
1812 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1813 | <a name="rfc.section.3.2"></a><h3>3.2. | ||
1814 | Canceling a Subscription</h3> | ||
1815 | |||
1816 | <a name="sub-cancel-gen"></a><br /><hr /> | ||
1817 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1818 | <a name="rfc.section.3.2.1"></a><h3>3.2.1. | ||
1819 | Client Generation of Subscription Cancellation</h3> | ||
1820 | |||
1821 | <p>If a contact would like to cancel a subscription that it has previously granted to a user, to cancel a subscription pre-approval (<a class='info' href='#sub-preapproval'>Section 3.4<span> (</span><span class='info'>Pre-Approving a Subscription Request</span><span>)</span></a>), or to deny a subscription request, it sends a presence stanza of type "unsubscribed". | ||
1822 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1823 | CC: <presence id='ij5b1v7g' | ||
1824 | to='romeo@example.net' | ||
1825 | type='unsubscribed'/> | ||
1826 | </pre></div> | ||
1827 | <a name="sub-cancel-outbound"></a><br /><hr /> | ||
1828 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1829 | <a name="rfc.section.3.2.2"></a><h3>3.2.2. | ||
1830 | Server Processing of Outbound Subscription Cancellation</h3> | ||
1831 | |||
1832 | <p>Upon receiving the outbound subscription cancellation, the contact's server MUST proceed as follows. | ||
1833 | </p> | ||
1834 | <p> | ||
1835 | </p> | ||
1836 | <ol class="text"> | ||
1837 | <li>If the user's bare JID is not yet in the contact's roster or is in the contact's roster with a state of "None", "None + Pending Out", or "To", the contact's server SHOULD NOT route or deliver the presence stanza of type "unsubscribed" to the user and MUST NOT send presence notifications of type "unavailable" to the user as described below. | ||
1838 | </li> | ||
1839 | <li>If the user's bare JID is in the contact's roster with a state of "None", "None + Pending Out", or "To" and the 'approved' flag is set to "true" (thus signaling a subscription pre-approval as described under <a class='info' href='#sub-preapproval'>Section 3.4<span> (</span><span class='info'>Pre-Approving a Subscription Request</span><span>)</span></a>), the contact's server MUST remove the pre-approval and MUST NOT route or deliver the presence stanza of type "unsubscribed" to the user. | ||
1840 | </li> | ||
1841 | <li>Otherwise, as shown in the following examples, the contact's server MUST route or deliver both presence notifications of type "unavailable" and presence stanzas of type "unsubscribed" to the user and MUST send a roster push to the contact. | ||
1842 | </li> | ||
1843 | </ol><p> | ||
1844 | |||
1845 | </p> | ||
1846 | <p>While the user is still subscribed to the contact's presence (i.e., before the contact's server routes or delivers the presence stanza of type "unsubscribed" to the user), the contact's server MUST send a presence stanza of type "unavailable" from all of the contact's online resources to the user. | ||
1847 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1848 | CS: <presence from='juliet@example.com/balcony' | ||
1849 | id='i8bsg3h3' | ||
1850 | type='unavailable'/> | ||
1851 | |||
1852 | CS: <presence from='juliet@example.com/chamber' | ||
1853 | id='bvx2c9mk' | ||
1854 | type='unavailable'/> | ||
1855 | </pre></div> | ||
1856 | <p>Then the contact's server MUST route or deliver the presence stanza of type "unsubscribed" to the user, making sure to stamp the outbound subscription cancellation with the bare JID <contact@domainpart> of the contact. | ||
1857 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1858 | CS: <presence from='juliet@example.com' | ||
1859 | id='ij5b1v7g' | ||
1860 | to='romeo@example.net' | ||
1861 | type='unsubscribed'/> | ||
1862 | </pre></div> | ||
1863 | <p>The contact's server then MUST send a roster push with the updated roster item to all of the contact's interested resources, where the subscription state is now either "none" or "to" (see <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>). | ||
1864 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1865 | CS: <iq id='pw3f2v175b34' | ||
1866 | to='juliet@example.com/balcony' | ||
1867 | type='set'> | ||
1868 | <query xmlns='jabber:iq:roster'> | ||
1869 | <item jid='romeo@example.net' | ||
1870 | subscription='none'/> | ||
1871 | </query> | ||
1872 | </iq> | ||
1873 | |||
1874 | CS: <iq id='zu2y3f571v35' | ||
1875 | to='juliet@example.com/chamber' | ||
1876 | type='set'> | ||
1877 | <query xmlns='jabber:iq:roster'> | ||
1878 | <item jid='romeo@example.net' | ||
1879 | subscription='none'/> | ||
1880 | </query> | ||
1881 | </iq> | ||
1882 | </pre></div> | ||
1883 | <a name="sub-cancel-inbound"></a><br /><hr /> | ||
1884 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1885 | <a name="rfc.section.3.2.3"></a><h3>3.2.3. | ||
1886 | Server Processing of Inbound Subscription Cancellation</h3> | ||
1887 | |||
1888 | <p>When the user's server receives the inbound subscription cancellation, it MUST first check if the contact is in the user's roster with subscription='to' or subscription='both' (see <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>). If this check is successful, then the user's server MUST: | ||
1889 | </p> | ||
1890 | <p> | ||
1891 | </p> | ||
1892 | <ol class="text"> | ||
1893 | <li>Deliver the inbound subscription cancellation to all of the user's interested resources (this helps to give the user's client(s) proper context regarding the subscription cancellation so that they can differentiate between a roster push originated by another of the user's resources and a subscription cancellation received from the contact). This MUST occur before sending the roster push described in the next step. | ||
1894 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1895 | US: <presence from='juliet@example.com' | ||
1896 | id='ij5b1v7g' | ||
1897 | to='romeo@example.net' | ||
1898 | type='unsubscribed'/> | ||
1899 | </pre></div> | ||
1900 | |||
1901 | </li> | ||
1902 | <li>Initiate a roster push to all of the user's interested resources, containing an updated roster item for the contact with the 'subscription' attribute set to a value of "none" (if the subscription state was "To" or "To + Pending In") or "from" (if the subscription state was "Both"). | ||
1903 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1904 | US: <iq id='h37h3u1bv400' | ||
1905 | to='romeo@example.net/foo' | ||
1906 | type='set'> | ||
1907 | <query xmlns='jabber:iq:roster'> | ||
1908 | <item jid='juliet@example.com' | ||
1909 | subscription='none'/> | ||
1910 | </query> | ||
1911 | </iq> | ||
1912 | |||
1913 | US: <iq id='h37h3u1bv401' | ||
1914 | to='romeo@example.net/bar' | ||
1915 | type='set'> | ||
1916 | <query xmlns='jabber:iq:roster'> | ||
1917 | <item jid='juliet@example.com' | ||
1918 | subscription='none'/> | ||
1919 | </query> | ||
1920 | </iq> | ||
1921 | </pre></div> | ||
1922 | |||
1923 | |||
1924 | </li> | ||
1925 | </ol><p> | ||
1926 | |||
1927 | </p> | ||
1928 | <p>The user's server MUST also deliver the inbound presence stanzas of type "unavailable". | ||
1929 | </p> | ||
1930 | <p></p> | ||
1931 | <blockquote class="text"> | ||
1932 | <p>Implementation Note: If the user's account has no available resources when the inbound unsubscribed notification is received, the user's server MAY keep a record of the notification (ideally the complete presence stanza) and then deliver the notification when the account next has an available resource. This behavior provides more complete signaling to the user regarding the reasons for the roster change that occurred while the user was offline. | ||
1933 | </p> | ||
1934 | </blockquote> | ||
1935 | |||
1936 | <p>Otherwise -- that is, if the user does not exist, if the contact is not in the user's roster, or if the contact is in the user's roster with a subscription state other than those described in the foregoing check -- then the user's server MUST silently ignore the unsubscribed notification by not delivering it to the user, not modifying the user's roster, and not generating a roster push to the user's interested resources. | ||
1937 | </p> | ||
1938 | <a name="sub-unsub"></a><br /><hr /> | ||
1939 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1940 | <a name="rfc.section.3.3"></a><h3>3.3. | ||
1941 | Unsubscribing</h3> | ||
1942 | |||
1943 | <a name="sub-unsub-gen"></a><br /><hr /> | ||
1944 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1945 | <a name="rfc.section.3.3.1"></a><h3>3.3.1. | ||
1946 | Client Generation of Unsubscribe</h3> | ||
1947 | |||
1948 | <p>If a user would like to unsubscribe from a contact's presence, it sends a presence stanza of type "unsubscribe". | ||
1949 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1950 | UC: <presence id='ul4bs71n' | ||
1951 | to='juliet@example.com' | ||
1952 | type='unsubscribe'/> | ||
1953 | </pre></div> | ||
1954 | <a name="sub-unsub-outbound"></a><br /><hr /> | ||
1955 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
1956 | <a name="rfc.section.3.3.2"></a><h3>3.3.2. | ||
1957 | Server Processing of Outbound Unsubscribe</h3> | ||
1958 | |||
1959 | <p>Upon receiving the outbound unsubscribe, the user's server MUST proceed as follows. | ||
1960 | </p> | ||
1961 | <p> | ||
1962 | </p> | ||
1963 | <ol class="text"> | ||
1964 | <li>If the contact is hosted on the same server as the user, then | ||
1965 | the server MUST adhere to the rules specified under <a class='info' href='#sub-unsub-inbound'>Section 3.3.3<span> (</span><span class='info'>Server Processing of Inbound Unsubscribe</span><span>)</span></a> when processing the subscription request. | ||
1966 | </li> | ||
1967 | <li>If the contact is hosted on a remote server, subject to local service policies the user's server MUST then route the stanza to that remote domain in accordance with core XMPP stanza processing rules. (This can result in returning an appropriate stanza error to the user, such as <remote-server-timeout/>.) | ||
1968 | </li> | ||
1969 | </ol><p> | ||
1970 | |||
1971 | </p> | ||
1972 | <p>As mentioned, before locally delivering or remotely routing the unsubscribe, the user's server MUST stamp the stanza with the bare JID <user@domainpart> of the user. | ||
1973 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1974 | US: <presence from='romeo@example.net' | ||
1975 | id='ul4bs71n' | ||
1976 | to='juliet@example.com' | ||
1977 | type='unsubscribe'/> | ||
1978 | </pre></div> | ||
1979 | <p>The user's server then MUST send a roster push with the updated roster item to all of the user's interested resources, where the subscription state is now either "none" or "from" (see <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>). | ||
1980 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
1981 | US: <iq id='h37h3u1bv402' | ||
1982 | to='romeo@example.net/foo' | ||
1983 | type='set'> | ||
1984 | <query xmlns='jabber:iq:roster'> | ||
1985 | <item jid='juliet@example.com' | ||
1986 | subscription='none'/> | ||
1987 | </query> | ||
1988 | </iq> | ||
1989 | |||
1990 | US: <iq to='romeo@example.net/bar' | ||
1991 | type='set' | ||
1992 | id='h37h3u1bv403'> | ||
1993 | <query xmlns='jabber:iq:roster'> | ||
1994 | <item jid='juliet@example.com' | ||
1995 | subscription='none'/> | ||
1996 | </query> | ||
1997 | </iq> | ||
1998 | </pre></div> | ||
1999 | <a name="sub-unsub-inbound"></a><br /><hr /> | ||
2000 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2001 | <a name="rfc.section.3.3.3"></a><h3>3.3.3. | ||
2002 | Server Processing of Inbound Unsubscribe</h3> | ||
2003 | |||
2004 | <p>When the contact's server receives the unsubscribe notification, it MUST first check if the user's bare JID is in the contact's roster with subscription='from' or subscription='both' (i.e., a subscription state of "From", "From + Pending Out", or "Both"; see <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>). If this check is successful, then the contact's server MUST: | ||
2005 | </p> | ||
2006 | <p> | ||
2007 | </p> | ||
2008 | <ol class="text"> | ||
2009 | <li>Deliver the inbound unsubscribe to all of the contact's interested resources (this helps to give the contact's client(s) proper context regarding the unsubscribe so that they can differentiate between a roster push originated by another of the contact's resources and an unsubscribe received from the user). This MUST occur before sending the roster push described in the next step. | ||
2010 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2011 | CS: <presence from='romeo@example.net' | ||
2012 | id='ul4bs71n' | ||
2013 | to='juliet@example.com' | ||
2014 | type='unsubscribe'/> | ||
2015 | </pre></div> | ||
2016 | |||
2017 | </li> | ||
2018 | <li>Initiate a roster push to all of the contact's interested resources, containing an updated roster item for the user with the 'subscription' attribute set to a value of "none" (if the subscription state was "From" or "From + Pending Out") or "to" (if the subscription state was "Both"). | ||
2019 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2020 | CS: <iq id='tn2b5893g1s4' | ||
2021 | to='juliet@example.com/balcony' | ||
2022 | type='set'> | ||
2023 | <query xmlns='jabber:iq:roster'> | ||
2024 | <item jid='romeo@example.net' | ||
2025 | subscription='none'/> | ||
2026 | </query> | ||
2027 | </iq> | ||
2028 | |||
2029 | CS: <iq id='sp3b56n27hrp' | ||
2030 | to='juliet@example.com/chamber' | ||
2031 | type='set'> | ||
2032 | <query xmlns='jabber:iq:roster'> | ||
2033 | <item jid='romeo@example.net' | ||
2034 | subscription='none'/> | ||
2035 | </query> | ||
2036 | </iq> | ||
2037 | </pre></div> | ||
2038 | |||
2039 | </li> | ||
2040 | <li>Generate an outbound presence stanza of type "unavailable" from each of the contact's available resources to the user. | ||
2041 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2042 | CS: <presence from='juliet@example.com/balcony' | ||
2043 | id='o5v91w49' | ||
2044 | to='romeo@example.net' | ||
2045 | type='unavailable'/> | ||
2046 | |||
2047 | CS: <presence from='juliet@example.com/chamber' | ||
2048 | id='n6b1c37k' | ||
2049 | to='romeo@example.net' | ||
2050 | type='unavailable'/> | ||
2051 | </pre></div> | ||
2052 | |||
2053 | </li> | ||
2054 | </ol><p> | ||
2055 | |||
2056 | </p> | ||
2057 | <p></p> | ||
2058 | <blockquote class="text"> | ||
2059 | <p>Implementation Note: If the contact's account has no available resources when the inbound unsubscribe notification is received, the contact's server MAY keep a record of the notification (ideally the complete presence stanza) and then deliver the notification when the account next has an available resource. This behavior provides more complete signaling to the user regarding the reasons for the roster change that occurred while the user was offline. | ||
2060 | </p> | ||
2061 | </blockquote> | ||
2062 | |||
2063 | <p>Otherwise -- that is, if the contact does not exist, if the user is not in the contact's roster, or if the user's bare JID is in the contact's roster with a subscription state other than those described in the foregoing check -- then the contact's server MUST silently ignore the unsubscribe stanza by not delivering it to the contact, not modifying the contact's roster, and not generating a roster push to the contact's interested resources. However, if the contact's server is keeping track of an inbound presence subscription request from the user to the contact but the user is not yet in the contact's roster (functionally equivalent to a subscription state of "None + Pending In" where the contact never added the user to the contact's roster), then the contact's server MUST simply remove any record of the inbound presence subscription request (it cannot remove the user from the contact's roster because the user was never added to the contact's roster). | ||
2064 | </p> | ||
2065 | <p></p> | ||
2066 | <blockquote class="text"> | ||
2067 | <p>Implementation Note: The user's client MUST NOT depend on receiving the unavailable presence notification from the contact, since it MUST consider its presence subscription to the contact, and its presence information about the contact, to be null and void when it sends the presence stanza of type "unsubscribe" or when it receives the roster push triggered by the unsubscribe request. | ||
2068 | </p> | ||
2069 | </blockquote> | ||
2070 | |||
2071 | <a name="sub-preapproval"></a><br /><hr /> | ||
2072 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2073 | <a name="rfc.section.3.4"></a><h3>3.4. | ||
2074 | Pre-Approving a Subscription Request</h3> | ||
2075 | |||
2076 | <p>If a user has not received a subscription request from a contact, the user can "pre-approve" such a request so that it will be automatically approved by the user's server. | ||
2077 | </p> | ||
2078 | <p>Support for subscription pre-approvals is OPTIONAL on the part of clients and servers. If a server supports subscription pre-approvals, then it MUST advertise the following stream feature during stream negotiation. | ||
2079 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2080 | <sub xmlns='urn:xmpp:features:pre-approval'/> | ||
2081 | </pre></div> | ||
2082 | <p>The subscription pre-approval stream feature is merely informative and therefore is never mandatory-to-negotiate. | ||
2083 | </p> | ||
2084 | <a name="sub-preapproval-gen"></a><br /><hr /> | ||
2085 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2086 | <a name="rfc.section.3.4.1"></a><h3>3.4.1. | ||
2087 | Client Generation of Subscription Pre-Approval</h3> | ||
2088 | |||
2089 | <p>If the server to which a client connects has advertised support for subscription pre-approvals, the client MAY generate a subscription pre-approval by sending a presence stanza of type "subscribed" to the contact. | ||
2090 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2091 | UC: <presence id='pg81vx64' | ||
2092 | to='juliet@example.com' | ||
2093 | type='subscribed'/> | ||
2094 | </pre></div> | ||
2095 | <p>If the server does not advertise support for subscription pre-approvals, the client MUST NOT attempt to pre-approve subscription requests from potential or actual contacts. | ||
2096 | </p> | ||
2097 | <a name="sub-preapproval-proc"></a><br /><hr /> | ||
2098 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2099 | <a name="rfc.section.3.4.2"></a><h3>3.4.2. | ||
2100 | Server Processing of Subscription Pre-Approval</h3> | ||
2101 | |||
2102 | <p>Upon receiving the presence stanza of type "subscribed", the user's server MUST proceed as follows if it supports subscription pre-approvals. | ||
2103 | </p> | ||
2104 | <p> | ||
2105 | </p> | ||
2106 | <ol class="text"> | ||
2107 | <li>If the contact is in the user's roster with a state of "Both", "From", or "From + Pending Out", the user's server MUST silently ignore the stanza. | ||
2108 | </li> | ||
2109 | <li>If the contact is in the user's roster with a state of "To + Pending In", "None + Pending In", or "None + Pending Out+In", the user's server MUST handle the stanza as a normal subscription approval (see under <a class='info' href='#sub-request-approvalout'>Section 3.1.5<span> (</span><span class='info'>Server Processing of Outbound Subscription Approval</span><span>)</span></a>) by updating the existing roster item to a state of "Both", "From", or "From + Pending Out" (respectively), pushing the modified roster item to all of the user's interested resources, and routing the presence stanza of type "subscribed" to the contact. | ||
2110 | </li> | ||
2111 | <li>If the contact is in the user's roster with a state of "To", "None", or "None + Pending Out", the user's server MUST note the subscription pre-approval by setting the 'approved' flag to a value of "true", then push the modified roster item to all of the user's interested resources. However, the user's server MUST NOT route the presence stanza of type "subscribed" to the contact. | ||
2112 | </li> | ||
2113 | <li>If the contact is not yet in the user's roster, the user's server MUST create a roster item for the contact with a state of "None" and set the 'approved' flag to a value of "true", then push the roster item to all of the user's interested resources. However, the user's server MUST NOT route the presence stanza of type "subscribed" to the contact. | ||
2114 | </li> | ||
2115 | </ol><p> | ||
2116 | |||
2117 | </p> | ||
2118 | <p>An example of the roster push follows. | ||
2119 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2120 | US: <iq id='h3bs81vs763f' | ||
2121 | to='romeo@example.net/bar' | ||
2122 | type='set'> | ||
2123 | <query xmlns='jabber:iq:roster'> | ||
2124 | <item approved='true' | ||
2125 | jid='juliet@example.com' | ||
2126 | subscription='none'/> | ||
2127 | </query> | ||
2128 | </iq> | ||
2129 | </pre></div> | ||
2130 | <p>When the 'approved' flag is set to "true", the user's server MUST NOT deliver a presence stanza of type "subscribe" from the contact to the user, but instead MUST automatically respond to such a stanza on behalf of the user by returning a presence stanza of type "subscribed" from the bare JID of the user to the bare JID of the contact. | ||
2131 | </p> | ||
2132 | <p></p> | ||
2133 | <blockquote class="text"> | ||
2134 | <p>Implementation Note: It is a matter of implementation or local service policy whether the server maintains a record of the subscription approval after it has received a presence subscription request from the contact. If the server does not maintain such a record, upon receiving the subscription request it will not include the 'approved' attribute in the roster item for the contact (i.e., in subsequent roster pushes and roster results). If the server maintains such a record, it will always include the 'approved' attribute (set to "true") in the roster item for the contact, until and unless the user sends a presence stanza of type "unsubscribed" to the contact (or removes the contact from the roster entirely). | ||
2135 | </p> | ||
2136 | </blockquote> | ||
2137 | |||
2138 | <p></p> | ||
2139 | <blockquote class="text"> | ||
2140 | <p>Implementation Note: A client can cancel a pre-approval by sending a presence stanza of type "unsubscribed", as described more fully under <a class='info' href='#sub-cancel'>Section 3.2<span> (</span><span class='info'>Canceling a Subscription</span><span>)</span></a>. In this case, the user's server would send a roster push to all of the user's interested resources with the 'approved' attribute removed. (Alternatively, the client can simply remove the roster item entirely.) | ||
2141 | </p> | ||
2142 | </blockquote> | ||
2143 | |||
2144 | <a name="presence"></a><br /><hr /> | ||
2145 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2146 | <a name="rfc.section.4"></a><h3>4. | ||
2147 | Exchanging Presence Information</h3> | ||
2148 | |||
2149 | <a name="presence-fundamentals"></a><br /><hr /> | ||
2150 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2151 | <a name="rfc.section.4.1"></a><h3>4.1. | ||
2152 | Presence Fundamentals</h3> | ||
2153 | |||
2154 | <p>The concept of presence refers to an entity's availability for communication over a network. At the most basic level, presence is a boolean "on/off" variable that signals whether an entity is available or unavailable for communication (the terms "online" and "offline" are also used). In XMPP, an entity's availability is signaled when its client generates a <presence/> stanza with no 'type' attribute, and an entity's lack of availability is signaled when its client generates a <presence/> stanza whose 'type' attribute has a value of "unavailable". | ||
2155 | </p> | ||
2156 | <p>XMPP presence typically follows a "publish-subscribe" or "observer" pattern, wherein an entity sends presence to its server, and its server then broadcasts that information to all of the entity's contacts who have a subscription to the entity's presence (in the terminology of <a class='info' href='#IMP-MODEL'>[IMP‑MODEL]<span> (</span><span class='info'>Day, M., Rosenberg, J., and H. Sugano, “A Model for Presence and Instant Messaging,” February 2000.</span><span>)</span></a>, an entity that generates presence is a "presentity" and the entities that receive presence are "subscribers"). A client generates presence for broadcast to all subscribed entities by sending a presence stanza to its server with no 'to' address, where the presence stanza has either no 'type' attribute or a 'type' attribute whose value is "unavailable". This kind of presence is called "broadcast presence". (A client can also send "directed presence", i.e., a presence stanza with a 'to' address; this is less common but is sometimes used to send presence to entities that are not subscribed to the user's presence; see <a class='info' href='#presence-directed'>Section 4.6<span> (</span><span class='info'>Directed Presence</span><span>)</span></a>.) | ||
2157 | </p> | ||
2158 | <p>After a client completes the preconditions specified in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>, it can establish a "presence session" at its server by sending <a class='info' href='#presence-initial'>initial presence<span> (</span><span class='info'>Initial Presence</span><span>)</span></a>, where the presence session is terminated by sending <a class='info' href='#presence-unavailable'>unavailable presence<span> (</span><span class='info'>Unavailable Presence</span><span>)</span></a>. For the duration of its presence session, a connected resource (in the terminology of <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>) is said to be an "available resource". | ||
2159 | </p> | ||
2160 | <p>In XMPP, applications that combine messaging and presence functionality, the default type of communication for which presence signals availability is messaging; however, it is not necessary for XMPP applications to combine messaging and presence functionality, and they can provide standalone presence features without messaging (in addition, XMPP servers do not require information about network availability in order to successfully route message and IQ stanzas). | ||
2161 | </p> | ||
2162 | <p></p> | ||
2163 | <blockquote class="text"> | ||
2164 | <p>Informational Note: In the examples that follow, the user is <juliet@example.com>, she has two available resources ("balcony" and "chamber"), and she has three contacts in her roster with a subscription state of "from" or "both": <romeo@example.net>, <mercutio@example.com>, and <benvolio@example.net>. | ||
2165 | </p> | ||
2166 | </blockquote> | ||
2167 | |||
2168 | <a name="presence-initial"></a><br /><hr /> | ||
2169 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2170 | <a name="rfc.section.4.2"></a><h3>4.2. | ||
2171 | Initial Presence</h3> | ||
2172 | |||
2173 | <a name="presence-initial-gen"></a><br /><hr /> | ||
2174 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2175 | <a name="rfc.section.4.2.1"></a><h3>4.2.1. | ||
2176 | Client Generation of Initial Presence</h3> | ||
2177 | |||
2178 | <p>After completing the preconditions described in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a> (REQUIRED) and requesting the roster (RECOMMENDED), a client signals its availability for communication by sending "initial presence" to its server, i.e., a presence stanza with no 'to' address (indicating that it is meant to be broadcast by the server on behalf of the client) and no 'type' attribute (indicating the user's availability). | ||
2179 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2180 | UC: <presence/> | ||
2181 | </pre></div> | ||
2182 | <p>The initial presence stanza MAY contain the <priority/> element, the <show/> element, and one or more instances of the <status/> element, as well as extended content; details are provided under <a class='info' href='#presence-syntax'>Section 4.7<span> (</span><span class='info'>Presence Syntax</span><span>)</span></a>. | ||
2183 | </p> | ||
2184 | <a name="presence-initial-outbound"></a><br /><hr /> | ||
2185 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2186 | <a name="rfc.section.4.2.2"></a><h3>4.2.2. | ||
2187 | Server Processing of Outbound Initial Presence</h3> | ||
2188 | |||
2189 | <p>Upon receiving initial presence from a client, the user's server MUST send the initial presence stanza from the full JID <user@domainpart/resourcepart> of the user to all contacts that are subscribed to the user's presence; such contacts are those for which a JID is present in the user's roster with the 'subscription' attribute set to a value of "from" or "both". | ||
2190 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2191 | US: <presence from='juliet@example.com/balcony' | ||
2192 | to='romeo@example.net'/> | ||
2193 | |||
2194 | US: <presence from='juliet@example.com/balcony' | ||
2195 | to='mercutio@example.com'/> | ||
2196 | |||
2197 | US: <presence from='juliet@example.com/balcony' | ||
2198 | to='benvolio@example.net'/> | ||
2199 | </pre></div> | ||
2200 | <p>The user's server MUST also broadcast initial presence from the user's newly available resource to all of the user's available resources, including the resource that generated the presence notification in the first place (i.e., an entity is implicitly subscribed to its own presence). | ||
2201 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2202 | [... to the "balcony" resource ...] | ||
2203 | |||
2204 | US: <presence from='juliet@example.com/balcony' | ||
2205 | to='juliet@example.com'/> | ||
2206 | |||
2207 | [... to the "chamber" resource ...] | ||
2208 | |||
2209 | US: <presence from='juliet@example.com/balcony' | ||
2210 | to='juliet@example.com'/> | ||
2211 | </pre></div> | ||
2212 | <p>In the absence of presence information about the user's contacts, the user's server MUST also send presence probes to the user's contacts on behalf of the user as specified under <a class='info' href='#presence-probe'>Section 4.3<span> (</span><span class='info'>Presence Probes</span><span>)</span></a>. | ||
2213 | </p> | ||
2214 | <a name="presence-initial-inbound"></a><br /><hr /> | ||
2215 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2216 | <a name="rfc.section.4.2.3"></a><h3>4.2.3. | ||
2217 | Server Processing of Inbound Initial Presence</h3> | ||
2218 | |||
2219 | <p>Upon receiving presence from the user, the contact's server MUST deliver the user's presence stanza to all of the contact's available resources. | ||
2220 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2221 | [ ... to resource1 ... ] | ||
2222 | |||
2223 | CS: <presence from='juliet@example.com/balcony' | ||
2224 | to='romeo@example.net'/> | ||
2225 | |||
2226 | [ ... to resource2 ... ] | ||
2227 | |||
2228 | CS: <presence from='juliet@example.com/balcony' | ||
2229 | to='romeo@example.net'/> | ||
2230 | </pre></div> | ||
2231 | <a name="presence-initial-client"></a><br /><hr /> | ||
2232 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2233 | <a name="rfc.section.4.2.4"></a><h3>4.2.4. | ||
2234 | Client Processing of Initial Presence</h3> | ||
2235 | |||
2236 | <p>When the contact's client receives presence from the user, the following behavior is suggested for interactive clients: | ||
2237 | </p> | ||
2238 | <p> | ||
2239 | </p> | ||
2240 | <ol class="text"> | ||
2241 | <li>If the user's bare JID is in the contact's roster, display the presence information in an appropriate roster interface. | ||
2242 | </li> | ||
2243 | <li>If the user is not in the contact's roster but the contact and the user are actively exchanging message or IQ stanzas, display the presence information in the user interface for that communication session (see also <a class='info' href='#presence-directed'>Section 4.6<span> (</span><span class='info'>Directed Presence</span><span>)</span></a> and <a class='info' href='#message-chat'>Section 5.1<span> (</span><span class='info'>One-to-One Chat Sessions</span><span>)</span></a>). | ||
2244 | </li> | ||
2245 | <li>Otherwise, ignore the presence information and do not display it to the contact. | ||
2246 | </li> | ||
2247 | </ol><p> | ||
2248 | |||
2249 | </p> | ||
2250 | <a name="presence-probe"></a><br /><hr /> | ||
2251 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2252 | <a name="rfc.section.4.3"></a><h3>4.3. | ||
2253 | Presence Probes</h3> | ||
2254 | |||
2255 | <p>A "presence probe" is a request for a contact's current presence information, sent on behalf of a user by the user's server; syntactically it is a presence stanza whose 'type' attribute has a value of "probe". In the context of presence subscriptions, the value of the 'from' address MUST be the bare JID of the subscribed user and the value of the 'to' address MUST be the bare JID of the contact to which the user is subscribed, since presence subscriptions are based on the bare JID. | ||
2256 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2257 | US: <presence from='juliet@example.com' | ||
2258 | id='ign291v5' | ||
2259 | to='romeo@example.net' | ||
2260 | type='probe'/> | ||
2261 | </pre></div> | ||
2262 | <p></p> | ||
2263 | <blockquote class="text"> | ||
2264 | <p>Interoperability Note: RFC 3921 specified that probes are sent from the full JID, not the bare JID (a rule that was changed because subscriptions are based on the bare JID). Some existing implementations send from the full JID instead of the bare JID. | ||
2265 | </p> | ||
2266 | </blockquote> | ||
2267 | |||
2268 | <p>Probes can also be sent by an entity that has received presence outside the context of a presence subscription, typically when the contact has sent directed presence as described under <a class='info' href='#presence-directed'>Section 4.6<span> (</span><span class='info'>Directed Presence</span><span>)</span></a>; in this case the value of the 'from' or 'to' address can be a full JID instead of a bare JID. See <a class='info' href='#presence-directed'>Section 4.6<span> (</span><span class='info'>Directed Presence</span><span>)</span></a> for a complete discussion. | ||
2269 | </p> | ||
2270 | <p>Presence probes SHOULD NOT be sent by a client, because in general a client will not need to send them since the task of gathering presence from a user's contacts is managed by the user's server. However, if a user's client generates an outbound presence probe then the user's server SHOULD route the probe (if the contact is at another server) or process the probe (if the contact is at the same server) and MUST NOT use its receipt of the presence probe from a connected client as the sole cause for returning a stanza or stream error to the client. | ||
2271 | </p> | ||
2272 | <a name="presence-probe-outbound"></a><br /><hr /> | ||
2273 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2274 | <a name="rfc.section.4.3.1"></a><h3>4.3.1. | ||
2275 | Server Generation of Outbound Presence Probe</h3> | ||
2276 | |||
2277 | <p>When a server needs to discover the availability of a user's contact, it sends a presence probe from the bare JID <user@domainpart> of the user to the bare JID <contact@domainpart> of the contact. | ||
2278 | </p> | ||
2279 | <p></p> | ||
2280 | <blockquote class="text"> | ||
2281 | <p>Implementation Note: Although presence probes are intended for sending to contacts (i.e., entities to which a user is subscribed), a server MAY send a presence probe to the full JID of an entity from which the user has received presence information during the current session. | ||
2282 | </p> | ||
2283 | </blockquote> | ||
2284 | |||
2285 | <p>The user's server SHOULD send a presence probe whenever the user starts a new presence session by sending initial presence; however, the server MAY choose not to send the probe at that point if it has what it deems to be reliable and up-to-date presence information about the user's contacts (e.g., because the user has another available resource or because the user briefly logged off and on before the new presence session began). In addition, a server MAY periodically send a presence probe to a contact if it has not received presence information or other traffic from the contact in some configurable amount of time; this can help to prevent "ghost" contacts who appear to be online but in fact are not. | ||
2286 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2287 | US: <presence from='juliet@example.com' | ||
2288 | id='ign291v5' | ||
2289 | to='romeo@example.net' | ||
2290 | type='probe'/> | ||
2291 | |||
2292 | US: <presence from='juliet@example.com' | ||
2293 | id='xv291f38' | ||
2294 | to='mercutio@example.com' | ||
2295 | type='probe'/> | ||
2296 | </pre></div> | ||
2297 | <p>Naturally, the user's server does not need to send a presence probe to a contact if the contact's account resides on the same server as the user, since the server possesses the contact's information locally. | ||
2298 | </p> | ||
2299 | <a name="presence-probe-inbound"></a><br /><hr /> | ||
2300 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2301 | <a name="rfc.section.4.3.2"></a><h3>4.3.2. | ||
2302 | Server Processing of Inbound Presence Probe</h3> | ||
2303 | |||
2304 | <p>Upon receiving a presence probe to the contact's bare JID from the user's server on behalf of the user, the contact's server MUST reply as follows: | ||
2305 | </p> | ||
2306 | <p> | ||
2307 | </p> | ||
2308 | <ol class="text"> | ||
2309 | <li>If the contact account does not exist or the user's bare JID is in the contact's roster with a subscription state other than "From", "From + Pending Out", or "Both" (as explained under <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>), then the contact's server SHOULD return a presence stanza of type "unsubscribed" in response to the presence probe (this will trigger a protocol flow for canceling the user's subscription to the contact as described under <a class='info' href='#sub-cancel'>Section 3.2<span> (</span><span class='info'>Canceling a Subscription</span><span>)</span></a>; however, this MUST NOT result in cancellation of a subscription pre-approval as described under <a class='info' href='#sub-preapproval'>Section 3.4<span> (</span><span class='info'>Pre-Approving a Subscription Request</span><span>)</span></a>). Here the 'from' address MUST be the bare JID of the contact, since specifying a full JID would constitute a presence leak as described in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>. | ||
2310 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2311 | CS: <presence from='mercutio@example.com' | ||
2312 | id='xv291f38' | ||
2313 | to='juliet@example.com' | ||
2314 | type='unsubscribed'/> | ||
2315 | </pre></div> | ||
2316 | However, if a server receives a presence probe from a configured domain of the server itself or another such trusted service, it MAY provide presence information about the user to that entity. | ||
2317 | |||
2318 | </li> | ||
2319 | <li>Else, if the contact has moved temporarily or permanently to another address, then the server SHOULD return a presence stanza of type "error" with a stanza error condition of <redirect/> (temporary) or <gone/> (permanent) that includes the new address of the contact. | ||
2320 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2321 | CS: <presence from='mercutio@example.com' | ||
2322 | id='xv291f38' | ||
2323 | to='juliet@example.com' | ||
2324 | type='error'> | ||
2325 | <error type='modify'> | ||
2326 | <gone xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'> | ||
2327 | xmpp:la-mer@example.com | ||
2328 | </gone> | ||
2329 | </error> | ||
2330 | </presence> | ||
2331 | </pre></div> | ||
2332 | |||
2333 | </li> | ||
2334 | <li>Else, if the contact has no available resources, then the server SHOULD reply to the presence probe by sending to the user a presence stanza of type "unavailable" (although sending unavailable presence here is preferable because it results in a deterministic answer to the probe, it is not mandatory because it can greatly increase the number of presence notifications generated by the contact's server). Here the 'from' address is the bare JID because there is no available resource associated with the contact. | ||
2335 | |||
2336 | If appropriate in accordance with local security policies this presence notification MAY include the full XML of the last unavailable presence stanza that the server received from the contact (including the 'id' of the original stanza), but if not then the presence notification SHOULD simply indicate that the contact is unavailable without any of the details originally provided. In any case, the presence notification returned to the probing entity SHOULD include information about the time when the last unavailable presence stanza was generated (formatted using the XMPP delayed delivery extension <a class='info' href='#DELAY'>[DELAY]<span> (</span><span class='info'>Saint-Andre, P., “Delayed Delivery,” September 2009.</span><span>)</span></a>). | ||
2337 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2338 | CS: <presence from='mercutio@example.com' | ||
2339 | id='xv291f38' | ||
2340 | to='juliet@example.com' | ||
2341 | type='unavailable'> | ||
2342 | <delay xmlns='urn:xmpp:delay' | ||
2343 | stamp='2002-09-10T23:41:07Z'/> | ||
2344 | </presence> | ||
2345 | </pre></div> | ||
2346 | |||
2347 | </li> | ||
2348 | <li>Else, if the contact has at least one available resource, then the server MUST reply to the presence probe by sending to the user the full XML of the last presence stanza with no 'to' attribute received by the server from each of the contact's available resources. Here the 'from' addresses are the full JIDs of each available resource. | ||
2349 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2350 | CS: <presence from='romeo@example.net/foo' | ||
2351 | id='hzf1v27k' | ||
2352 | to='juliet@example.com'/> | ||
2353 | |||
2354 | CS: <presence from='romeo@example.net/bar' | ||
2355 | id='ps6t1fu3' | ||
2356 | to='juliet@example.com'> | ||
2357 | <show>away</show> | ||
2358 | </presence> | ||
2359 | </pre></div> | ||
2360 | |||
2361 | </li> | ||
2362 | </ol><p> | ||
2363 | |||
2364 | </p> | ||
2365 | <p></p> | ||
2366 | <blockquote class="text"> | ||
2367 | <p>Implementation Note: By "full XML" is meant the complete stanza from the opening <presence> tag to the closing </presence> tag, including all elements and attributes whether qualified by the content namespace or extended namespaces; however, in accordance with <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>, the contact's server will need to transform the content namespace from 'jabber:client' to 'jabber:server' if it sends the complete stanza over a server-to-server stream. | ||
2368 | </p> | ||
2369 | </blockquote> | ||
2370 | |||
2371 | <p>If the contact's server receives a presence probe addressed to a full JID of the contact, the server MUST NOT return presence information about any resource except the resource specified by the 'to' address of the probe. Rules #1 and #2 for a bare JID probe apply equally to the case of a full JID probe. If there is a resource matching the full JID and the probing entity has authorization via a presence subscription to see the contact's presence, then the server MUST return an available presence notification, which SHOULD communicate only the fact that the resource is available (not detailed information such as the <show/>, <status/>, <priority/>, or presence extensions). | ||
2372 | </p> | ||
2373 | <p> | ||
2374 | </p> | ||
2375 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2376 | CS: <presence from='romeo@example.net/bar' | ||
2377 | to='lobby@chat.example.com'/> | ||
2378 | </pre></div><p> | ||
2379 | |||
2380 | |||
2381 | </p> | ||
2382 | <p></p> | ||
2383 | <blockquote class="text"> | ||
2384 | <p>Implementation Note: See <a class='info' href='#presence-directed'>Section 4.6<span> (</span><span class='info'>Directed Presence</span><span>)</span></a> regarding rules that supplement the foregoing for handling of directed presence. | ||
2385 | </p> | ||
2386 | </blockquote> | ||
2387 | |||
2388 | <a name="presence-probe-inbound-id"></a><br /><hr /> | ||
2389 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2390 | <a name="rfc.section.4.3.2.1"></a><h3>4.3.2.1. | ||
2391 | Handling of the 'id' Attribute</h3> | ||
2392 | |||
2393 | <p>The handling of the 'id' attribute in relation to | ||
2394 | presence probes was unspecified in RFC 3921. Although the | ||
2395 | pattern of "send a probe and receive a reply" might seem | ||
2396 | like a request-response protocol similar to the XMPP | ||
2397 | <iq/> stanza, in fact it is not because the response | ||
2398 | to a probe might consist of multiple presence stanzas (one | ||
2399 | for each available resource currently active for the | ||
2400 | contact). For this reason, if the contact currently has | ||
2401 | available resources then the contact's server SHOULD | ||
2402 | preserve the 'id' attribute of the contact's original | ||
2403 | presence stanza (if any) when sending those presence | ||
2404 | notifications to the probing entity. By contrast, if the contact currently has no available resources, the probing entity is not authorized (via presence subscription) to see the contact's presence, or an error occurs in relation to the probe, then the contact's server SHOULD mirror the 'id' of the user's presence probe when replying to the probing entity. | ||
2405 | </p> | ||
2406 | <p>The following examples illustrate the difference. | ||
2407 | </p> | ||
2408 | <p>In the first scenario, Juliet sends presence from her "chamber" resource. | ||
2409 | </p> | ||
2410 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2411 | CC: <presence from='juliet@example.com/chamber' id='pres1'> | ||
2412 | <show>dnd</show> | ||
2413 | <status>busy!</status> | ||
2414 | </presence> | ||
2415 | </pre></div><p> | ||
2416 | |||
2417 | |||
2418 | </p> | ||
2419 | <p>She also sends presence from her "balcony" resource. | ||
2420 | </p> | ||
2421 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2422 | CC: <presence from='juliet@example.com/balcony' id='pres2'> | ||
2423 | <show>away</show> | ||
2424 | <status>stepped away</status> | ||
2425 | </presence> | ||
2426 | </pre></div><p> | ||
2427 | |||
2428 | |||
2429 | </p> | ||
2430 | <p>Romeo's server then sends a probe to Juliet. | ||
2431 | </p> | ||
2432 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2433 | US: <presence from='romeo@example.net' id='probe1' type='probe'/> | ||
2434 | </pre></div><p> | ||
2435 | |||
2436 | |||
2437 | </p> | ||
2438 | <p>Juliet's server then sends both of her presence notifications to Romeo, preserving the 'id' attributes included in the stanzas that her client has sent. | ||
2439 | </p> | ||
2440 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2441 | CS: <presence from='juliet@example.com/chamber' id='pres1'> | ||
2442 | <show>dnd</show> | ||
2443 | <status>busy!</status> | ||
2444 | </presence> | ||
2445 | |||
2446 | CS: <presence from='juliet@example.com/balcony' id='pres2'> | ||
2447 | <show>away</show> | ||
2448 | <status>stepped away</status> | ||
2449 | </presence> | ||
2450 | </pre></div><p> | ||
2451 | |||
2452 | |||
2453 | </p> | ||
2454 | <p>In the second scenario, Juliet is offline when Romeo's server sends a probe. | ||
2455 | </p> | ||
2456 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2457 | US: <presence from='romeo@example.net' | ||
2458 | id='probe2' | ||
2459 | type='probe'/> | ||
2460 | </pre></div><p> | ||
2461 | |||
2462 | |||
2463 | </p> | ||
2464 | <p>Juliet's server replies with an unavailable notification, mirroring the 'id' of Rome's presence probe because there is no 'id' to preserve from an available notification that her client has sent. | ||
2465 | </p> | ||
2466 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2467 | CS: <presence from='juliet@example.com' | ||
2468 | id='probe2' | ||
2469 | type='unavailable'/> | ||
2470 | </pre></div><p> | ||
2471 | |||
2472 | |||
2473 | </p> | ||
2474 | <a name="presence-broadcast"></a><br /><hr /> | ||
2475 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2476 | <a name="rfc.section.4.4"></a><h3>4.4. | ||
2477 | Subsequent Presence Broadcast</h3> | ||
2478 | |||
2479 | <a name="presence-broadcast-gen"></a><br /><hr /> | ||
2480 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2481 | <a name="rfc.section.4.4.1"></a><h3>4.4.1. | ||
2482 | Client Generation of Subsequent Presence Broadcast</h3> | ||
2483 | |||
2484 | <p>After sending initial presence, at any time during its session the user's client can update its availability for broadcast by sending a presence stanza with no 'to' address and no 'type' attribute. | ||
2485 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2486 | UC: <presence> | ||
2487 | <show>away</show> | ||
2488 | </presence> | ||
2489 | </pre></div> | ||
2490 | <p>The presence broadcast MAY contain the <priority/> element, the <show/> element, and one or more instances of the <status/> element, as well as extended content; details are provided under <a class='info' href='#presence-syntax'>Section 4.7<span> (</span><span class='info'>Presence Syntax</span><span>)</span></a>. | ||
2491 | </p> | ||
2492 | <p>However, a user SHOULD send a presence update only to broadcast information that is relevant to the user's availability for communication or the communication capabilities of the resource. Information that is not relevant in this way might be of interest to the user's contacts but SHOULD be sent via other means, such as the "publish-subscribe" method described in <a class='info' href='#XEP-0163'>[XEP‑0163]<span> (</span><span class='info'>Saint-Andre, P. and K. Smith, “Personal Eventing Protocol,” July 2010.</span><span>)</span></a>. | ||
2493 | </p> | ||
2494 | <a name="presence-broadcast-outbound"></a><br /><hr /> | ||
2495 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2496 | <a name="rfc.section.4.4.2"></a><h3>4.4.2. | ||
2497 | Server Processing of Subsequent Outbound Presence</h3> | ||
2498 | |||
2499 | <p>Upon receiving a presence stanza expressing updated availability, the user's server MUST broadcast the full XML of that presence stanza to the contacts who are in the user's roster with a subscription type of "from" or "both". | ||
2500 | </p> | ||
2501 | <p></p> | ||
2502 | <blockquote class="text"> | ||
2503 | <p>Interoperability Note: RFC 3921 specified that the user's server would check to make sure that it had not received a presence error from the contact before sending subsequent presence notifications. That rule has been removed because this specification uses presence stanzas of type "unsubscribe" (not "error") to solve subscription synchronization problems, in part because such stanzas change the contact's subscription state in the user's roster to either "none" or "to" (see <a class='info' href='#sub-unsub'>Section 3.3<span> (</span><span class='info'>Unsubscribing</span><span>)</span></a> and <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>), thus obviating the need for the error check. | ||
2504 | </p> | ||
2505 | </blockquote> | ||
2506 | |||
2507 | <p></p> | ||
2508 | <blockquote class="text"> | ||
2509 | <p>Interoperability Note: If the subscription type is "both", some existing server implementations send subsequent presence notifications to a contact only if the contact is online according to the user's server (that is, if the user's server never received a positive indication that the contact is online in response to the presence probe it sent to the contact, the user's server does not send subsequent presence notifications from the user to the contact). This behavior is perceived to save bandwidth, since most presence subscriptions are bidirectional and many contacts will not be online at any given time. | ||
2510 | </p> | ||
2511 | </blockquote> | ||
2512 | <div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2513 | US: <presence from='juliet@example.com/balcony' | ||
2514 | to='romeo@example.net'> | ||
2515 | <show>away</show> | ||
2516 | </presence> | ||
2517 | |||
2518 | US: <presence from='juliet@example.com/balcony' | ||
2519 | to='benvolio@example.net'> | ||
2520 | <show>away</show> | ||
2521 | </presence> | ||
2522 | |||
2523 | US: <presence from='juliet@example.com/balcony' | ||
2524 | to='mercutio@example.com'> | ||
2525 | <show>away</show> | ||
2526 | </presence> | ||
2527 | </pre></div> | ||
2528 | <p></p> | ||
2529 | <blockquote class="text"> | ||
2530 | <p>Implementation Note: See <a class='info' href='#presence-directed'>Section 4.6<span> (</span><span class='info'>Directed Presence</span><span>)</span></a> regarding rules that supplement the foregoing for handling of directed presence. | ||
2531 | </p> | ||
2532 | </blockquote> | ||
2533 | |||
2534 | <p>The user's server MUST also send the presence stanza to all of the user's available resources (including the resource that generated the presence notification in the first place). | ||
2535 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2536 | US: <presence from='juliet@example.com/balcony' | ||
2537 | to='juliet@example.com/chamber'> | ||
2538 | <show>away</show> | ||
2539 | </presence> | ||
2540 | |||
2541 | US: <presence from='juliet@example.com/balcony' | ||
2542 | to='juliet@example.com/balcony'> | ||
2543 | <show>away</show> | ||
2544 | </presence> | ||
2545 | </pre></div> | ||
2546 | <a name="presence-broadcast-inbound"></a><br /><hr /> | ||
2547 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2548 | <a name="rfc.section.4.4.3"></a><h3>4.4.3. | ||
2549 | Server Processing of Subsequent Inbound Presence</h3> | ||
2550 | |||
2551 | <p>Upon receiving presence from the user, the contact's server MUST deliver the user's presence stanza to all of the contact's available resources. | ||
2552 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2553 | [ ... to resource1 ... ] | ||
2554 | |||
2555 | CS: <presence from='juliet@example.com/balcony' | ||
2556 | to='romeo@example.net'> | ||
2557 | <show>away</show> | ||
2558 | </presence> | ||
2559 | |||
2560 | [ ... to resource2 ... ] | ||
2561 | |||
2562 | CS: <presence from='juliet@example.com/balcony' | ||
2563 | to='romeo@example.net'> | ||
2564 | <show>away</show> | ||
2565 | </presence> | ||
2566 | </pre></div> | ||
2567 | <a name="presence-broadcast-client"></a><br /><hr /> | ||
2568 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2569 | <a name="rfc.section.4.4.4"></a><h3>4.4.4. | ||
2570 | Client Processing of Subsequent Presence</h3> | ||
2571 | |||
2572 | <p>From the perspective of the contact's client, there is no significant difference between initial presence broadcast and subsequent presence, so the contact's client follows the rules for processing of inbound presence defined under <a class='info' href='#presence-broadcast-inbound'>Section 4.4.3<span> (</span><span class='info'>Server Processing of Subsequent Inbound Presence</span><span>)</span></a>. | ||
2573 | </p> | ||
2574 | <a name="presence-unavailable"></a><br /><hr /> | ||
2575 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2576 | <a name="rfc.section.4.5"></a><h3>4.5. | ||
2577 | Unavailable Presence</h3> | ||
2578 | |||
2579 | <a name="presence-unavailable-gen"></a><br /><hr /> | ||
2580 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2581 | <a name="rfc.section.4.5.1"></a><h3>4.5.1. | ||
2582 | Client Generation of Unavailable Presence</h3> | ||
2583 | |||
2584 | <p>Before ending its presence session with a server, the user's client SHOULD gracefully become unavailable by sending "unavailable presence", i.e., a presence stanza that possesses no 'to' attribute and that possesses a 'type' attribute whose value is "unavailable". | ||
2585 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2586 | UC: <presence type='unavailable'/> | ||
2587 | </pre></div> | ||
2588 | <p>Optionally, the unavailable presence stanza MAY contain one or more <status/> elements specifying the reason why the user is no longer available. | ||
2589 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2590 | UC: <presence type='unavailable'> | ||
2591 | <status>going on vacation</status> | ||
2592 | </presence> | ||
2593 | </pre></div> | ||
2594 | <p>However, the unavailable presence stanza MUST NOT contain the <priority/> element or the <show/> element, since these elements apply only to available resources. | ||
2595 | </p> | ||
2596 | <a name="presence-unavailable-outbound"></a><br /><hr /> | ||
2597 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2598 | <a name="rfc.section.4.5.2"></a><h3>4.5.2. | ||
2599 | Server Processing of Outbound Unavailable Presence</h3> | ||
2600 | |||
2601 | <p>The user's server MUST NOT depend on receiving unavailable presence from an available resource, since the resource might become unavailable ungracefully (e.g., the resource's XML stream might be closed with or without a stream error for any of the reasons described in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>). | ||
2602 | </p> | ||
2603 | <p>If an available resource becomes unavailable for any reason (either gracefully or ungracefully), the user's server MUST broadcast unavailable presence to all contacts that are in the user's roster with a subscription type of "from" or "both". | ||
2604 | </p> | ||
2605 | <p></p> | ||
2606 | <blockquote class="text"> | ||
2607 | <p>Interoperability Note: RFC 3921 specified that the user's server would check to make sure that it had not received a presence error from the contact before sending unavailable presence notifications. That rule has been removed because this specification uses presence stanzas of type "unsubscribe" (not "error") to solve subscription synchronization problems, in part because such stanzas change the contact's subscription state in the user's roster to either "none" or "to" (see <a class='info' href='#sub-unsub'>Section 3.3<span> (</span><span class='info'>Unsubscribing</span><span>)</span></a> and <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>), thus obviating the need for the error check. | ||
2608 | </p> | ||
2609 | </blockquote> | ||
2610 | |||
2611 | <p></p> | ||
2612 | <blockquote class="text"> | ||
2613 | <p>Implementation Note: Even if the user's server does not broadcast the user's subsequent presence notifications to contacts who are offline (as described under <a class='info' href='#presence-broadcast-outbound'>Section 4.4.2<span> (</span><span class='info'>Server Processing of Subsequent Outbound Presence</span><span>)</span></a>), it MUST broadcast the user's unavailable presence notification; if it did not do so, the last presence received by the contact's server would be the user's initial presence for the presence session, with the result that the contact would consider the user to be online. | ||
2614 | </p> | ||
2615 | </blockquote> | ||
2616 | |||
2617 | <p></p> | ||
2618 | <blockquote class="text"> | ||
2619 | <p>Implementation Note: See <a class='info' href='#presence-directed'>Section 4.6<span> (</span><span class='info'>Directed Presence</span><span>)</span></a> regarding rules that supplement the foregoing for handling of directed presence. | ||
2620 | </p> | ||
2621 | </blockquote> | ||
2622 | |||
2623 | <p>If the unavailable notification was gracefully received from the client, then the server MUST broadcast the full XML of the presence stanza. | ||
2624 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2625 | US: <presence from='juliet@example.com/balcony' | ||
2626 | to='romeo@example.net' | ||
2627 | type='unavailable'> | ||
2628 | <status>going on vacation</status> | ||
2629 | </presence> | ||
2630 | |||
2631 | US: <presence from='juliet@example.com/balcony' | ||
2632 | to='benvolio@example.net' | ||
2633 | type='unavailable'> | ||
2634 | <status>going on vacation</status> | ||
2635 | </presence> | ||
2636 | |||
2637 | US: <presence from='juliet@example.com/balcony' | ||
2638 | to='mercutio@example.com' | ||
2639 | type='unavailable'> | ||
2640 | <status>going on vacation</status> | ||
2641 | </presence> | ||
2642 | </pre></div> | ||
2643 | <p>The user's server MUST also send the unavailable notification to all of the user's available resources (as well as to the resource that generated the unavailable presence in the first place). | ||
2644 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2645 | US: <presence from='juliet@example.com/balcony' | ||
2646 | to='juliet@example.com/chamber' | ||
2647 | type='unavailable'> | ||
2648 | <status>going on vacation</status> | ||
2649 | </presence> | ||
2650 | </pre></div> | ||
2651 | <p>If the server detects that the user has gone offline ungracefully, then the server MUST generate the unavailable presence broadcast on the user's behalf. | ||
2652 | </p> | ||
2653 | <p></p> | ||
2654 | <blockquote class="text"> | ||
2655 | <p>Implementation Note: Any presence stanza with no 'type' attribute and no 'to' attribute that the client sends after the server broadcasts or generates an unavailable presence notification MUST be routed or delivered by the user's server to all subscribers (i.e., MUST be treated as equivalent to initial presence for a new presence session). | ||
2656 | </p> | ||
2657 | </blockquote> | ||
2658 | |||
2659 | <a name="presence-unavailable-inbound"></a><br /><hr /> | ||
2660 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2661 | <a name="rfc.section.4.5.3"></a><h3>4.5.3. | ||
2662 | Server Processing of Inbound Unavailable Presence</h3> | ||
2663 | |||
2664 | <p>Upon receiving an unavailable notification from the user, the contact's server MUST deliver the user's presence stanza to all of the contact's available resources. | ||
2665 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2666 | [ ... to resource1 ... ] | ||
2667 | |||
2668 | CS: <presence from='juliet@example.com/balcony' | ||
2669 | to='romeo@example.net' | ||
2670 | type='unavailable'> | ||
2671 | <status>going on vacation</status> | ||
2672 | </presence> | ||
2673 | |||
2674 | [ ... to resource2 ... ] | ||
2675 | |||
2676 | CS: <presence from='juliet@example.com/balcony' | ||
2677 | to='romeo@example.net' | ||
2678 | type='unavailable'> | ||
2679 | <status>going on vacation</status> | ||
2680 | </presence> | ||
2681 | </pre></div> | ||
2682 | <p></p> | ||
2683 | <blockquote class="text"> | ||
2684 | <p>Implementation Note: If the contact's server does not broadcast subsequent presence notifications to users who are offline (as described under <a class='info' href='#presence-broadcast-outbound'>Section 4.4.2<span> (</span><span class='info'>Server Processing of Subsequent Outbound Presence</span><span>)</span></a>), it MUST also update its internal representation of which entities are online by noting that the user is unavailable. | ||
2685 | </p> | ||
2686 | </blockquote> | ||
2687 | |||
2688 | <a name="presence-unavailable-client"></a><br /><hr /> | ||
2689 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2690 | <a name="rfc.section.4.5.4"></a><h3>4.5.4. | ||
2691 | Client Processing of Unavailable Presence</h3> | ||
2692 | |||
2693 | <p>From the perspective of the contact's client, there is no significant difference between available presence broadcast and unavailable presence broadcast, so in general the contact's client follows the rules for processing of inbound presence defined under <a class='info' href='#presence-broadcast-inbound'>Section 4.4.3<span> (</span><span class='info'>Server Processing of Subsequent Inbound Presence</span><span>)</span></a>. | ||
2694 | </p> | ||
2695 | <p>However, if the contact receives an unavailable notification from the bare JID of the user (rather than the full JID of a particular available resource), the contact's client SHOULD treat the unavailable notification as applying to all resources. | ||
2696 | </p> | ||
2697 | <a name="presence-directed"></a><br /><hr /> | ||
2698 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2699 | <a name="rfc.section.4.6"></a><h3>4.6. | ||
2700 | Directed Presence</h3> | ||
2701 | |||
2702 | <p>This section supplements the rules for client and server processing of presence notifications and presence probes, but only for the special case of directed presence. | ||
2703 | </p> | ||
2704 | <a name="presence-directed-considerations"></a><br /><hr /> | ||
2705 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2706 | <a name="rfc.section.4.6.1"></a><h3>4.6.1. | ||
2707 | General Considerations</h3> | ||
2708 | |||
2709 | <p>In general, a client sends directed presence when it wishes to share availability information with an entity that is not subscribed to its presence, typically on a temporary basis. Common uses of directed presence include casual one-to-one chat sessions as described under <a class='info' href='#message-chat'>Section 5.1<span> (</span><span class='info'>One-to-One Chat Sessions</span><span>)</span></a> and multi-user chat rooms as described in <a class='info' href='#XEP-0045'>[XEP‑0045]<span> (</span><span class='info'>Saint-Andre, P., “Multi-User Chat,” July 2008.</span><span>)</span></a>. | ||
2710 | </p> | ||
2711 | <p>The temporary relationship established by sharing directed presence with another entity is secondary to the permanent relationship established through a presence subscription. Therefore, the acts of creating, modifying, or canceling a presence subscription MUST take precedence over the rules specified in the following subsections. For example, if a user shares directed presence with a contact but then adds the contact to the user's roster by completing the presence subscription "handshake", the user's server MUST treat the contact just as it would any normal subscriber as described under <a class='info' href='#sub'>Section 3<span> (</span><span class='info'>Managing Presence Subscriptions</span><span>)</span></a>, for example, by sending subsequent presence broadcasts to the contact. As another example, if the user then cancels the contact's subscription to the user's presence, the user's server MUST handle the cancellation just as it normally would as described under <a class='info' href='#sub-cancel'>Section 3.2<span> (</span><span class='info'>Canceling a Subscription</span><span>)</span></a>, which includes sending unavailable presence to the contact even if the user has sent directed presence to the contact. | ||
2712 | </p> | ||
2713 | <p>XMPP servers typically implement directed presence by keeping a list of the entities (bare JIDs or full JIDs) to which a user has sent directed presence during the user's current session for a given resource (full JID), then clearing the list when the user goes offline (e.g., by sending a broadcast presence stanza of type "unavailable"). The server MUST remove from the directed presence list (or its functional equivalent) any entity to which the user sends directed unavailable presence and SHOULD remove any entity that sends unavailable presence to the user. | ||
2714 | </p> | ||
2715 | <a name="presence-directed-gen"></a><br /><hr /> | ||
2716 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2717 | <a name="rfc.section.4.6.2"></a><h3>4.6.2. | ||
2718 | Client Generation of Directed Presence</h3> | ||
2719 | |||
2720 | <p>As noted, directed presence is a client-generated presence stanza with a 'to' attribute whose value is the bare JID or full JID of the other entity and with either no 'type' attribute (indicating availability) or a 'type' attribute whose value is "unavailable". | ||
2721 | </p> | ||
2722 | <a name="presence-directed-outbound"></a><br /><hr /> | ||
2723 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2724 | <a name="rfc.section.4.6.3"></a><h3>4.6.3. | ||
2725 | Server Processing of Outbound Directed Presence</h3> | ||
2726 | |||
2727 | <p>When the user's server receives a directed presence stanza, it SHOULD process it according to the following rules. | ||
2728 | </p> | ||
2729 | <p> | ||
2730 | </p> | ||
2731 | <ol class="text"> | ||
2732 | <li>If the user sends directed available or unavailable presence to a contact that is in the user's roster with a subscription type of "from" or "both" after having sent initial presence and before sending unavailable presence broadcast (i.e., during the user's presence session), the user's server MUST locally deliver or remotely route the full XML of that presence stanza but SHOULD NOT otherwise modify the contact's status regarding presence broadcast (i.e., it SHOULD include the contact's JID in any subsequent presence broadcasts initiated by the user). | ||
2733 | </li> | ||
2734 | <li>If the user sends directed presence to an entity that is not in the user's roster with a subscription type of "from" or "both" after having sent initial presence and before sending unavailable presence broadcast (i.e., during the user's presence session), the user's server MUST locally deliver or remotely route the full XML of that presence stanza to the entity but MUST NOT modify the contact's status regarding available presence broadcast (i.e., it MUST NOT include the entity's JID in any subsequent broadcasts of available presence initiated by the user); however, if the available resource from which the user sent the directed presence becomes unavailable, the user's server MUST route that unavailable presence to the entity (if the user has not yet sent directed unavailable presence to that entity). | ||
2735 | </li> | ||
2736 | <li>If the user sends directed presence without first sending initial presence or after having sent unavailable presence broadcast (i.e., the resource is connected but not available), the user's server MUST treat the entity to which the user sends directed presence as in case #2 above. | ||
2737 | </li> | ||
2738 | </ol><p> | ||
2739 | |||
2740 | </p> | ||
2741 | <a name="presence-directed-inbound"></a><br /><hr /> | ||
2742 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2743 | <a name="rfc.section.4.6.4"></a><h3>4.6.4. | ||
2744 | Server Processing of Inbound Directed Presence</h3> | ||
2745 | |||
2746 | <p>From the perspective of the contact's server, there is no | ||
2747 | significant difference between presence broadcast and directed presence, so the | ||
2748 | contact's server follows the rules for processing of inbound presence defined | ||
2749 | under Sections <a class='info' href='#presence-probe-inbound'>4.3.2<span> (</span><span class='info'>Server Processing of Inbound Presence Probe</span><span>)</span></a>, <a class='info' href='#presence-broadcast-inbound'>4.4.3<span> (</span><span class='info'>Server Processing of Subsequent Inbound Presence</span><span>)</span></a>, and <a class='info' href='#presence-unavailable-inbound'>4.5.3<span> (</span><span class='info'>Server Processing of Inbound Unavailable Presence</span><span>)</span></a>. | ||
2750 | </p> | ||
2751 | <a name="presence-directed-client"></a><br /><hr /> | ||
2752 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2753 | <a name="rfc.section.4.6.5"></a><h3>4.6.5. | ||
2754 | Client Processing of Inbound Directed Presence</h3> | ||
2755 | |||
2756 | <p>From the perspective of the contact's client, there is no significant difference between presence broadcast and directed presence, so the contact's client follows the rules for processing of inbound presence defined under <a class='info' href='#presence-broadcast-inbound'>Section 4.4.3<span> (</span><span class='info'>Server Processing of Subsequent Inbound Presence</span><span>)</span></a>. | ||
2757 | </p> | ||
2758 | <a name="presence-directed-probe"></a><br /><hr /> | ||
2759 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2760 | <a name="rfc.section.4.6.6"></a><h3>4.6.6. | ||
2761 | Server Processing of Presence Probes</h3> | ||
2762 | |||
2763 | <p>If a user's client has sent directed presence to another entity (e.g., a one-to-one chat partner or a multi-user chat room), after some time the entity or its server might want to know if the client is still online. This scenario is especially common in the case of multi-user chat rooms, in which the user might be a participant for a long period of time. If the user's client goes offline without the chat room being informed (either by the client or the client's server), the user's representation in the room might become a "ghost" that appears to be participating but that in fact is no longer present in the room. To detect such "ghosts", some multi-user chat room implementations send presence probes to users that have joined the room. | ||
2764 | </p> | ||
2765 | <p>In the case of directed presence, the probing entity SHOULD send the probe from the JID that received directed presence (whether a full JID or a bare JID). The probe SHOULD be sent to the user's full JID, not the user's bare JID without a resourcepart, because the temporary "authorization" involved with directed presence is based on the full JID from which the user sent directed presence to the probing entity. When the user's server receives a probe, it MUST first apply any logic associated with presence subscriptions as described under <a class='info' href='#presence-probe-inbound'>Section 4.3.2<span> (</span><span class='info'>Server Processing of Inbound Presence Probe</span><span>)</span></a>. If the probing entity does not have a subscription to the user's presence, then the server MUST check if the user has sent directed presence to the entity during its current session; if so, the server SHOULD answer the probe with only mere presence of type "available" or "unavailable" (i.e., not including child elements) and only for that full JID (i.e., not for any other resources that might be currently associated with the user's bare JID). | ||
2766 | </p> | ||
2767 | <a name="presence-syntax"></a><br /><hr /> | ||
2768 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2769 | <a name="rfc.section.4.7"></a><h3>4.7. | ||
2770 | Presence Syntax</h3> | ||
2771 | |||
2772 | <a name="presence-syntax-type"></a><br /><hr /> | ||
2773 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2774 | <a name="rfc.section.4.7.1"></a><h3>4.7.1. | ||
2775 | Type Attribute</h3> | ||
2776 | |||
2777 | <p>The absence of a 'type' attribute signals that the relevant entity is available for communication (see <a class='info' href='#presence-initial'>Section 4.2<span> (</span><span class='info'>Initial Presence</span><span>)</span></a> and <a class='info' href='#presence-broadcast'>Section 4.4<span> (</span><span class='info'>Subsequent Presence Broadcast</span><span>)</span></a>). | ||
2778 | </p> | ||
2779 | <p>A 'type' attribute with a value of "unavailable" signals that the relevant entity is not available for communication (see <a class='info' href='#presence-unavailable'>Section 4.5<span> (</span><span class='info'>Unavailable Presence</span><span>)</span></a>). | ||
2780 | </p> | ||
2781 | <p>The XMPP presence stanza is also used to negotiate and manage subscriptions to the presence of other entities. These tasks are completed via presence stanzas of type "subscribe", "unsubscribe", "subscribed", and "unsubscribed" as described under <a class='info' href='#sub'>Section 3<span> (</span><span class='info'>Managing Presence Subscriptions</span><span>)</span></a>. | ||
2782 | </p> | ||
2783 | <p>If a user and contact are associated with different XMPP servers, those servers also use a special presence stanza of type "probe" in order to determine the availability of the entity on the peer server; details are provided under <a class='info' href='#presence-probe'>Section 4.3<span> (</span><span class='info'>Presence Probes</span><span>)</span></a>. Clients SHOULD NOT send presence stanzas of type "probe". | ||
2784 | </p> | ||
2785 | <p>The values of the 'type' attribute can be summarized as follows: | ||
2786 | </p> | ||
2787 | <p> | ||
2788 | </p> | ||
2789 | <ul class="text"> | ||
2790 | <li>error -- An error has occurred regarding processing of a previously sent presence stanza; if the presence stanza is of type "error", it MUST include an <error/> child element (refer to <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>). | ||
2791 | </li> | ||
2792 | <li>probe -- A request for an entity's current presence; SHOULD be generated only by a server on behalf of a user. | ||
2793 | </li> | ||
2794 | <li>subscribe -- The sender wishes to subscribe to the recipient's presence. | ||
2795 | </li> | ||
2796 | <li>subscribed -- The sender has allowed the recipient to receive their presence. | ||
2797 | </li> | ||
2798 | <li>unavailable -- The sender is no longer available for communication. | ||
2799 | </li> | ||
2800 | <li>unsubscribe -- The sender is unsubscribing from the receiver's presence. | ||
2801 | </li> | ||
2802 | <li>unsubscribed -- The subscription request has been denied or a previously granted subscription has been canceled. | ||
2803 | </li> | ||
2804 | </ul><p> | ||
2805 | |||
2806 | </p> | ||
2807 | <p>If the value of the 'type' attribute is not one of the foregoing values, the recipient or an intermediate router SHOULD return a stanza error of <bad-request/>. | ||
2808 | </p> | ||
2809 | <p></p> | ||
2810 | <blockquote class="text"> | ||
2811 | <p>Implementation Note: There is no default value for the 'type' attribute of the <presence/> element. | ||
2812 | </p> | ||
2813 | </blockquote> | ||
2814 | |||
2815 | <p></p> | ||
2816 | <blockquote class="text"> | ||
2817 | <p>Implementation Note: There is no value of "available" for the 'type' attribute of the <presence/> element. | ||
2818 | </p> | ||
2819 | </blockquote> | ||
2820 | |||
2821 | <a name="presence-syntax-children"></a><br /><hr /> | ||
2822 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2823 | <a name="rfc.section.4.7.2"></a><h3>4.7.2. | ||
2824 | Child Elements</h3> | ||
2825 | |||
2826 | <p>In accordance with the default namespace declaration, a presence stanza is qualified by the 'jabber:client' or 'jabber:server' namespace, which defines certain child elements of presence stanzas, in particular the <show/>, <status/>, and <priority/> elements. These child elements are used to provide more detailed information about an entity's availability. Typically these child elements are included only if the presence stanza possesses no 'type' attribute, although exceptions are noted in the text that follows. | ||
2827 | </p> | ||
2828 | <a name="presence-syntax-children-show"></a><br /><hr /> | ||
2829 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2830 | <a name="rfc.section.4.7.2.1"></a><h3>4.7.2.1. | ||
2831 | Show Element</h3> | ||
2832 | |||
2833 | <p>The OPTIONAL <show/> element specifies the particular availability sub-state of an entity or a specific resource thereof. A presence stanza MUST NOT contain more than one <show/> element. There are no attributes defined for the <show/> element. The <show/> element MUST NOT contain mixed content (as defined in Section 3.2.2 of <a class='info' href='#XML'>[XML]<span> (</span><span class='info'>Maler, E., Yergeau, F., Sperberg-McQueen, C., Paoli, J., and T. Bray, “Extensible Markup Language (XML) 1.0 (Fifth Edition),” November 2008.</span><span>)</span></a>). The XML character data of the <show/> element is not meant for presentation to a human user. The XML character data MUST be one of the following (additional availability states could be defined through extended content elements): | ||
2834 | </p> | ||
2835 | <p> | ||
2836 | </p> | ||
2837 | <ul class="text"> | ||
2838 | <li>away -- The entity or resource is temporarily away. | ||
2839 | </li> | ||
2840 | <li>chat -- The entity or resource is actively interested in chatting. | ||
2841 | </li> | ||
2842 | <li>dnd -- The entity or resource is busy (dnd = "Do Not Disturb"). | ||
2843 | </li> | ||
2844 | <li>xa -- The entity or resource is away for an extended period (xa = "eXtended Away"). | ||
2845 | </li> | ||
2846 | </ul><p> | ||
2847 | |||
2848 | </p> | ||
2849 | <p>If no <show/> element is provided, the entity is assumed to be online and available. | ||
2850 | </p> | ||
2851 | <p>Any specialized processing of availability states by recipients and intermediate routers is up to the implementation (e.g., incorporation of availability states into stanza routing and delivery logic). | ||
2852 | </p> | ||
2853 | <a name="presence-syntax-children-status"></a><br /><hr /> | ||
2854 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2855 | <a name="rfc.section.4.7.2.2"></a><h3>4.7.2.2. | ||
2856 | Status Element</h3> | ||
2857 | |||
2858 | <p>The OPTIONAL <status/> element contains human-readable XML character data specifying a natural-language description of an entity's availability. It is normally used in conjunction with the show element to provide a detailed description of an availability state (e.g., "In a meeting") when the presence stanza has no 'type' attribute. | ||
2859 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2860 | <presence from='romeo@example.net/orchard' | ||
2861 | xml:lang='en'> | ||
2862 | <show>dnd</show> | ||
2863 | <status>Wooing Juliet</status> | ||
2864 | </presence> | ||
2865 | </pre></div> | ||
2866 | <p>There are no attributes defined for the <status/> element, with the exception of the 'xml:lang' attribute inherited from <a class='info' href='#XML'>[XML]<span> (</span><span class='info'>Maler, E., Yergeau, F., Sperberg-McQueen, C., Paoli, J., and T. Bray, “Extensible Markup Language (XML) 1.0 (Fifth Edition),” November 2008.</span><span>)</span></a>. The <status/> element MUST NOT contain mixed content (as defined in Section 3.2.2 of <a class='info' href='#XML'>[XML]<span> (</span><span class='info'>Maler, E., Yergeau, F., Sperberg-McQueen, C., Paoli, J., and T. Bray, “Extensible Markup Language (XML) 1.0 (Fifth Edition),” November 2008.</span><span>)</span></a>). Multiple instances of the <status/> element MAY be included, but only if each instance possesses an 'xml:lang' attribute with a distinct language value (either explicitly or by inheritance from the 'xml:lang' value of an element farther up in the XML hierarchy, which from the sender's perspective can include the XML stream header as described in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>). | ||
2867 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2868 | <presence from='romeo@example.net/orchard' | ||
2869 | id='jx62vs97' | ||
2870 | xml:lang='en'> | ||
2871 | <show>dnd</show> | ||
2872 | <status>Wooing Juliet</status> | ||
2873 | <status xml:lang='cs'>Dvo&#x0159;&#x00ED;m se Julii</status> | ||
2874 | </presence> | ||
2875 | </pre></div> | ||
2876 | <p>A presence stanza of type "unavailable" MAY also include a <status/> element to provide detailed information about why the entity is going offline. | ||
2877 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2878 | <presence from='romeo@example.net/orchard' | ||
2879 | id='oy6sb241' | ||
2880 | type='unavailable' | ||
2881 | xml:lang='en'> | ||
2882 | <status>Busy IRL</status> | ||
2883 | </presence> | ||
2884 | </pre></div> | ||
2885 | <p>The <status/> child MAY also be sent in a subscription-related presence stanza (i.e., type "subscribe", "subscribed", "unsubscribe", or "unsubscribed") to provide a description of the action. An interactive client MAY present this <status/> information to a human user (see <a class='info' href='#security'>Section 11<span> (</span><span class='info'>Security Considerations</span><span>)</span></a>). | ||
2886 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2887 | <presence from='romeo@example.net' | ||
2888 | id='uc51xs63' | ||
2889 | to='nurse@example.com' | ||
2890 | type='subscribe'> | ||
2891 | <status>Hi, Juliet told me to add you to my buddy list.</status> | ||
2892 | </presence> | ||
2893 | </pre></div> | ||
2894 | <a name="presence-syntax-children-priority"></a><br /><hr /> | ||
2895 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2896 | <a name="rfc.section.4.7.2.3"></a><h3>4.7.2.3. | ||
2897 | Priority Element</h3> | ||
2898 | |||
2899 | <p>The OPTIONAL <priority/> element contains non-human-readable XML character data that specifies the priority level of the resource. The value MUST be an integer between -128 and +127. A presence stanza MUST NOT contain more than one <priority/> element. There are no attributes defined for the <priority/> element. The <priority/> element MUST NOT contain mixed content (as defined in Section 3.2.2 of <a class='info' href='#XML'>[XML]<span> (</span><span class='info'>Maler, E., Yergeau, F., Sperberg-McQueen, C., Paoli, J., and T. Bray, “Extensible Markup Language (XML) 1.0 (Fifth Edition),” November 2008.</span><span>)</span></a>). | ||
2900 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2901 | <presence xml:lang='en'> | ||
2902 | <show>dnd</show> | ||
2903 | <status>Wooing Juliet</status> | ||
2904 | <status xml:lang='cs'>Dvo&#x0159;&#x00ED;m se Julii</status> | ||
2905 | <priority>1</priority> | ||
2906 | </presence> | ||
2907 | </pre></div> | ||
2908 | <p>If no priority is provided, the processing server or client MUST consider the priority to be zero ("0"). | ||
2909 | </p> | ||
2910 | <p>The client's server MAY override the priority value | ||
2911 | provided by the client (e.g., in order to impose a message | ||
2912 | handling rule of delivering a message intended for the | ||
2913 | account's bare JID to all of the account's available | ||
2914 | resources). If the server does so, it MUST communicate the modified priority value when it echoes the client's presence back to itself and sends the presence notification to the user's contacts (because this modified priority value is typically the default value of zero, communicating the modified priority value can be done by not including the <priority/> child element). | ||
2915 | </p> | ||
2916 | <p>For information regarding the semantics of priority values in stanza processing within instant messaging and presence applications, refer to <a class='info' href='#rules'>Section 8<span> (</span><span class='info'>Server Rules for Processing XML Stanzas</span><span>)</span></a>. | ||
2917 | </p> | ||
2918 | <a name="presence-extended"></a><br /><hr /> | ||
2919 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2920 | <a name="rfc.section.4.7.3"></a><h3>4.7.3. | ||
2921 | Extended Content</h3> | ||
2922 | |||
2923 | <p>As described in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>, an XML stanza MAY contain any child element that is qualified by a namespace other than the default namespace; this applies to the presence stanza as well. | ||
2924 | </p> | ||
2925 | <p>(In the following example, the presence stanza includes entity capabilities information as defined in <a class='info' href='#XEP-0115'>[XEP‑0115]<span> (</span><span class='info'>Hildebrand, J., Saint-Andre, P., and R. Tronçon, “Entity Capabilities,” February 2008.</span><span>)</span></a>.) | ||
2926 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2927 | <presence from='romeo@example.net'> | ||
2928 | <c xmlns='http://jabber.org/protocol/caps' | ||
2929 | hash='sha-1' | ||
2930 | node='http://psi-im.org' | ||
2931 | ver='q07IKJEyjvHSyhy//CH0CxmKi8w='/> | ||
2932 | </presence> | ||
2933 | </pre></div> | ||
2934 | <p>Any extended content included in a presence stanza SHOULD represent aspects of an entity's availability for communication or provide information about communication-related capabilities. | ||
2935 | </p> | ||
2936 | <a name="message"></a><br /><hr /> | ||
2937 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2938 | <a name="rfc.section.5"></a><h3>5. | ||
2939 | Exchanging Messages</h3> | ||
2940 | |||
2941 | <p>Once a client has authenticated with a server and bound a resource to an XML stream as described in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>, an XMPP server will route XML stanzas to and from that client. One kind of stanza that can be exchanged is <message/> (if, that is, messaging functionality is enabled on the server). Exchanging messages is a basic use of XMPP and occurs when a user generates a message stanza that is addressed to another entity. As defined under <a class='info' href='#rules'>Section 8<span> (</span><span class='info'>Server Rules for Processing XML Stanzas</span><span>)</span></a>, the sender's server is responsible for delivering the message to the intended recipient (if the recipient is on the same local server) or for routing the message to the recipient's server (if the recipient is on a remote server). Thus a message stanza is used to "push" information to another entity. | ||
2942 | </p> | ||
2943 | <a name="message-chat"></a><br /><hr /> | ||
2944 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2945 | <a name="rfc.section.5.1"></a><h3>5.1. | ||
2946 | One-to-One Chat Sessions</h3> | ||
2947 | |||
2948 | <p>In practice, instant messaging activity between human users tends to occur in the form of a conversational burst that we call a "chat session": the exchange of multiple messages between two parties in relatively rapid succession within a relatively brief period of time. | ||
2949 | </p> | ||
2950 | <p>When a human user intends to engage in such a chat session with a contact (rather than sending a single message to which no reply is expected), the message type generated by the user's client SHOULD be "chat" and the contact's client SHOULD preserve that message type in subsequent replies. The user's client also SHOULD include a <thread/> element with its initial message, which the contact's client SHOULD also preserve during the life of the chat session (see <a class='info' href='#message-syntax-thread'>Section 5.2.5<span> (</span><span class='info'>Thread Element</span><span>)</span></a>). | ||
2951 | </p> | ||
2952 | <p>The user's client SHOULD address the initial message in a chat session to the bare JID <contact@domainpart> of the contact (rather than attempting to guess an appropriate full JID <contact@domainpart/resourcepart> based on the <show/>, <status/>, or <priority/> value of any presence notifications it might have received from the contact). Until and unless the user's client receives a reply from the contact, it SHOULD send any further messages to the contact's bare JID. The contact's client SHOULD address its replies to the user's full JID <user@domainpart/resourcepart> as provided in the 'from' address of the initial message. Once the user's client receives a reply from the contact's full JID, it SHOULD address its subsequent messages to the contact's full JID as provided in the 'from' address of the contact's replies, thus "locking in" on that full JID. A client SHOULD "unlock" after having received a <message/> or <presence/> stanza from any other resource controlled by the peer (or a presence stanza from the locked resource); as a result, it SHOULD address its next message(s) in the chat session to the bare JID of the peer (thus "unlocking" the previous "lock") until it receives a message from one of the peer's full JIDs. | ||
2953 | </p> | ||
2954 | <p>When two parties engage in a chat session but do not share presence with each other based on a presence subscription, they SHOULD send directed presence to each other so that either party can easily discover if the peer goes offline during the course of the chat session. However, a client MUST provide a way for a user to disable such presence sharing globally or to enable it only with particular entities. Furthermore, a party SHOULD send directed unavailable presence to the peer when it has reason to believe that the chat session is over (e.g., if, after some reasonable amount of time, no subsequent messages have been exchanged between the parties). | ||
2955 | </p> | ||
2956 | <p>An example of a chat session is provided under <a class='info' href='#session'>Section 7<span> (</span><span class='info'>A Sample Session</span><span>)</span></a>. | ||
2957 | </p> | ||
2958 | <a name="message-syntax"></a><br /><hr /> | ||
2959 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2960 | <a name="rfc.section.5.2"></a><h3>5.2. | ||
2961 | Message Syntax</h3> | ||
2962 | |||
2963 | <p>The following sections describe the syntax of the <message/> stanza. | ||
2964 | </p> | ||
2965 | <a name="message-syntax-to"></a><br /><hr /> | ||
2966 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2967 | <a name="rfc.section.5.2.1"></a><h3>5.2.1. | ||
2968 | To Attribute</h3> | ||
2969 | |||
2970 | <p>An instant messaging client specifies an intended recipient for a message by providing the JID of the intended recipient in the 'to' attribute of the <message/> stanza. | ||
2971 | </p> | ||
2972 | <p>If the message is being sent outside the context of any existing chat session or received message, the value of the 'to' address SHOULD be of the form <localpart@domainpart> rather than of the form <localpart@domainpart/resourcepart> (see <a class='info' href='#message-chat'>Section 5.1<span> (</span><span class='info'>One-to-One Chat Sessions</span><span>)</span></a>). | ||
2973 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2974 | <message | ||
2975 | from='juliet@example.com/balcony' | ||
2976 | id='ktx72v49' | ||
2977 | to='romeo@example.net' | ||
2978 | type='chat' | ||
2979 | xml:lang='en'> | ||
2980 | <body>Art thou not Romeo, and a Montague?</body> | ||
2981 | </message> | ||
2982 | </pre></div> | ||
2983 | <p>If the message is being sent in reply to a message previously received from an address of the form <localpart@domainpart/resourcepart> (e.g., within the context of a one-to-one chat session as described under <a class='info' href='#message-chat'>Section 5.1<span> (</span><span class='info'>One-to-One Chat Sessions</span><span>)</span></a>), the value of the 'to' address SHOULD be of the form <localpart@domainpart/resourcepart> rather than of the form <localpart@domainpart> unless the sender has knowledge (e.g., via presence) that the intended recipient's resource is no longer available. | ||
2984 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
2985 | <message | ||
2986 | from='romeo@example.net/orchard' | ||
2987 | id='sl3nx51f' | ||
2988 | to='juliet@example.com/balcony' | ||
2989 | type='chat' | ||
2990 | xml:lang='en'> | ||
2991 | <body>Neither, fair saint, if either thee dislike.</body> | ||
2992 | </message> | ||
2993 | </pre></div> | ||
2994 | <a name="message-syntax-type"></a><br /><hr /> | ||
2995 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
2996 | <a name="rfc.section.5.2.2"></a><h3>5.2.2. | ||
2997 | Type Attribute</h3> | ||
2998 | |||
2999 | <p>Common uses of the message stanza in instant messaging applications include: single messages; messages sent in the context of a one-to-one chat session; messages sent in the context of a multi-user chat room; alerts, notifications, or other information to which no reply is expected; and errors. These uses are differentiated via the 'type' attribute. Inclusion of the 'type' attribute is RECOMMENDED. If included, the 'type' attribute MUST have one of the following values: | ||
3000 | </p> | ||
3001 | <p> | ||
3002 | </p> | ||
3003 | <ul class="text"> | ||
3004 | <li>chat -- The message is sent in the context of a one-to-one chat session. Typically an interactive client will present a message of type "chat" in an interface that enables one-to-one chat between the two parties, including an appropriate conversation history. Detailed recommendations regarding one-to-one chat sessions are provided under <a class='info' href='#message-chat'>Section 5.1<span> (</span><span class='info'>One-to-One Chat Sessions</span><span>)</span></a>. | ||
3005 | </li> | ||
3006 | <li>error -- The message is generated by an entity that experiences an error when processing a message received from another entity (for details regarding stanza error syntax, refer to <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>). A client that receives a message of type "error" SHOULD present an appropriate interface informing the original sender regarding the nature of the error. | ||
3007 | </li> | ||
3008 | <li>groupchat -- The message is sent in the context of a multi-user chat environment (similar to that of <a class='info' href='#IRC'>[IRC]<span> (</span><span class='info'>Kalt, C., “Internet Relay Chat: Architecture,” April 2000.</span><span>)</span></a>). Typically a receiving client will present a message of type "groupchat" in an interface that enables many-to-many chat between the parties, including a roster of parties in the chatroom and an appropriate conversation history. For detailed information about XMPP-based groupchat, refer to <a class='info' href='#XEP-0045'>[XEP‑0045]<span> (</span><span class='info'>Saint-Andre, P., “Multi-User Chat,” July 2008.</span><span>)</span></a>. | ||
3009 | </li> | ||
3010 | <li>headline -- The message provides an alert, a notification, or other transient information to which no reply is expected (e.g., news headlines, sports updates, near-real-time market data, or syndicated content). Because no reply to the message is expected, typically a receiving client will present a message of type "headline" in an interface that appropriately differentiates the message from standalone messages, chat messages, and groupchat messages (e.g., by not providing the recipient with the ability to reply). If the 'to' address is the bare JID, the receiving server SHOULD deliver the message to all of the recipient's available resources with non-negative presence priority and MUST deliver the message to at least one of those resources; if the 'to' address is a full JID and there is a matching resource, the server MUST deliver the message to that resource; otherwise the server MUST either silently ignore the message or return an error (see <a class='info' href='#rules'>Section 8<span> (</span><span class='info'>Server Rules for Processing XML Stanzas</span><span>)</span></a>). | ||
3011 | </li> | ||
3012 | <li>normal -- The message is a standalone message that is sent outside the context of a one-to-one conversation or groupchat, and to which it is expected that the recipient will reply. Typically a receiving client will present a message of type "normal" in an interface that enables the recipient to reply, but without a conversation history. The default value of the 'type' attribute is "normal". | ||
3013 | </li> | ||
3014 | </ul><p> | ||
3015 | |||
3016 | </p> | ||
3017 | <p>An IM application SHOULD support all of the foregoing message types. If an application receives a message with no 'type' attribute or the application does not understand the value of the 'type' attribute provided, it MUST consider the message to be of type "normal" (i.e., "normal" is the default). | ||
3018 | </p> | ||
3019 | <p>Guidelines for server handling of different message types is provided under <a class='info' href='#rules'>Section 8<span> (</span><span class='info'>Server Rules for Processing XML Stanzas</span><span>)</span></a>. | ||
3020 | </p> | ||
3021 | <p>Although the 'type' attribute is OPTIONAL, it is considered polite to mirror the type in any replies to a message; furthermore, some specialized applications (e.g., a multi-user chat service) MAY at their discretion enforce the use of a particular message type (e.g., type='groupchat'). | ||
3022 | </p> | ||
3023 | <a name="message-syntax-body"></a><br /><hr /> | ||
3024 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3025 | <a name="rfc.section.5.2.3"></a><h3>5.2.3. | ||
3026 | Body Element</h3> | ||
3027 | |||
3028 | <p>The <body/> element contains human-readable XML character data that specifies the textual contents of the message; this child element is normally included but is OPTIONAL. | ||
3029 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3030 | <message | ||
3031 | from='juliet@example.com/balcony' | ||
3032 | id='b4vs9km4' | ||
3033 | to='romeo@example.net' | ||
3034 | type='chat' | ||
3035 | xml:lang='en'> | ||
3036 | <body>Wherefore art thou, Romeo?</body> | ||
3037 | </message> | ||
3038 | </pre></div> | ||
3039 | <p>There are no attributes defined for the <body/> element, with the exception of the 'xml:lang' attribute. Multiple instances of the <body/> element MAY be included in a message stanza for the purpose of providing alternate versions of the same body, but only if each instance possesses an 'xml:lang' attribute with a distinct language value (either explicitly or by inheritance from the 'xml:lang' value of an element farther up in the XML hierarchy, which from the sender's perspective can include the XML stream header as described in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>). | ||
3040 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3041 | <message | ||
3042 | from='juliet@example.com/balcony' | ||
3043 | id='z94nb37h' | ||
3044 | to='romeo@example.net' | ||
3045 | type='chat' | ||
3046 | xml:lang='en'> | ||
3047 | <body>Wherefore art thou, Romeo?</body> | ||
3048 | <body xml:lang='cs'> | ||
3049 | Pro&#x010D;e&#x017D; jsi ty, Romeo? | ||
3050 | </body> | ||
3051 | </message> | ||
3052 | </pre></div> | ||
3053 | <p>The <body/> element MUST NOT contain mixed content (as defined in Section 3.2.2 of <a class='info' href='#XML'>[XML]<span> (</span><span class='info'>Maler, E., Yergeau, F., Sperberg-McQueen, C., Paoli, J., and T. Bray, “Extensible Markup Language (XML) 1.0 (Fifth Edition),” November 2008.</span><span>)</span></a>). | ||
3054 | </p> | ||
3055 | <a name="message-syntax-subject"></a><br /><hr /> | ||
3056 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3057 | <a name="rfc.section.5.2.4"></a><h3>5.2.4. | ||
3058 | Subject Element</h3> | ||
3059 | |||
3060 | <p>The <subject/> element contains human-readable XML character data that specifies the topic of the message. | ||
3061 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3062 | <message | ||
3063 | from='juliet@example.com/balcony' | ||
3064 | id='c8xg3nf8' | ||
3065 | to='romeo@example.net' | ||
3066 | type='chat' | ||
3067 | xml:lang='en'> | ||
3068 | <subject>I implore you!</subject> | ||
3069 | <body>Wherefore art thou, Romeo?</body> | ||
3070 | </message> | ||
3071 | </pre></div> | ||
3072 | <p>There are no attributes defined for the <subject/> element, with the exception of the 'xml:lang' attribute inherited from <a class='info' href='#XML'>[XML]<span> (</span><span class='info'>Maler, E., Yergeau, F., Sperberg-McQueen, C., Paoli, J., and T. Bray, “Extensible Markup Language (XML) 1.0 (Fifth Edition),” November 2008.</span><span>)</span></a>. Multiple instances of the <subject/> element MAY be included for the purpose of providing alternate versions of the same subject, but only if each instance possesses an 'xml:lang' attribute with a distinct language value (either explicitly or by inheritance from the 'xml:lang' value of an element farther up in the XML hierarchy, which from the sender's perspective can include the XML stream header as described in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>). | ||
3073 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3074 | <message | ||
3075 | from='juliet@example.com/balcony' | ||
3076 | id='jk3v47gw' | ||
3077 | to='romeo@example.net' | ||
3078 | type='chat' | ||
3079 | xml:lang='en'> | ||
3080 | <subject>I implore you!</subject> | ||
3081 | <subject xml:lang='cs'> | ||
3082 | &#x00DA;p&#x011B;nliv&#x011B; pros&#x00ED;m! | ||
3083 | </subject> | ||
3084 | <body>Wherefore art thou, Romeo?</body> | ||
3085 | <body xml:lang='cs'> | ||
3086 | Pro&#x010D;e&#x017E; jsi ty, Romeo? | ||
3087 | </body> | ||
3088 | </message> | ||
3089 | </pre></div> | ||
3090 | <p>The <subject/> element MUST NOT contain mixed content (as defined in Section 3.2.2 of <a class='info' href='#XML'>[XML]<span> (</span><span class='info'>Maler, E., Yergeau, F., Sperberg-McQueen, C., Paoli, J., and T. Bray, “Extensible Markup Language (XML) 1.0 (Fifth Edition),” November 2008.</span><span>)</span></a>). | ||
3091 | </p> | ||
3092 | <a name="message-syntax-thread"></a><br /><hr /> | ||
3093 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3094 | <a name="rfc.section.5.2.5"></a><h3>5.2.5. | ||
3095 | Thread Element</h3> | ||
3096 | |||
3097 | <p>The primary use of the XMPP <thread/> element is to uniquely identify a conversation thread or "chat session" between two entities instantiated by <message/> stanzas of type 'chat'. However, the XMPP <thread/> element MAY also be used to uniquely identify an analogous thread between two entities instantiated by <message/> stanzas of type 'headline' or 'normal', or among multiple entities in the context of a multi-user chat room instantiated by <message/> stanzas of type 'groupchat'. It MAY also be used for <message/> stanzas not related to a human conversation, such as a game session or an interaction between plugins. The <thread/> element is not used to identify individual messages, only conversations or messaging sessions. | ||
3098 | </p> | ||
3099 | <p>The inclusion of the <thread/> element is OPTIONAL. Because the <thread/> element identifies the particular conversation thread to which a message belongs, a message stanza MUST NOT contain more than one <thread/> element. | ||
3100 | </p> | ||
3101 | <p>The <thread/> element MAY possess a 'parent' attribute that identifies another thread of which the current thread is an offshoot or child. The 'parent' attribute MUST conform to the syntax of the <thread/> element itself and its value MUST be different from the XML character data of the <thread/> element on which the 'parent' attribute is included. | ||
3102 | </p> | ||
3103 | <p></p> | ||
3104 | <blockquote class="text"> | ||
3105 | <p>Implementation Note: The ability to specify both a parent thread and a child thread introduces the possibility of conflicts between thread identifiers for overlapping threads. For example, one <thread/> element might contain XML character data of "foo" and a 'parent' attribute whose value is "bar", a second <thread/> element might contain XML character data of "bar" and a 'parent' attribute whose value is "baz", and a third <thread/> element might contain XML character data of "baz" and a 'parent' attribute whose value is once again "foo". It is up to the implementation how it will treat conflicts between such overlapping thread identifiers (e.g., whether it will "chain together" thread identifiers by showing "foo" as both a parent and grandchild of "baz" in a multi-level user interface, or whether it will show only one level of dependency at a time). | ||
3106 | </p> | ||
3107 | </blockquote> | ||
3108 | |||
3109 | <p>The value of the <thread/> element is not human-readable and MUST be treated as opaque by entities; no semantic meaning can be derived from it, and only exact comparisons can be made against it. The value of the <thread/> element MUST uniquely identify the conversation thread either between the conversation partners or more generally (one way to ensure uniqueness is by generating a universally unique identifier (UUID) as described in <a class='info' href='#UUID'>[UUID]<span> (</span><span class='info'>Leach, P., Mealling, M., and R. Salz, “A Universally Unique IDentifier (UUID) URN Namespace,” July 2005.</span><span>)</span></a>). | ||
3110 | </p> | ||
3111 | <p></p> | ||
3112 | <blockquote class="text"> | ||
3113 | <p>Security Warning: An application that generates a ThreadID MUST ensure that it does not reveal identifying information about the entity (e.g., the MAC address of the device on which the XMPP application is running). | ||
3114 | </p> | ||
3115 | </blockquote> | ||
3116 | |||
3117 | <p>The <thread/> element MUST NOT contain mixed content (as defined in Section 3.2.2 of <a class='info' href='#XML'>[XML]<span> (</span><span class='info'>Maler, E., Yergeau, F., Sperberg-McQueen, C., Paoli, J., and T. Bray, “Extensible Markup Language (XML) 1.0 (Fifth Edition),” November 2008.</span><span>)</span></a>). | ||
3118 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3119 | <message | ||
3120 | from='juliet@example.com/balcony' | ||
3121 | to='romeo@example.net' | ||
3122 | type='chat' | ||
3123 | xml:lang='en'> | ||
3124 | <subject>I implore you!</subject> | ||
3125 | <subject xml:lang='cs'> | ||
3126 | &#x00DA;p&#x011B;nliv&#x011B; pros&#x00ED;m! | ||
3127 | </subject> | ||
3128 | <body>Wherefore art thou, Romeo?</body> | ||
3129 | <body xml:lang='cs'> | ||
3130 | Pro&#x010D;e&#x017E; jsi ty, Romeo? | ||
3131 | </body> | ||
3132 | <thread parent='e0ffe42b28561960c6b12b944a092794b9683a38'> | ||
3133 | 0e3141cd80894871a68e6fe6b1ec56fa | ||
3134 | </thread> | ||
3135 | </message> | ||
3136 | </pre></div> | ||
3137 | <p>For detailed recommendations regarding use of the <thread/> element, refer to <a class='info' href='#XEP-0201'>[XEP‑0201]<span> (</span><span class='info'>Saint-Andre, P., Paterson, I., and K. Smith, “Best Practices for Message Threads,” November 2010.</span><span>)</span></a>. | ||
3138 | </p> | ||
3139 | <a name="message-syntax-extended"></a><br /><hr /> | ||
3140 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3141 | <a name="rfc.section.5.3"></a><h3>5.3. | ||
3142 | Extended Content</h3> | ||
3143 | |||
3144 | <p>As described in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>, an XML stanza MAY contain any child element that is qualified by a namespace other than the default namespace; this applies to the message stanza as well. Guidelines for handling extended content on the part of both routing servers and end recipients are provided in Section 8.4 of <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>. | ||
3145 | </p> | ||
3146 | <p>(In the following example, the message stanza includes an XHTML-formatted version of the message as defined in <a class='info' href='#XEP-0071'>[XEP‑0071]<span> (</span><span class='info'>Saint-Andre, P., “XHTML-IM,” September 2008.</span><span>)</span></a>).) | ||
3147 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3148 | <message | ||
3149 | from='juliet@example.com/balcony' | ||
3150 | to='romeo@example.net' | ||
3151 | type='chat' | ||
3152 | xml:lang='en'> | ||
3153 | <body>Wherefore art thou, Romeo?</body> | ||
3154 | <html xmlns='http://jabber.org/protocol/xhtml-im'> | ||
3155 | <body xmlns='http://www.w3.org/1999/xhtml'> | ||
3156 | <p>Wherefore <span style='font-style: italic'>art</span> | ||
3157 | thou, <span style='color:red'>Romeo</span>?</p> | ||
3158 | </body> | ||
3159 | </html> | ||
3160 | </message> | ||
3161 | </pre></div> | ||
3162 | <a name="iq"></a><br /><hr /> | ||
3163 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3164 | <a name="rfc.section.6"></a><h3>6. | ||
3165 | Exchanging IQ Stanzas</h3> | ||
3166 | |||
3167 | <p>As described in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>, IQ stanzas provide a structured request-response mechanism. The basic semantics of that mechanism (e.g., that the 'id' attribute is mandatory) are defined in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>, whereas the specific semantics needed to complete particular use cases are defined in all instances by the extended namespace that qualifies the direct child element of an IQ stanza of type "get" or "set". The 'jabber:client' and 'jabber:server' namespaces do not define any children of IQ stanzas other than the <error/> element common to all stanza types. This document defines one such extended namespace, for <a class='info' href='#roster'>Managing the Roster<span> (</span><span class='info'>Managing the Roster</span><span>)</span></a>. However, an IQ stanza MAY contain structured information qualified by any extended namespace. | ||
3168 | </p> | ||
3169 | <a name="session"></a><br /><hr /> | ||
3170 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3171 | <a name="rfc.section.7"></a><h3>7. | ||
3172 | A Sample Session</h3> | ||
3173 | |||
3174 | <p>The examples in this section illustrate a possible instant messaging and presence session. The user is <romeo@example.net>, he has an available resource whose resourcepart is "orchard", and he has the following individuals in his roster: | ||
3175 | </p> | ||
3176 | <p> | ||
3177 | </p> | ||
3178 | <ul class="text"> | ||
3179 | <li><juliet@example.com> (subscription="both" and she has two available resources, "chamber" and "balcony") | ||
3180 | </li> | ||
3181 | <li><benvolio@example.net> (subscription="to") | ||
3182 | </li> | ||
3183 | <li><mercutio@example.org> (subscription="from") | ||
3184 | </li> | ||
3185 | </ul><p> | ||
3186 | |||
3187 | </p> | ||
3188 | <p>First, the user completes the preconditions (stream establishment, TLS and SASL negotiation, and resource binding) described in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>; those protocol flows are not reproduced here. | ||
3189 | </p> | ||
3190 | <p>Next, the user requests his roster. | ||
3191 | </p> | ||
3192 | <p>Example 1: User requests current roster from server | ||
3193 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3194 | UC: <iq from='romeo@example.net/orchard' | ||
3195 | id='hf61v3n7' | ||
3196 | type='get'> | ||
3197 | <query xmlns='jabber:iq:roster'/> | ||
3198 | </iq> | ||
3199 | </pre></div> | ||
3200 | <p>Example 2: User receives roster from server | ||
3201 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3202 | US: <iq id='hf61v3n7' | ||
3203 | to='romeo@example.net/orchard' | ||
3204 | type='result'> | ||
3205 | <query xmlns='jabber:iq:roster'> | ||
3206 | <item jid='juliet@example.com' | ||
3207 | name='Juliet' | ||
3208 | subscription='both'> | ||
3209 | <group>Friends</group> | ||
3210 | </item> | ||
3211 | <item jid='benvolio@example.org' | ||
3212 | name='Benvolio' | ||
3213 | subscription='to'/> | ||
3214 | <item jid='mercutio@example.org' | ||
3215 | name='Mercutio' | ||
3216 | subscription='from'/> | ||
3217 | </query> | ||
3218 | </iq> | ||
3219 | </pre></div> | ||
3220 | <p>Now the user begins a presence session. | ||
3221 | </p> | ||
3222 | <p>Example 3: User sends initial presence | ||
3223 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3224 | UC: <presence/> | ||
3225 | </pre></div> | ||
3226 | <p>Example 4: User's server sends presence probes to contacts with subscription="to" and subscription="both" on behalf of the user | ||
3227 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3228 | US: <presence | ||
3229 | from='romeo@example.net' | ||
3230 | to='juliet@example.com' | ||
3231 | type='probe'/> | ||
3232 | |||
3233 | US: <presence | ||
3234 | from='romeo@example.net' | ||
3235 | to='benvolio@example.org' | ||
3236 | type='probe'/> | ||
3237 | </pre></div> | ||
3238 | <p>Example 5: User's server sends initial presence to contacts with subscription="from" and subscription="both" on behalf of the user's available resource, as well as to user | ||
3239 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3240 | US: <presence | ||
3241 | from='romeo@example.net/orchard' | ||
3242 | to='juliet@example.com'/> | ||
3243 | |||
3244 | US: <presence | ||
3245 | from='romeo@example.net/orchard' | ||
3246 | to='mercutio@example.org'/> | ||
3247 | |||
3248 | US: <presence | ||
3249 | from='romeo@example.net/orchard' | ||
3250 | to='romeo@example.net'/> | ||
3251 | </pre></div> | ||
3252 | <p>Example 6: Contacts' servers reply to presence probe on behalf of all available resources | ||
3253 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3254 | CS: <presence | ||
3255 | from='juliet@example.com/balcony' | ||
3256 | to='romeo@example.net' | ||
3257 | xml:lang='en'> | ||
3258 | <show>away</show> | ||
3259 | <status>be right back</status> | ||
3260 | <priority>0</priority> | ||
3261 | </presence> | ||
3262 | |||
3263 | CS: <presence | ||
3264 | from='juliet@example.com/chamber' | ||
3265 | to='romeo@example.net'> | ||
3266 | <priority>1</priority> | ||
3267 | </presence> | ||
3268 | |||
3269 | CS: <presence | ||
3270 | from='benvolio@example.org/pda' | ||
3271 | to='romeo@example.net' | ||
3272 | xml:lang='en'> | ||
3273 | <show>dnd</show> | ||
3274 | <status>gallivanting</status> | ||
3275 | </presence> | ||
3276 | </pre></div> | ||
3277 | <p>Example 7: Contacts' servers deliver user's initial presence to all available resources | ||
3278 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3279 | CS: <presence | ||
3280 | from='romeo@example.net/orchard' | ||
3281 | to='juliet@example.com'/> | ||
3282 | |||
3283 | CS: <presence | ||
3284 | from='romeo@example.net/orchard' | ||
3285 | to='juliet@example.com'/> | ||
3286 | |||
3287 | CS: <presence | ||
3288 | from='romeo@example.net/orchard' | ||
3289 | to='mercutio@example.org'/> | ||
3290 | </pre></div> | ||
3291 | <p>Example 8: User sends directed presence to another user not in his roster | ||
3292 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3293 | UC: <presence | ||
3294 | from='romeo@example.net/orchard' | ||
3295 | to='nurse@example.com' | ||
3296 | xml:lang='en'> | ||
3297 | <show>dnd</show> | ||
3298 | <status>courting Juliet</status> | ||
3299 | <priority>0</priority> | ||
3300 | </presence> | ||
3301 | </pre></div> | ||
3302 | <p>Now the user engages in a chat session with one of his contacts. | ||
3303 | </p> | ||
3304 | <p>Example 9: A threaded conversation | ||
3305 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3306 | CC: <message | ||
3307 | from='juliet@example.com/balcony' | ||
3308 | to='romeo@example.net' | ||
3309 | type='chat' | ||
3310 | xml:lang='en'> | ||
3311 | <body>My ears have not yet drunk a hundred words</body> | ||
3312 | <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread> | ||
3313 | </message> | ||
3314 | |||
3315 | CC: <message | ||
3316 | from='juliet@example.com/balcony' | ||
3317 | to='romeo@example.net' | ||
3318 | type='chat' | ||
3319 | xml:lang='en'> | ||
3320 | <body>Of that tongue's utterance, yet I know the sound:</body> | ||
3321 | <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread> | ||
3322 | </message> | ||
3323 | |||
3324 | CC: <message | ||
3325 | from='juliet@example.com/balcony' | ||
3326 | to='romeo@example.net' | ||
3327 | type='chat' | ||
3328 | xml:lang='en'> | ||
3329 | <body>Art thou not Romeo, and a Montague?</body> | ||
3330 | <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread> | ||
3331 | </message> | ||
3332 | |||
3333 | UC: <message | ||
3334 | from='romeo@example.net/orchard' | ||
3335 | to='juliet@example.com/balcony' | ||
3336 | type='chat' | ||
3337 | xml:lang='en'> | ||
3338 | <body>Neither, fair saint, if either thee dislike.</body> | ||
3339 | <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread> | ||
3340 | </message> | ||
3341 | |||
3342 | CC: <message | ||
3343 | from='juliet@example.com/balcony' | ||
3344 | to='romeo@example.net/orchard' | ||
3345 | type='chat' | ||
3346 | xml:lang='en'> | ||
3347 | <body>How cam'st thou hither, tell me, and wherefore?</body> | ||
3348 | <thread>e0ffe42b28561960c6b12b944a092794b9683a38</thread> | ||
3349 | </message> | ||
3350 | </pre></div> | ||
3351 | <p>And so on. | ||
3352 | </p> | ||
3353 | <p>The user can also send subsequent presence broadcast. | ||
3354 | </p> | ||
3355 | <p>Example 10: User sends updated available presence for broadcast | ||
3356 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3357 | UC: <presence xml:lang='en'> | ||
3358 | <show>away</show> | ||
3359 | <status>I shall return!</status> | ||
3360 | <priority>1</priority> | ||
3361 | </presence> | ||
3362 | </pre></div> | ||
3363 | <p>Example 11: User's server broadcasts updated presence to the contacts who have a subscription of type "both" or "from" (but not to the entity to which the user sent directed presence) | ||
3364 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3365 | US: <presence | ||
3366 | from='romeo@example.net/orchard' | ||
3367 | to='juliet@example.com' | ||
3368 | xml:lang='en'> | ||
3369 | <show>away</show> | ||
3370 | <status>I shall return!</status> | ||
3371 | <priority>1</priority> | ||
3372 | </presence> | ||
3373 | |||
3374 | US: <presence | ||
3375 | from='romeo@example.net/orchard' | ||
3376 | to='mercutio@example.org' | ||
3377 | xml:lang='en'> | ||
3378 | <show>away</show> | ||
3379 | <status>I shall return!</status> | ||
3380 | <priority>1</priority> | ||
3381 | </presence> | ||
3382 | </pre></div> | ||
3383 | <p>Example 12: Contacts' servers deliver updated presence | ||
3384 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3385 | CS: <presence | ||
3386 | from='romeo@example.net/orchard' | ||
3387 | to='juliet@example.com' | ||
3388 | xml:lang='en'> | ||
3389 | <show>away</show> | ||
3390 | <status>I shall return!</status> | ||
3391 | <priority>1</priority> | ||
3392 | </presence> | ||
3393 | |||
3394 | CS: <presence | ||
3395 | from='romeo@example.net/orchard' | ||
3396 | to='juliet@example.com' | ||
3397 | xml:lang='en'> | ||
3398 | <show>away</show> | ||
3399 | <status>I shall return!</status> | ||
3400 | <priority>1</priority> | ||
3401 | </presence> | ||
3402 | |||
3403 | CS: <presence | ||
3404 | from='romeo@example.net/orchard' | ||
3405 | to='mercutio@example.org' | ||
3406 | xml:lang='en'> | ||
3407 | <show>away</show> | ||
3408 | <status>I shall return!</status> | ||
3409 | <priority>1</priority> | ||
3410 | </presence> | ||
3411 | </pre></div> | ||
3412 | <p>Example 13: One of the contact's resources broadcasts unavailable notification | ||
3413 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3414 | CC: <presence from='juliet@example.com/chamber' type='unavailable'/> | ||
3415 | </pre></div> | ||
3416 | <p>Example 14: Contact's server sends unavailable notification to user | ||
3417 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3418 | CS: <presence | ||
3419 | from='juliet@example.com/chamber' | ||
3420 | to='romeo@example.net' | ||
3421 | type='unavailable'/> | ||
3422 | </pre></div> | ||
3423 | <p>Now the user ends his presence session. | ||
3424 | </p> | ||
3425 | <p>Example 15: User sends unavailable notification | ||
3426 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3427 | UC: <presence type='unavailable' xml:lang='en'> | ||
3428 | <status>gone home</status> | ||
3429 | </presence> | ||
3430 | </pre></div> | ||
3431 | <p>Example 16: User's server broadcasts unavailable notification to contacts as well as to the entity to whom the user sent directed presence | ||
3432 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3433 | US: <presence | ||
3434 | from='romeo@example.net/orchard' | ||
3435 | to='juliet@example.com' | ||
3436 | type='unavailable' | ||
3437 | xml:lang='en'> | ||
3438 | <status>gone home</status> | ||
3439 | </presence> | ||
3440 | |||
3441 | US: <presence | ||
3442 | from='romeo@example.net/orchard' | ||
3443 | to='mercutio@example.org' | ||
3444 | type='unavailable' | ||
3445 | xml:lang='en'> | ||
3446 | <status>gone home</status> | ||
3447 | </presence> | ||
3448 | |||
3449 | US: <presence | ||
3450 | from='romeo@example.net/orchard' | ||
3451 | to='nurse@example.com' | ||
3452 | type='unavailable' | ||
3453 | xml:lang='en'> | ||
3454 | <status>gone home</status> | ||
3455 | </presence> | ||
3456 | </pre></div> | ||
3457 | <p>Finally the user closes his stream and the server responds in kind. | ||
3458 | </p> | ||
3459 | <p>Example 17: User closes stream | ||
3460 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3461 | UC: </stream:stream> | ||
3462 | </pre></div> | ||
3463 | <p>Example 18: User's server closes stream | ||
3464 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3465 | US: </stream:stream> | ||
3466 | </pre></div> | ||
3467 | <p>THE END | ||
3468 | </p> | ||
3469 | <a name="rules"></a><br /><hr /> | ||
3470 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3471 | <a name="rfc.section.8"></a><h3>8. | ||
3472 | Server Rules for Processing XML Stanzas</h3> | ||
3473 | |||
3474 | <p>Basic server rules for processing XML stanzas are defined in | ||
3475 | <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>, and the reader is referred to that specification for underlying rules and security implications. This section defines supplementary rules for XMPP instant messaging and presence servers. | ||
3476 | </p> | ||
3477 | <p>Some delivery rules defined in this section specify the use of "offline storage", i.e., the server's act of storing a message stanza on behalf of the user and then delivering it when the user next becomes available. For recommendations regarding offline message storage, refer to <a class='info' href='#XEP-0160'>[XEP‑0160]<span> (</span><span class='info'>Saint-Andre, P., “Best Practices for Handling Offline Messages,” January 2006.</span><span>)</span></a>. | ||
3478 | </p> | ||
3479 | <a name="rules-general"></a><br /><hr /> | ||
3480 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3481 | <a name="rfc.section.8.1"></a><h3>8.1. | ||
3482 | General Considerations</h3> | ||
3483 | |||
3484 | <p><a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a> discusses general considerations for stanza delivery, in particular the tradeoffs between (i) providing an acceptable level of service regarding stanza delivery and (ii) preventing directory harvesting attacks and presence leaks. However, the concept of a directory harvesting attack does not apply if a contact is known to and trusted by a user (because the contact is in the user's roster as described under <a class='info' href='#roster'>Section 2<span> (</span><span class='info'>Managing the Roster</span><span>)</span></a>). Similarly, the concept of a presence leak does not apply if a contact is authorized to know a user's presence (by means of a presence subscription as described under <a class='info' href='#sub'>Section 3<span> (</span><span class='info'>Managing Presence Subscriptions</span><span>)</span></a>) or if the user has voluntarily sent presence to an entity (by means of directed presence as described under <a class='info' href='#presence-directed'>Section 4.6<span> (</span><span class='info'>Directed Presence</span><span>)</span></a>). Therefore, in cases where the following sections guard against directory harvesting attacks and presence leaks by providing an alternative of (a) silently ignoring a stanza or (b) returning an error, a server SHOULD return an error if the originating entity is in the user's roster (when the error would reveal whether the user's account exists) or is authorized to receive presence from the user or has received directed presence from the user (when the error would reveal the presence of a user's resource). | ||
3485 | </p> | ||
3486 | <p></p> | ||
3487 | <blockquote class="text"> | ||
3488 | <p>Security Warning: All of the stanza processing rules described below are defined with the understanding that they will be applied subject to enforcement of relevant privacy and security policies, such as those deployed by means of <a class='info' href='#XEP-0016'>[XEP‑0016]<span> (</span><span class='info'>Millard, P. and P. Saint-Andre, “Privacy Lists,” February 2007.</span><span>)</span></a> or <a class='info' href='#XEP-0191'>[XEP‑0191]<span> (</span><span class='info'>Saint-Andre, P., “Simple Communications Blocking,” February 2007.</span><span>)</span></a>. The conformance language (MUST, SHOULD, etc.) in the following sections is not meant to override any such local service policies. | ||
3489 | </p> | ||
3490 | </blockquote> | ||
3491 | |||
3492 | <a name="rules-noto"></a><br /><hr /> | ||
3493 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3494 | <a name="rfc.section.8.2"></a><h3>8.2. | ||
3495 | No 'to' Address</h3> | ||
3496 | |||
3497 | <p>If the stanza possesses no 'to' attribute, the rules defined in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a> apply. | ||
3498 | </p> | ||
3499 | <a name="rules-remote"></a><br /><hr /> | ||
3500 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3501 | <a name="rfc.section.8.3"></a><h3>8.3. | ||
3502 | Remote Domain</h3> | ||
3503 | |||
3504 | <p>If the domainpart of the address contained in the 'to' attribute of an outbound stanza does not match a configured domain of the server itself, then the rules provided in Section 10.4 of <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a> apply. | ||
3505 | </p> | ||
3506 | <p></p> | ||
3507 | <blockquote class="text"> | ||
3508 | <p>Interoperability Note: RFC 3921 specified how to use the _im._xmpp and _pres._xmpp SRV records <a class='info' href='#IMP-SRV'>[IMP‑SRV]<span> (</span><span class='info'>Peterson, J., “Address Resolution for Instant Messaging and Presence,” August 2004.</span><span>)</span></a> as a fallback method for discovering whether a remote instant messaging and presence service communicates via XMPP. Because those SRV records have not been widely deployed, this document no longer specifies their use, and new implementations are not encouraged. | ||
3509 | </p> | ||
3510 | </blockquote> | ||
3511 | |||
3512 | <a name="rules-local"></a><br /><hr /> | ||
3513 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3514 | <a name="rfc.section.8.4"></a><h3>8.4. | ||
3515 | Local Domain</h3> | ||
3516 | |||
3517 | <p>If the domainpart of the JID contained in the 'to' attribute matches one of the configured domains of the server, the domain is serviced by the server itself (not by a specialized local service), and the JID is of the form <domainpart> or <domainpart/resourcepart>, the rules defined in <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a> apply. | ||
3518 | </p> | ||
3519 | <a name="rules-localpart"></a><br /><hr /> | ||
3520 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3521 | <a name="rfc.section.8.5"></a><h3>8.5. | ||
3522 | Local User</h3> | ||
3523 | |||
3524 | <p>If the 'to' address specifies a bare JID <localpart@domainpart> or full JID <localpart@domainpart/resourcepart> where the domainpart of the JID matches a configured domain that is serviced by the server itself, the server MUST proceed as follows. | ||
3525 | </p> | ||
3526 | <a name="rules-localpart-nosuchuser"></a><br /><hr /> | ||
3527 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3528 | <a name="rfc.section.8.5.1"></a><h3>8.5.1. | ||
3529 | No Such User</h3> | ||
3530 | |||
3531 | <p>If the user account identified by the 'to' attribute does not exist, how the stanza is processed depends on the stanza type. | ||
3532 | </p> | ||
3533 | <p> | ||
3534 | </p> | ||
3535 | <ul class="text"> | ||
3536 | <li>For an IQ stanza, the server MUST return a <service-unavailable/> stanza error to the sender. | ||
3537 | </li> | ||
3538 | <li>For a message stanza, the server MUST either (a) silently ignore the message or (b) return a <service-unavailable/> stanza error to the sender. | ||
3539 | </li> | ||
3540 | <li>For a presence stanza with no 'type' attribute or a 'type' attribute of "unavailable", the server MUST silently ignore the stanza. | ||
3541 | </li> | ||
3542 | <li>For a presence stanza of type "subscribe", "subscribed", "unsubscribe", or "unsubscribed", the server MUST silently ignore the stanza. | ||
3543 | </li> | ||
3544 | <li>For a presence stanza of type "probe", the server MUST either (a) silently ignore the stanza or (b) return a presence stanza of type "unsubscribed". | ||
3545 | </li> | ||
3546 | </ul><p> | ||
3547 | |||
3548 | </p> | ||
3549 | <a name="rules-localpart-barejid"></a><br /><hr /> | ||
3550 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3551 | <a name="rfc.section.8.5.2"></a><h3>8.5.2. | ||
3552 | localpart@domainpart</h3> | ||
3553 | |||
3554 | <p>If the JID contained in the 'to' attribute is of the form <localpart@domainpart>, then the server MUST adhere to the following rules. | ||
3555 | </p> | ||
3556 | <a name="rules-localpart-barejid-resource"></a><br /><hr /> | ||
3557 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3558 | <a name="rfc.section.8.5.2.1"></a><h3>8.5.2.1. | ||
3559 | Available or Connected Resources</h3> | ||
3560 | |||
3561 | <p>If there is at least one available resource or connected resource, how the stanza is processed depends on the stanza type. | ||
3562 | </p> | ||
3563 | <a name="rules-localpart-barejid-resource-message"></a><br /><hr /> | ||
3564 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3565 | <a name="rfc.section.8.5.2.1.1"></a><h3>8.5.2.1.1. | ||
3566 | Message</h3> | ||
3567 | |||
3568 | <p>For a message stanza of type "normal": | ||
3569 | </p> | ||
3570 | <p> | ||
3571 | </p> | ||
3572 | <ul class="text"> | ||
3573 | <li>If all of the available resources have a negative presence priority then the server SHOULD either (a) store the message offline for later delivery or (b) return a stanza error to the sender, which SHOULD be <service-unavailable/>. | ||
3574 | </li> | ||
3575 | <li>If there is one available resource with a non-negative presence priority then the server MUST deliver the message to that resource. | ||
3576 | </li> | ||
3577 | <li>If there is more than one resource with a non-negative presence priority then the server MUST either (a) deliver the message to the "most available" resource or resources (according to the server's implementation-specific algorithm, e.g., treating the resource or resources with the highest presence priority as "most available") or (b) deliver the message to all of the non-negative resources. | ||
3578 | </li> | ||
3579 | </ul><p> | ||
3580 | |||
3581 | </p> | ||
3582 | <p>For a message stanza of type "chat": | ||
3583 | </p> | ||
3584 | <p> | ||
3585 | </p> | ||
3586 | <ul class="text"> | ||
3587 | <li>If the only available resource has a negative presence priority then the server SHOULD either (a) store the message offline for later delivery or (b) return a stanza error to the sender, which SHOULD be <service-unavailable/>. | ||
3588 | </li> | ||
3589 | <li>If the only available resource has a non-negative presence priority then the server MUST deliver the message to that resource. | ||
3590 | </li> | ||
3591 | <li>If there is more than one resource with a non-negative presence priority then the server MUST either (a) deliver the message to the "most available" resource or resources (according to the server's implementation-specific algorithm, e.g., treating the resource or resources with the highest presence priority as "most available") or (b) deliver the message to all of the non-negative resources that have opted in to receive chat messages. | ||
3592 | </li> | ||
3593 | </ul><p> | ||
3594 | |||
3595 | </p> | ||
3596 | <p>For a message stanza of type "groupchat", the server MUST NOT deliver the stanza to any of the available resources but instead MUST return a stanza error to the sender, which SHOULD be <service-unavailable/>. | ||
3597 | </p> | ||
3598 | <p>For a message stanza of type "headline": | ||
3599 | </p> | ||
3600 | <p> | ||
3601 | </p> | ||
3602 | <ul class="text"> | ||
3603 | <li>If the only available resource has a negative presence priority then the server MUST silently ignore the stanza. | ||
3604 | </li> | ||
3605 | <li>If the only available resource has a non-negative presence priority then the server MUST deliver the message to that resource. | ||
3606 | </li> | ||
3607 | <li>If there is more than one resource with a non-negative presence priority then the server MUST deliver the message to all of the non-negative resources. | ||
3608 | </li> | ||
3609 | </ul><p> | ||
3610 | |||
3611 | </p> | ||
3612 | <p>For a message stanza of type "error", the server MUST silently ignore the message. | ||
3613 | </p> | ||
3614 | <p>However, for any message type the server MUST NOT deliver the stanza to any available resource with a negative priority; if the only available resource has a negative priority, the server SHOULD handle the message as if there were no available resources or connected resources as described under <a class='info' href='#rules-localpart-barejid-noresource'>Section 8.5.2.2<span> (</span><span class='info'>No Available or Connected Resources</span><span>)</span></a>. | ||
3615 | </p> | ||
3616 | <p>In all cases, the server MUST NOT rewrite the 'to' attribute (i.e., it MUST leave it as <localpart@domainpart> rather than change it to <localpart@domainpart/resourcepart>). | ||
3617 | </p> | ||
3618 | <a name="rules-localpart-barejid-resource-pres"></a><br /><hr /> | ||
3619 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3620 | <a name="rfc.section.8.5.2.1.2"></a><h3>8.5.2.1.2. | ||
3621 | Presence</h3> | ||
3622 | |||
3623 | <p>For a presence stanza with no type or of type "unavailable", the server MUST deliver it to all available resources. | ||
3624 | </p> | ||
3625 | <p>For a presence stanza of type "subscribe", "subscribed", "unsubscribe", or "unsubscribed", the server MUST adhere to the rules defined under <a class='info' href='#sub'>Section 3<span> (</span><span class='info'>Managing Presence Subscriptions</span><span>)</span></a> and summarized under <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>. | ||
3626 | </p> | ||
3627 | <p>For a presence stanza of type "probe", the server MUST handle it directly as described under <a class='info' href='#presence-probe'>Section 4.3<span> (</span><span class='info'>Presence Probes</span><span>)</span></a>. | ||
3628 | </p> | ||
3629 | <p>In all cases, the server MUST NOT rewrite the 'to' attribute (i.e., it MUST leave it as <localpart@domainpart> rather than change it to <localpart@domainpart/resourcepart>). | ||
3630 | </p> | ||
3631 | <a name="rules-localpart-barejid-resource-iq"></a><br /><hr /> | ||
3632 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3633 | <a name="rfc.section.8.5.2.1.3"></a><h3>8.5.2.1.3. | ||
3634 | IQ</h3> | ||
3635 | |||
3636 | <p>For an IQ stanza, the server itself MUST reply on behalf of the user with either an IQ result or an IQ error, and MUST NOT deliver the IQ stanza to any of the user's available resources. Specifically, if the semantics of the qualifying namespace define a reply that the server can provide on behalf of the user, then the server MUST reply to the stanza on behalf of the user by returning either an IQ stanza of type "result" or an IQ stanza of type "error" that is appropriate to the original payload; if not, then the server MUST reply with a <service-unavailable/> stanza error. | ||
3637 | </p> | ||
3638 | <a name="rules-localpart-barejid-noresource"></a><br /><hr /> | ||
3639 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3640 | <a name="rfc.section.8.5.2.2"></a><h3>8.5.2.2. | ||
3641 | No Available or Connected Resources</h3> | ||
3642 | |||
3643 | <p>If there are no available resources or connected resources associated with the user, how the stanza is processed depends on the stanza type. | ||
3644 | </p> | ||
3645 | <a name="rules-localpart-barejid-noresource-message"></a><br /><hr /> | ||
3646 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3647 | <a name="rfc.section.8.5.2.2.1"></a><h3>8.5.2.2.1. | ||
3648 | Message</h3> | ||
3649 | |||
3650 | <p>For a message stanza of type "normal" or "chat", the server SHOULD either (a) add the message to offline storage or (b) return a stanza error to the sender, which SHOULD be <service-unavailable/>. | ||
3651 | </p> | ||
3652 | <p>For a message stanza of type "groupchat", the server MUST return an error to the sender, which SHOULD be <service-unavailable/>. | ||
3653 | </p> | ||
3654 | <p>For a message stanza of type "headline" or "error", the server MUST silently ignore the message. | ||
3655 | </p> | ||
3656 | <a name="rules-localpart-barejid-noresource-pres"></a><br /><hr /> | ||
3657 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3658 | <a name="rfc.section.8.5.2.2.2"></a><h3>8.5.2.2.2. | ||
3659 | Presence</h3> | ||
3660 | |||
3661 | <p>For a presence stanza with no type or of type "unavailable", the server SHOULD silently ignore the stanza by not storing it for later delivery and not replying to it on behalf of the user. | ||
3662 | </p> | ||
3663 | <p>For a presence stanza of type "subscribe", "subscribed", "unsubscribe", or "unsubscribed", the server MUST adhere to the rules defined under <a class='info' href='#sub'>Section 3<span> (</span><span class='info'>Managing Presence Subscriptions</span><span>)</span></a> and summarized under <a class='info' href='#substates'>Appendix A<span> (</span><span class='info'>Subscription States</span><span>)</span></a>. | ||
3664 | </p> | ||
3665 | <p>For a presence stanza of type "probe", the server MUST handle it directly as described under <a class='info' href='#presence-probe'>Section 4.3<span> (</span><span class='info'>Presence Probes</span><span>)</span></a>. | ||
3666 | </p> | ||
3667 | <a name="rules-localpart-barejid-noresource-iq"></a><br /><hr /> | ||
3668 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3669 | <a name="rfc.section.8.5.2.2.3"></a><h3>8.5.2.2.3. | ||
3670 | IQ</h3> | ||
3671 | |||
3672 | <p>For an IQ stanza, the server itself MUST reply on behalf of the user with either an IQ result or an IQ error. Specifically, if the semantics of the qualifying namespace define a reply that the server can provide on behalf of the user, then the server MUST reply to the stanza on behalf of the user by returning either an IQ stanza of type "result" or an IQ stanza of type "error" that is appropriate to the original payload; if not, then the server MUST reply with a <service-unavailable/> stanza error. | ||
3673 | </p> | ||
3674 | <a name="rules-localpart-fulljid"></a><br /><hr /> | ||
3675 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3676 | <a name="rfc.section.8.5.3"></a><h3>8.5.3. | ||
3677 | localpart@domainpart/resourcepart</h3> | ||
3678 | |||
3679 | <p>If the domainpart of the JID contained in the 'to' attribute of an inbound stanza matches one of the configured domains of the server itself and the JID contained in the 'to' attribute is of the form <localpart@domainpart/resourcepart>, then the server MUST adhere to the following rules. | ||
3680 | </p> | ||
3681 | <a name="rules-localpart-fulljid-match"></a><br /><hr /> | ||
3682 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3683 | <a name="rfc.section.8.5.3.1"></a><h3>8.5.3.1. | ||
3684 | Resource Matches</h3> | ||
3685 | |||
3686 | <p>If an available resource or connected resource exactly matches the full JID, how the stanza is processed depends on the stanza type. | ||
3687 | </p> | ||
3688 | <p> | ||
3689 | </p> | ||
3690 | <ul class="text"> | ||
3691 | <li>For an IQ stanza of type "get" or "set", if the intended recipient does not share presence with the requesting entity either by means of a presence subscription of type "both" or "from" or by means of directed presence, then the server SHOULD NOT deliver the IQ stanza but instead SHOULD return a <service-unavailable/> stanza error to the requesting entity. This policy helps to prevent presence leaks (see <a class='info' href='#security'>Section 11<span> (</span><span class='info'>Security Considerations</span><span>)</span></a>). | ||
3692 | </li> | ||
3693 | <li>For an IQ stanza of type "result" or "error", the server MUST deliver the stanza to the resource. | ||
3694 | </li> | ||
3695 | <li>For a message stanza, the server MUST deliver the stanza to the resource. | ||
3696 | </li> | ||
3697 | <li>For a presence stanza with no 'type' attribute or a 'type' attribute of "unavailable", the server MUST deliver the stanza to the resource. | ||
3698 | </li> | ||
3699 | <li>For a presence stanza of type "subscribe", "subscribed", "unsubscribe", or "unsubscribed", the server MUST follow the guidelines provided under <a class='info' href='#sub'>Section 3<span> (</span><span class='info'>Managing Presence Subscriptions</span><span>)</span></a>. | ||
3700 | </li> | ||
3701 | <li>For a presence stanza of type "probe", the server MUST follow the guidelines provided under <a class='info' href='#presence-probe'>Section 4.3<span> (</span><span class='info'>Presence Probes</span><span>)</span></a>. | ||
3702 | </li> | ||
3703 | </ul><p> | ||
3704 | |||
3705 | </p> | ||
3706 | <a name="rules-localpart-fulljid-nomatch"></a><br /><hr /> | ||
3707 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3708 | <a name="rfc.section.8.5.3.2"></a><h3>8.5.3.2. | ||
3709 | No Resource Matches</h3> | ||
3710 | |||
3711 | <p>If no available resource or connected resource exactly matches the full JID, how the stanza is processed depends on the stanza type. | ||
3712 | </p> | ||
3713 | <a name="rules-local-fulljid-nomatch-message"></a><br /><hr /> | ||
3714 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3715 | <a name="rfc.section.8.5.3.2.1"></a><h3>8.5.3.2.1. | ||
3716 | Message</h3> | ||
3717 | |||
3718 | <p>For a message stanza of type "normal", "groupchat", or "headline", the server MUST either (a) silently ignore the stanza or (b) return an error stanza to the sender, which SHOULD be <service-unavailable/>. | ||
3719 | </p> | ||
3720 | <p>For a message stanza of type "chat": | ||
3721 | </p> | ||
3722 | <p> | ||
3723 | </p> | ||
3724 | <ul class="text"> | ||
3725 | <li>If there is no available or connected resource, the server MUST either (a) store the message offline for later delivery or (b) return an error stanza to the sender, which SHOULD be <service-unavailable/>. | ||
3726 | </li> | ||
3727 | <li>If all of the available resources have a negative presence priority then the server SHOULD (a) store the message offline for later delivery or (b) return a stanza error to the sender, which SHOULD be <service-unavailable/>. | ||
3728 | </li> | ||
3729 | <li>If there is one available resource with a non-negative presence priority then the server MUST deliver the message to that resource. | ||
3730 | </li> | ||
3731 | <li>If there is more than one resource with a non-negative presence priority then the server MUST either (a) deliver the message to the "most available" resource or resources (according to the server's implementation-specific algorithm, e.g., treating the resource or resources with the highest presence priority as "most available") or (b) deliver the message to all of the non-negative resources that have opted in to receive chat messages. | ||
3732 | </li> | ||
3733 | </ul><p> | ||
3734 | |||
3735 | </p> | ||
3736 | <p>For a message stanza of type "error", the server MUST silently ignore the stanza. | ||
3737 | </p> | ||
3738 | <a name="rules-localpart-fulljid-nomatch-presence"></a><br /><hr /> | ||
3739 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3740 | <a name="rfc.section.8.5.3.2.2"></a><h3>8.5.3.2.2. | ||
3741 | Presence</h3> | ||
3742 | |||
3743 | <p>For a presence stanza with no 'type' attribute or a 'type' attribute of "unavailable", the server MUST silently ignore the stanza. | ||
3744 | </p> | ||
3745 | <p>For a presence stanza of type "subscribe", the server MUST follow the guidelines provided under <a class='info' href='#sub-request-inbound'>Section 3.1.3<span> (</span><span class='info'>Server Processing of Inbound Subscription Request</span><span>)</span></a>. | ||
3746 | </p> | ||
3747 | <p>For a presence stanza of type "subscribed", "unsubscribe", or "unsubscribed", the server MUST ignore the stanza. | ||
3748 | </p> | ||
3749 | <p>For a presence stanza of type "probe", the server MUST follow the guidelines provided under <a class='info' href='#presence-probe'>Section 4.3<span> (</span><span class='info'>Presence Probes</span><span>)</span></a>. | ||
3750 | </p> | ||
3751 | <a name="rules-localpart-fulljid-nomatch-iq"></a><br /><hr /> | ||
3752 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3753 | <a name="rfc.section.8.5.3.2.3"></a><h3>8.5.3.2.3. | ||
3754 | IQ</h3> | ||
3755 | |||
3756 | <p>For an IQ stanza, the server MUST return a <service-unavailable/> stanza error to the sender. | ||
3757 | </p> | ||
3758 | <a name="rules-local-message"></a><br /><hr /> | ||
3759 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3760 | <a name="rfc.section.8.5.4"></a><h3>8.5.4. | ||
3761 | Summary of Message Delivery Rules</h3> | ||
3762 | |||
3763 | <p>The following table summarizes the message (not stanza) delivery rules described earlier in this section. The left column shows various combinations of conditions (non-existent account, no active resources, only one resource and it has a negative presence priority, only one resource and it has a non-negative presence priority, or more than one resource and each one has a non-negative presence priority) and 'to' addresses (bare JID, full JID matching an available resource, or full JID matching no available resource). The subsequent columns list the four primary message types (normal, chat, groupchat, or headline) along with six possible delivery options: storing the message offline (O), bouncing the message with a stanza error (E), silently ignoring the message (S), delivering the message to the resource specified in the 'to' address (D), delivering the message to the "most available" resource or resources according to the server's implementation-specific algorithm, e.g., treating the resource or resources with the highest presence priority as "most available" (M), or delivering the message to all resources with non-negative presence priority (A -- where for chat messages "all resources" can mean the set of resources that have explicitly opted in to receiving every chat message). The '/' character stands for "exclusive or". The server SHOULD observe the rules given in section 8.1 when choosing which action to take for a particular message. | ||
3764 | </p> | ||
3765 | <p>Table 1: Message Delivery Rules | ||
3766 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
3767 | +----------------------------------------------------------+ | ||
3768 | | Condition | Normal | Chat | Groupchat | Headline | | ||
3769 | +----------------------------------------------------------+ | ||
3770 | | ACCOUNT DOES NOT EXIST | | ||
3771 | | bare | S/E | S/E | E | S | | ||
3772 | | full | S/E | S/E | S/E | S/E | | ||
3773 | +----------------------------------------------------------+ | ||
3774 | | ACCOUNT EXISTS, BUT NO ACTIVE RESOURCES | | ||
3775 | | bare | O/E | O/E | E | S | | ||
3776 | | full (no match) | S/E | O/E | S/E | S/E | | ||
3777 | +----------------------------------------------------------+ | ||
3778 | | 1+ NEGATIVE RESOURCES BUT ZERO NON-NEGATIVE RESOURCES | | ||
3779 | | bare | O/E | O/E | E | S | | ||
3780 | | full match | D | D | D | D | | ||
3781 | | full no match | S/E | O/E | S/E | S/E | | ||
3782 | +----------------------------------------------------------+ | ||
3783 | | 1 NON-NEGATIVE RESOURCE | | ||
3784 | | bare | D | D | E | D | | ||
3785 | | full match | D | D | D | D | | ||
3786 | | full no match | S/E | D | S/E | S/E | | ||
3787 | +----------------------------------------------------------+ | ||
3788 | | 1+ NON-NEGATIVE RESOURCES | | ||
3789 | | bare | M/A | M/A* | E | A | | ||
3790 | | full match | D | D/A* | D | D | | ||
3791 | | full no match | S/E | M/A* | S/E | S/E | | ||
3792 | +----------------------------------------------------------+ | ||
3793 | </pre></div> | ||
3794 | <p></p> | ||
3795 | <blockquote class="text"> | ||
3796 | <p>* For messages of type "chat", a server SHOULD NOT act in accordance with option (A) unless clients can explicitly opt in to receiving all chat messages; however, methods for opting in are outside the scope of this specification. | ||
3797 | </p> | ||
3798 | </blockquote> | ||
3799 | |||
3800 | <a name="uri"></a><br /><hr /> | ||
3801 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3802 | <a name="rfc.section.9"></a><h3>9. | ||
3803 | Handling of URIs</h3> | ||
3804 | |||
3805 | <p>The addresses of XMPP entities as used in communication over an XMPP network (e.g., in the 'from' and 'to' addresses of an XML stanza) MUST NOT be prepended with a Uniform Resource Identifier <a class='info' href='#URI'>[URI]<span> (</span><span class='info'>Berners-Lee, T., Fielding, R., and L. Masinter, “Uniform Resource Identifier (URI): Generic Syntax,” January 2005.</span><span>)</span></a> scheme. | ||
3806 | </p> | ||
3807 | <p>However, an application that is external to XMPP itself (e.g., a page on the World Wide Web) might need to identify an XMPP entity either as a URI or as an Internationalized Resource Identifier <a class='info' href='#IRI'>[IRI]<span> (</span><span class='info'>Duerst, M. and M. Suignard, “Internationalized Resource Identifiers (IRIs),” January 2005.</span><span>)</span></a>, and an XMPP client might need to interact with such an external application (for example, an XMPP client might be invoked by clicking a link provided on a web page). In the context of such interactions, XMPP clients are encouraged to handle addresses that are encoded as "xmpp:" URIs and IRIs as specified in <a class='info' href='#XMPP-URI'>[XMPP‑URI]<span> (</span><span class='info'>Saint-Andre, P., “Internationalized Resource Identifiers (IRIs) and Uniform Resource Identifiers (URIs) for the Extensible Messaging and Presence Protocol (XMPP),” February 2008.</span><span>)</span></a> and further described in <a class='info' href='#XEP-0147'>[XEP‑0147]<span> (</span><span class='info'>Saint-Andre, P., “XMPP URI Scheme Query Components,” September 2006.</span><span>)</span></a>. Although XMPP clients are also encouraged to handle addresses that are encoded as "im:" URIs as specified in <a class='info' href='#CPIM'>[CPIM]<span> (</span><span class='info'>Peterson, J., “Common Profile for Instant Messaging (CPIM),” August 2004.</span><span>)</span></a> and "pres:" URIs as specified in <a class='info' href='#CPP'>[CPP]<span> (</span><span class='info'>Peterson, J., “Common Profile for Presence (CPP),” August 2004.</span><span>)</span></a>, they can do so by removing the "im:" or "pres:" scheme and entrusting address resolution to the server as specified under <a class='info' href='#rules-remote'>Section 8.3<span> (</span><span class='info'>Remote Domain</span><span>)</span></a>. | ||
3808 | </p> | ||
3809 | <a name="i18n"></a><br /><hr /> | ||
3810 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3811 | <a name="rfc.section.10"></a><h3>10. | ||
3812 | Internationalization Considerations</h3> | ||
3813 | |||
3814 | <p>For internationalization considerations, refer to the relevant section of <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>. | ||
3815 | </p> | ||
3816 | <a name="security"></a><br /><hr /> | ||
3817 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3818 | <a name="rfc.section.11"></a><h3>11. | ||
3819 | Security Considerations</h3> | ||
3820 | |||
3821 | <p>Core security considerations for XMPP are provided in Section 13 of <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>, including discussion of channel encryption, authentication, information leaks, denial-of-service attacks, and interdomain federation. | ||
3822 | </p> | ||
3823 | <p>Section 13.1 of <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a> outlines the architectural roles of clients and servers in typical deployments of XMPP, and discusses the security properties associated with those roles. These roles have an impact on the security of instant messages, presence subscriptions, and presence notifications as described in this document. In essence, an XMPP user registers (or has provisioned) an account on an XMPP server and therefore places some level of trust in the server to complete various tasks on the user's behalf, enforce security policies, etc. Thus it is the server's responsibility to: | ||
3824 | </p> | ||
3825 | <p> | ||
3826 | </p> | ||
3827 | <ol class="text"> | ||
3828 | <li>Preferably mandate the use of channel encryption for communication with local clients and remote servers. | ||
3829 | </li> | ||
3830 | <li>Authenticate any client that wishes to access the user's account. | ||
3831 | </li> | ||
3832 | <li>Process XML stanzas to and from clients that have authenticated as the user (specifically with regard to instant messaging and presence functionality, store the user's roster, process inbound and outbound subscription requests and responses, generate and handle presence probes, broadcast outbound presence notifications, route outbound messages, and deliver inbound messages and presence notifications). | ||
3833 | </li> | ||
3834 | </ol><p> | ||
3835 | |||
3836 | </p> | ||
3837 | <p>As discussed in Sections 13.1 and 13.4 of <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>, even if the server fulfills the foregoing responsibilities, the client does not have any assurance that stanzas it might exchange with other clients (whether on the same server or a remote server) are protected for all hops along the XMPP communication path, or within the server itself. It is the responsibility of the client to use an appropriate technology for encryption and signing of XML stanzas if it wishes to ensure end-to-end confidentiality and integrity of its communications. | ||
3838 | </p> | ||
3839 | <p>Additional considerations that apply only to instant messaging and presence applications of XMPP are defined in several places within this document; specifically: | ||
3840 | </p> | ||
3841 | <p> | ||
3842 | </p> | ||
3843 | <ul class="text"> | ||
3844 | <li>When a server processes an inbound presence stanza of type "probe" whose intended recipient is a user associated with one of the server's configured domains, the server MUST NOT reveal the user's presence if the sender is an entity that is not authorized to receive that information as determined by presence subscriptions (see <a class='info' href='#presence'>Section 4<span> (</span><span class='info'>Exchanging Presence Information</span><span>)</span></a>). | ||
3845 | </li> | ||
3846 | <li>A user's server MUST NOT leak the user's network availability to entities who are not authorized to know the user's presence. In XMPP itself, authorization takes the form of an explicit subscription from a contact to the user (as described under <a class='info' href='#sub'>Section 3<span> (</span><span class='info'>Managing Presence Subscriptions</span><span>)</span></a>). However, some XMPP deployments might consider an entity to be authorized if there is an existing trust relationship between the entity and the user who is generating presence information (as an example, a corporate deployment of XMPP might automatically add the user's presence information to a private directory of employees if the organization mandates the sharing of presence information as part of an employment agreement). | ||
3847 | </li> | ||
3848 | <li>When a server processes an outbound presence stanza with no type or of type "unavailable", it MUST follow the rules defined under <a class='info' href='#presence'>Section 4<span> (</span><span class='info'>Exchanging Presence Information</span><span>)</span></a> in order to ensure that such presence information is not sent to entities that are not authorized to know such information. | ||
3849 | </li> | ||
3850 | <li>A client MAY ignore the <status/> element when contained in a presence stanza of type "subscribe", "unsubscribe", "subscribed", or "unsubscribed"; this can help prevent "presence subscription spam". | ||
3851 | </li> | ||
3852 | </ul><p> | ||
3853 | |||
3854 | </p> | ||
3855 | <a name="conformance"></a><br /><hr /> | ||
3856 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
3857 | <a name="rfc.section.12"></a><h3>12. | ||
3858 | Conformance Requirements</h3> | ||
3859 | |||
3860 | <p>This section describes a protocol feature set that summarizes the conformance requirements of this specification. This feature set is appropriate for use in software certification, interoperability testing, and implementation reports. For each feature, this section provides the following information: | ||
3861 | </p> | ||
3862 | <p> | ||
3863 | </p> | ||
3864 | <ul class="text"> | ||
3865 | <li>A human-readable name | ||
3866 | </li> | ||
3867 | <li>An informational description | ||
3868 | </li> | ||
3869 | <li>A reference to the particular section of this document that normatively defines the feature | ||
3870 | </li> | ||
3871 | <li>Whether the feature applies to the Client role, the Server role, or both (where "N/A" signifies that the feature is not applicable to the specified role) | ||
3872 | </li> | ||
3873 | <li>Whether the feature MUST or SHOULD be implemented, where the capitalized terms are to be understood as described in <a class='info' href='#KEYWORDS'>[KEYWORDS]<span> (</span><span class='info'>Bradner, S., “Key words for use in RFCs to Indicate Requirement Levels,” March 1997.</span><span>)</span></a> | ||
3874 | </li> | ||
3875 | </ul><p> | ||
3876 | |||
3877 | </p> | ||
3878 | <p>The feature set specified here attempts to adhere to the concepts and formats proposed by Larry Masinter within the IETF's NEWTRK Working Group in 2005, as captured in <a class='info' href='#INTEROP'>[INTEROP]<span> (</span><span class='info'>Masinter, L., “Formalizing IETF Interoperability Reporting,” October 2005.</span><span>)</span></a>. Although this feature set is more detailed than called for by <a class='info' href='#REPORTS'>[REPORTS]<span> (</span><span class='info'>Dusseault, L. and R. Sparks, “Guidance on Interoperation and Implementation Reports for Advancement to Draft Standard,” September 2009.</span><span>)</span></a>, it provides a suitable basis for the generation of implementation reports to be submitted in support of advancing this specification from Proposed Standard to Draft Standard in accordance with <a class='info' href='#PROCESS'>[PROCESS]<span> (</span><span class='info'>Bradner, S., “The Internet Standards Process -- Revision 3,” October 1996.</span><span>)</span></a>. | ||
3879 | </p> | ||
3880 | <p> | ||
3881 | </p> | ||
3882 | <blockquote class="text"><dl> | ||
3883 | <dt>Feature:</dt> | ||
3884 | <dd>message-body | ||
3885 | </dd> | ||
3886 | <dt>Description:</dt> | ||
3887 | <dd>Support the <body/> child element of the <message/> stanza. | ||
3888 | </dd> | ||
3889 | <dt>Section:</dt> | ||
3890 | <dd><a class='info' href='#message-syntax-body'>Section 5.2.3<span> (</span><span class='info'>Body Element</span><span>)</span></a> | ||
3891 | </dd> | ||
3892 | <dt>Roles:</dt> | ||
3893 | <dd>Client MUST, Server N/A. | ||
3894 | </dd> | ||
3895 | </dl></blockquote><p> | ||
3896 | |||
3897 | </p> | ||
3898 | <p> | ||
3899 | </p> | ||
3900 | <blockquote class="text"><dl> | ||
3901 | <dt>Feature:</dt> | ||
3902 | <dd>message-subject | ||
3903 | </dd> | ||
3904 | <dt>Description:</dt> | ||
3905 | <dd>Support the <subject/> child element of the <message/> stanza. | ||
3906 | </dd> | ||
3907 | <dt>Section:</dt> | ||
3908 | <dd><a class='info' href='#message-syntax-subject'>Section 5.2.4<span> (</span><span class='info'>Subject Element</span><span>)</span></a> | ||
3909 | </dd> | ||
3910 | <dt>Roles:</dt> | ||
3911 | <dd>Client SHOULD, Server N/A. | ||
3912 | </dd> | ||
3913 | </dl></blockquote><p> | ||
3914 | |||
3915 | </p> | ||
3916 | <p> | ||
3917 | </p> | ||
3918 | <blockquote class="text"><dl> | ||
3919 | <dt>Feature:</dt> | ||
3920 | <dd>message-thread | ||
3921 | </dd> | ||
3922 | <dt>Description:</dt> | ||
3923 | <dd>Support the <thread/> child element of the <message/> stanza. | ||
3924 | </dd> | ||
3925 | <dt>Section:</dt> | ||
3926 | <dd><a class='info' href='#message-syntax-thread'>Section 5.2.5<span> (</span><span class='info'>Thread Element</span><span>)</span></a> | ||
3927 | </dd> | ||
3928 | <dt>Roles:</dt> | ||
3929 | <dd>Client SHOULD, Server N/A. | ||
3930 | </dd> | ||
3931 | </dl></blockquote><p> | ||
3932 | |||
3933 | </p> | ||
3934 | <p> | ||
3935 | </p> | ||
3936 | <blockquote class="text"><dl> | ||
3937 | <dt>Feature:</dt> | ||
3938 | <dd>message-type-support | ||
3939 | </dd> | ||
3940 | <dt>Description:</dt> | ||
3941 | <dd>Support reception of messages of type "normal", "chat", "groupchat", "headline", and "error". | ||
3942 | </dd> | ||
3943 | <dt>Section:</dt> | ||
3944 | <dd><a class='info' href='#message-syntax-type'>Section 5.2.2<span> (</span><span class='info'>Type Attribute</span><span>)</span></a> | ||
3945 | </dd> | ||
3946 | <dt>Roles:</dt> | ||
3947 | <dd>Client SHOULD, Server N/A. | ||
3948 | </dd> | ||
3949 | </dl></blockquote><p> | ||
3950 | |||
3951 | </p> | ||
3952 | <p> | ||
3953 | </p> | ||
3954 | <blockquote class="text"><dl> | ||
3955 | <dt>Feature:</dt> | ||
3956 | <dd>message-type-deliver | ||
3957 | </dd> | ||
3958 | <dt>Description:</dt> | ||
3959 | <dd>Appropriately deliver messages of type "normal", "chat", "groupchat", "headline", and "error". | ||
3960 | </dd> | ||
3961 | <dt>Section:</dt> | ||
3962 | <dd><a class='info' href='#rules'>Section 8<span> (</span><span class='info'>Server Rules for Processing XML Stanzas</span><span>)</span></a> | ||
3963 | </dd> | ||
3964 | <dt>Roles:</dt> | ||
3965 | <dd>Client N/A, Server SHOULD. | ||
3966 | </dd> | ||
3967 | </dl></blockquote><p> | ||
3968 | |||
3969 | </p> | ||
3970 | <p> | ||
3971 | </p> | ||
3972 | <blockquote class="text"><dl> | ||
3973 | <dt>Feature:</dt> | ||
3974 | <dd>presence-notype | ||
3975 | </dd> | ||
3976 | <dt>Description:</dt> | ||
3977 | <dd>Treat a presence stanza with no 'type' attribute as indicating availability. | ||
3978 | </dd> | ||
3979 | <dt>Section:</dt> | ||
3980 | <dd><a class='info' href='#presence-syntax-type'>Section 4.7.1<span> (</span><span class='info'>Type Attribute</span><span>)</span></a> | ||
3981 | </dd> | ||
3982 | <dt>Roles:</dt> | ||
3983 | <dd>Client MUST, Server MUST. | ||
3984 | </dd> | ||
3985 | </dl></blockquote><p> | ||
3986 | |||
3987 | </p> | ||
3988 | <p> | ||
3989 | </p> | ||
3990 | <blockquote class="text"><dl> | ||
3991 | <dt>Feature:</dt> | ||
3992 | <dd>presence-probe | ||
3993 | </dd> | ||
3994 | <dt>Description:</dt> | ||
3995 | <dd>Send and receive presence stanzas with a 'type' attribute of "probe" for the discovery of presence information. | ||
3996 | </dd> | ||
3997 | <dt>Section:</dt> | ||
3998 | <dd><a class='info' href='#presence-syntax-type'>Section 4.7.1<span> (</span><span class='info'>Type Attribute</span><span>)</span></a> | ||
3999 | </dd> | ||
4000 | <dt>Roles:</dt> | ||
4001 | <dd>Client N/A, Server MUST. | ||
4002 | </dd> | ||
4003 | </dl></blockquote><p> | ||
4004 | |||
4005 | </p> | ||
4006 | <p> | ||
4007 | </p> | ||
4008 | <blockquote class="text"><dl> | ||
4009 | <dt>Feature:</dt> | ||
4010 | <dd>presence-sub-approval | ||
4011 | </dd> | ||
4012 | <dt>Description:</dt> | ||
4013 | <dd>Treat an outbound presence stanza of type "subscribed" as the act of approving a presence subscription request previously received from another entity, and treat an inbound presence stanza of type "subscribed" as a subscription approval from another entity. | ||
4014 | </dd> | ||
4015 | <dt>Section:</dt> | ||
4016 | <dd><a class='info' href='#sub-request'>Section 3.1<span> (</span><span class='info'>Requesting a Subscription</span><span>)</span></a> | ||
4017 | </dd> | ||
4018 | <dt>Roles:</dt> | ||
4019 | <dd>Client MUST, Server MUST. | ||
4020 | </dd> | ||
4021 | </dl></blockquote><p> | ||
4022 | |||
4023 | </p> | ||
4024 | <p> | ||
4025 | </p> | ||
4026 | <blockquote class="text"><dl> | ||
4027 | <dt>Feature:</dt> | ||
4028 | <dd>presence-sub-cancel | ||
4029 | </dd> | ||
4030 | <dt>Description:</dt> | ||
4031 | <dd>Treat an outbound presence stanza of type "unsubscribed" as the act of denying a subscription request received from another entity or canceling a subscription approval previously granted to another entity, and treat an inbound presence stanza of type "unsubscribed" as an subscription denial or cancellation from another entity. | ||
4032 | </dd> | ||
4033 | <dt>Section:</dt> | ||
4034 | <dd><a class='info' href='#sub-cancel'>Section 3.2<span> (</span><span class='info'>Canceling a Subscription</span><span>)</span></a> | ||
4035 | </dd> | ||
4036 | <dt>Roles:</dt> | ||
4037 | <dd>Client MUST, Server MUST. | ||
4038 | </dd> | ||
4039 | </dl></blockquote><p> | ||
4040 | |||
4041 | </p> | ||
4042 | <p> | ||
4043 | </p> | ||
4044 | <blockquote class="text"><dl> | ||
4045 | <dt>Feature:</dt> | ||
4046 | <dd>presence-sub-preapproval | ||
4047 | </dd> | ||
4048 | <dt>Description:</dt> | ||
4049 | <dd>Treat an outbound presence stanza of type "subscribed" in certain circumstances as the act of pre-approving a subscription request received from another entity; this includes support for the 'approved' attribute of the <item/> element within the 'jabber:iq:roster' namespace. | ||
4050 | </dd> | ||
4051 | <dt>Section:</dt> | ||
4052 | <dd><a class='info' href='#sub-preapproval'>Section 3.4<span> (</span><span class='info'>Pre-Approving a Subscription Request</span><span>)</span></a> | ||
4053 | </dd> | ||
4054 | <dt>Roles:</dt> | ||
4055 | <dd>Client MAY, Server MAY. | ||
4056 | </dd> | ||
4057 | </dl></blockquote><p> | ||
4058 | |||
4059 | </p> | ||
4060 | <p> | ||
4061 | </p> | ||
4062 | <blockquote class="text"><dl> | ||
4063 | <dt>Feature:</dt> | ||
4064 | <dd>presence-sub-request | ||
4065 | </dd> | ||
4066 | <dt>Description:</dt> | ||
4067 | <dd>Treat an outbound presence stanza of type "subscribe" as the act of requesting a subscription to the presence information of another entity, and treat an inbound presence stanza of type "subscribe" as a presence subscription request from another entity. | ||
4068 | </dd> | ||
4069 | <dt>Section:</dt> | ||
4070 | <dd><a class='info' href='#sub-request'>Section 3.1<span> (</span><span class='info'>Requesting a Subscription</span><span>)</span></a> | ||
4071 | </dd> | ||
4072 | <dt>Roles:</dt> | ||
4073 | <dd>Client MUST, Server MUST. | ||
4074 | </dd> | ||
4075 | </dl></blockquote><p> | ||
4076 | |||
4077 | </p> | ||
4078 | <p> | ||
4079 | </p> | ||
4080 | <blockquote class="text"><dl> | ||
4081 | <dt>Feature:</dt> | ||
4082 | <dd>presence-sub-unsubscribe | ||
4083 | </dd> | ||
4084 | <dt>Description:</dt> | ||
4085 | <dd>Treat an outbound presence stanza of type "unsubscribe" as the act of unsubscribing from another entity, and treat an inbound presence stanza of type "unsubscribe" as an unsubscribe notification from another entity. | ||
4086 | </dd> | ||
4087 | <dt>Section:</dt> | ||
4088 | <dd><a class='info' href='#sub-unsub'>Section 3.3<span> (</span><span class='info'>Unsubscribing</span><span>)</span></a> | ||
4089 | </dd> | ||
4090 | <dt>Roles:</dt> | ||
4091 | <dd>Client MUST, Server MUST. | ||
4092 | </dd> | ||
4093 | </dl></blockquote><p> | ||
4094 | |||
4095 | </p> | ||
4096 | <p> | ||
4097 | </p> | ||
4098 | <blockquote class="text"><dl> | ||
4099 | <dt>Feature:</dt> | ||
4100 | <dd>presence-unavailable | ||
4101 | </dd> | ||
4102 | <dt>Description:</dt> | ||
4103 | <dd>Treat a presence stanza with a 'type' attribute of "unavailable" as indicating lack of availability. | ||
4104 | </dd> | ||
4105 | <dt>Section:</dt> | ||
4106 | <dd><a class='info' href='#presence-syntax-type'>Section 4.7.1<span> (</span><span class='info'>Type Attribute</span><span>)</span></a> | ||
4107 | </dd> | ||
4108 | <dt>Roles:</dt> | ||
4109 | <dd>Client MUST, Server MUST. | ||
4110 | </dd> | ||
4111 | </dl></blockquote><p> | ||
4112 | |||
4113 | </p> | ||
4114 | <p> | ||
4115 | </p> | ||
4116 | <blockquote class="text"><dl> | ||
4117 | <dt>Feature:</dt> | ||
4118 | <dd>roster-get | ||
4119 | </dd> | ||
4120 | <dt>Description:</dt> | ||
4121 | <dd>Treat an IQ stanza of type "get" containing an empty <query/> element qualified by the 'jabber:iq:roster' namespace as a request to retrieve the roster information associated with an account on a server. | ||
4122 | </dd> | ||
4123 | <dt>Section:</dt> | ||
4124 | <dd><a class='info' href='#roster-syntax-actions-get'>Section 2.1.3<span> (</span><span class='info'>Roster Get</span><span>)</span></a> | ||
4125 | </dd> | ||
4126 | <dt>Roles:</dt> | ||
4127 | <dd>Client MUST, Server MUST. | ||
4128 | </dd> | ||
4129 | </dl></blockquote><p> | ||
4130 | |||
4131 | </p> | ||
4132 | <p> | ||
4133 | </p> | ||
4134 | <blockquote class="text"><dl> | ||
4135 | <dt>Feature:</dt> | ||
4136 | <dd>roster-set | ||
4137 | </dd> | ||
4138 | <dt>Description:</dt> | ||
4139 | <dd>Treat an IQ stanza of type "set" containing a <query/> element qualified by the 'jabber:iq:roster' namespace as a request to add or update the item contained in the <query/> element. | ||
4140 | </dd> | ||
4141 | <dt>Section:</dt> | ||
4142 | <dd><a class='info' href='#roster-syntax-actions-set'>Section 2.1.5<span> (</span><span class='info'>Roster Set</span><span>)</span></a> | ||
4143 | </dd> | ||
4144 | <dt>Roles:</dt> | ||
4145 | <dd>Client MUST, Server MUST. | ||
4146 | </dd> | ||
4147 | </dl></blockquote><p> | ||
4148 | |||
4149 | </p> | ||
4150 | <p> | ||
4151 | </p> | ||
4152 | <blockquote class="text"><dl> | ||
4153 | <dt>Feature:</dt> | ||
4154 | <dd>roster-push | ||
4155 | </dd> | ||
4156 | <dt>Description:</dt> | ||
4157 | <dd>Send a roster push to each interested resource whenever the server-side representation of the roster information materially changes, or handle such a push when received from the server. | ||
4158 | </dd> | ||
4159 | <dt>Section:</dt> | ||
4160 | <dd><a class='info' href='#roster-syntax-actions-push'>Section 2.1.6<span> (</span><span class='info'>Roster Push</span><span>)</span></a> | ||
4161 | </dd> | ||
4162 | <dt>Roles:</dt> | ||
4163 | <dd>Client MUST, Server MUST. | ||
4164 | </dd> | ||
4165 | </dl></blockquote><p> | ||
4166 | |||
4167 | </p> | ||
4168 | <p> | ||
4169 | </p> | ||
4170 | <blockquote class="text"><dl> | ||
4171 | <dt>Feature:</dt> | ||
4172 | <dd>roster-version | ||
4173 | </dd> | ||
4174 | <dt>Description:</dt> | ||
4175 | <dd>Treat the 'ver' attribute of the <query/> element qualified by the 'jabber:iq:roster' namespace as an identifier of the particular version of roster information being sent or received. | ||
4176 | </dd> | ||
4177 | <dt>Section:</dt> | ||
4178 | <dd><a class='info' href='#roster-syntax-ver'>Section 2.1.1<span> (</span><span class='info'>Ver Attribute</span><span>)</span></a> | ||
4179 | </dd> | ||
4180 | <dt>Roles:</dt> | ||
4181 | <dd>Client SHOULD, Server MUST. | ||
4182 | </dd> | ||
4183 | </dl></blockquote><p> | ||
4184 | |||
4185 | </p> | ||
4186 | <a name="rfc.references"></a><br /><hr /> | ||
4187 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4188 | <a name="rfc.section.13"></a><h3>13. | ||
4189 | References</h3> | ||
4190 | |||
4191 | <a name="rfc.references1"></a><br /><hr /> | ||
4192 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4193 | <h3>13.1. Normative References</h3> | ||
4194 | <table width="99%" border="0"> | ||
4195 | <tr><td class="author-text" valign="top"><a name="DELAY">[DELAY]</a></td> | ||
4196 | <td class="author-text"><a href="mailto:stpeter@jabber.org">Saint-Andre, P.</a>, “<a href="http://xmpp.org/extensions/xep-0203.html">Delayed Delivery</a>,” XSF XEP 0203, September 2009.</td></tr> | ||
4197 | <tr><td class="author-text" valign="top"><a name="KEYWORDS">[KEYWORDS]</a></td> | ||
4198 | <td class="author-text"><a href="mailto:sob@harvard.edu">Bradner, S.</a>, “<a href="http://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>,” BCP 14, RFC 2119, March 1997 (<a href="http://www.rfc-editor.org/rfc/rfc2119.txt">TXT</a>, <a href="http://xml.resource.org/public/rfc/html/rfc2119.html">HTML</a>, <a href="http://xml.resource.org/public/rfc/xml/rfc2119.xml">XML</a>).</td></tr> | ||
4199 | <tr><td class="author-text" valign="top"><a name="XML">[XML]</a></td> | ||
4200 | <td class="author-text">Maler, E., Yergeau, F., Sperberg-McQueen, C., Paoli, J., and T. Bray, “<a href="http://www.w3.org/TR/2008/REC-xml-20081126">Extensible Markup Language (XML) 1.0 (Fifth Edition)</a>,” World Wide Web Consortium Recommendation REC‑xml‑20081126, November 2008 (<a href="http://www.w3.org/TR/2008/REC-xml-20081126">HTML</a>).</td></tr> | ||
4201 | <tr><td class="author-text" valign="top"><a name="XML-NAMES">[XML-NAMES]</a></td> | ||
4202 | <td class="author-text"><a href="mailto:tbray@textuality.com">Bray, T.</a>, <a href="mailto:dmh@corp.hp.com">Hollander, D.</a>, and <a href="mailto:andrewl@microsoft.com">A. Layman</a>, “<a href="http://www.w3.org/TR/REC-xml-names">Namespaces in XML</a>,” W3C REC-xml-names, January 1999.</td></tr> | ||
4203 | <tr><td class="author-text" valign="top"><a name="XMPP-CORE">[XMPP-CORE]</a></td> | ||
4204 | <td class="author-text">Saint-Andre, P., “<a href="http://tools.ietf.org/html/rfc6120">Extensible Messaging and Presence Protocol (XMPP): Core</a>,” RFC 6120, March 2011.</td></tr> | ||
4205 | </table> | ||
4206 | |||
4207 | <a name="rfc.references2"></a><br /><hr /> | ||
4208 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4209 | <h3>13.2. Informative References</h3> | ||
4210 | <table width="99%" border="0"> | ||
4211 | <tr><td class="author-text" valign="top"><a name="CPIM">[CPIM]</a></td> | ||
4212 | <td class="author-text">Peterson, J., “<a href="http://tools.ietf.org/html/rfc3860">Common Profile for Instant Messaging (CPIM)</a>,” RFC 3860, August 2004 (<a href="http://www.rfc-editor.org/rfc/rfc3860.txt">TXT</a>).</td></tr> | ||
4213 | <tr><td class="author-text" valign="top"><a name="CPP">[CPP]</a></td> | ||
4214 | <td class="author-text">Peterson, J., “<a href="http://tools.ietf.org/html/rfc3859">Common Profile for Presence (CPP)</a>,” RFC 3859, August 2004 (<a href="http://www.rfc-editor.org/rfc/rfc3859.txt">TXT</a>).</td></tr> | ||
4215 | <tr><td class="author-text" valign="top"><a name="DOS">[DOS]</a></td> | ||
4216 | <td class="author-text">Handley, M., Rescorla, E., and IAB, “<a href="http://tools.ietf.org/html/rfc4732">Internet Denial-of-Service Considerations</a>,” RFC 4732, December 2006 (<a href="http://www.rfc-editor.org/rfc/rfc4732.txt">TXT</a>).</td></tr> | ||
4217 | <tr><td class="author-text" valign="top"><a name="IMP-MODEL">[IMP-MODEL]</a></td> | ||
4218 | <td class="author-text"><a href="mailto:mday@alum.mit.edu">Day, M.</a>, <a href="mailto:jdrosen@dynamicsoft.com">Rosenberg, J.</a>, and <a href="mailto:suga@flab.fujitsu.co.jp">H. Sugano</a>, “<a href="http://tools.ietf.org/html/rfc2778">A Model for Presence and Instant Messaging</a>,” RFC 2778, February 2000.</td></tr> | ||
4219 | <tr><td class="author-text" valign="top"><a name="IMP-REQS">[IMP-REQS]</a></td> | ||
4220 | <td class="author-text"><a href="mailto:mday@alum.mit.edu">Day, M.</a>, <a href="mailto:sonuag@microsoft.com">Aggarwal, S.</a>, and <a href="mailto:jesse@intonet.com">J. Vincent</a>, “<a href="http://tools.ietf.org/html/rfc2779">Instant Messaging / Presence Protocol Requirements</a>,” RFC 2779, February 2000 (<a href="http://www.rfc-editor.org/rfc/rfc2779.txt">TXT</a>).</td></tr> | ||
4221 | <tr><td class="author-text" valign="top"><a name="IMP-SRV">[IMP-SRV]</a></td> | ||
4222 | <td class="author-text">Peterson, J., “<a href="http://tools.ietf.org/html/rfc3861">Address Resolution for Instant Messaging and Presence</a>,” RFC 3861, August 2004 (<a href="http://www.rfc-editor.org/rfc/rfc3861.txt">TXT</a>).</td></tr> | ||
4223 | <tr><td class="author-text" valign="top"><a name="INTEROP">[INTEROP]</a></td> | ||
4224 | <td class="author-text">Masinter, L., “Formalizing IETF Interoperability Reporting,” Work in Progress, October 2005.</td></tr> | ||
4225 | <tr><td class="author-text" valign="top"><a name="IRC">[IRC]</a></td> | ||
4226 | <td class="author-text">Kalt, C., “<a href="http://tools.ietf.org/html/rfc2810">Internet Relay Chat: Architecture</a>,” RFC 2810, April 2000 (<a href="http://www.rfc-editor.org/rfc/rfc2810.txt">TXT</a>).</td></tr> | ||
4227 | <tr><td class="author-text" valign="top"><a name="IRI">[IRI]</a></td> | ||
4228 | <td class="author-text">Duerst, M. and M. Suignard, “<a href="http://tools.ietf.org/html/rfc3987">Internationalized Resource Identifiers (IRIs)</a>,” RFC 3987, January 2005 (<a href="http://www.rfc-editor.org/rfc/rfc3987.txt">TXT</a>).</td></tr> | ||
4229 | <tr><td class="author-text" valign="top"><a name="PROCESS">[PROCESS]</a></td> | ||
4230 | <td class="author-text"><a href="mailto:sob@harvard.edu">Bradner, S.</a>, “<a href="http://tools.ietf.org/html/rfc2026">The Internet Standards Process -- Revision 3</a>,” BCP 9, RFC 2026, October 1996 (<a href="http://www.rfc-editor.org/rfc/rfc2026.txt">TXT</a>).</td></tr> | ||
4231 | <tr><td class="author-text" valign="top"><a name="REPORTS">[REPORTS]</a></td> | ||
4232 | <td class="author-text">Dusseault, L. and R. Sparks, “<a href="http://tools.ietf.org/html/rfc5657">Guidance on Interoperation and Implementation Reports for Advancement to Draft Standard</a>,” BCP 9, RFC 5657, September 2009 (<a href="http://www.rfc-editor.org/rfc/rfc5657.txt">TXT</a>).</td></tr> | ||
4233 | <tr><td class="author-text" valign="top"><a name="RFC3920">[RFC3920]</a></td> | ||
4234 | <td class="author-text"><a href="mailto:stpeter@jabber.org">Saint-Andre, P., Ed.</a>, “<a href="http://tools.ietf.org/html/rfc3920">Extensible Messaging and Presence Protocol (XMPP): Core</a>,” RFC 3920, October 2004 (<a href="http://www.rfc-editor.org/rfc/rfc3920.txt">TXT</a>, <a href="http://xml.resource.org/public/rfc/html/rfc3920.html">HTML</a>, <a href="http://xml.resource.org/public/rfc/xml/rfc3920.xml">XML</a>).</td></tr> | ||
4235 | <tr><td class="author-text" valign="top"><a name="RFC3921">[RFC3921]</a></td> | ||
4236 | <td class="author-text"><a href="mailto:stpeter@jabber.org">Saint-Andre, P., Ed.</a>, “<a href="http://tools.ietf.org/html/rfc3921">Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence</a>,” RFC 3921, October 2004 (<a href="http://www.rfc-editor.org/rfc/rfc3921.txt">TXT</a>, <a href="http://xml.resource.org/public/rfc/html/rfc3921.html">HTML</a>, <a href="http://xml.resource.org/public/rfc/xml/rfc3921.xml">XML</a>).</td></tr> | ||
4237 | <tr><td class="author-text" valign="top"><a name="SASL">[SASL]</a></td> | ||
4238 | <td class="author-text">Melnikov, A. and K. Zeilenga, “<a href="http://tools.ietf.org/html/rfc4422">Simple Authentication and Security Layer (SASL)</a>,” RFC 4422, June 2006 (<a href="http://www.rfc-editor.org/rfc/rfc4422.txt">TXT</a>).</td></tr> | ||
4239 | <tr><td class="author-text" valign="top"><a name="SIP-PRES">[SIP-PRES]</a></td> | ||
4240 | <td class="author-text">Rosenberg, J., “<a href="http://tools.ietf.org/html/rfc3856">A Presence Event Package for the Session Initiation Protocol (SIP)</a>,” RFC 3856, August 2004 (<a href="http://www.rfc-editor.org/rfc/rfc3856.txt">TXT</a>).</td></tr> | ||
4241 | <tr><td class="author-text" valign="top"><a name="TLS">[TLS]</a></td> | ||
4242 | <td class="author-text">Dierks, T. and E. Rescorla, “<a href="http://tools.ietf.org/html/rfc5246">The Transport Layer Security (TLS) Protocol Version 1.2</a>,” RFC 5246, August 2008 (<a href="http://www.rfc-editor.org/rfc/rfc5246.txt">TXT</a>).</td></tr> | ||
4243 | <tr><td class="author-text" valign="top"><a name="TLS-CERTS">[TLS-CERTS]</a></td> | ||
4244 | <td class="author-text">Saint-Andre, P. and J. Hodges, “<a href="http://tools.ietf.org/html/rfc6125">Representation and Verification of Domain-Based Application Service Identity within Internet Public Key Infrastructure Using X.509 (PKIX) Certificates in the Context of Transport Layer Security (TLS)</a>,” RFC 6125, March 2011.</td></tr> | ||
4245 | <tr><td class="author-text" valign="top"><a name="UNICODE">[UNICODE]</a></td> | ||
4246 | <td class="author-text">The Unicode Consortium, “<a href="http://www.unicode.org/versions/Unicode6.0.0/">The Unicode Standard, Version 6.0</a>,” 2010.</td></tr> | ||
4247 | <tr><td class="author-text" valign="top"><a name="URI">[URI]</a></td> | ||
4248 | <td class="author-text">Berners-Lee, T., Fielding, R., and L. Masinter, “<a href="http://tools.ietf.org/html/rfc3986">Uniform Resource Identifier (URI): Generic Syntax</a>,” STD 66, RFC 3986, January 2005 (<a href="http://www.rfc-editor.org/rfc/rfc3986.txt">TXT</a>).</td></tr> | ||
4249 | <tr><td class="author-text" valign="top"><a name="UUID">[UUID]</a></td> | ||
4250 | <td class="author-text"><a href="mailto:paulle@microsoft.com">Leach, P.</a>, <a href="mailto:michael@refactored-networks.com">Mealling, M.</a>, and <a href="mailto:rsalz@datapower.com">R. Salz</a>, “<a href="http://tools.ietf.org/html/rfc4122">A Universally Unique IDentifier (UUID) URN Namespace</a>,” RFC 4122, July 2005 (<a href="http://www.rfc-editor.org/rfc/rfc4122.txt">TXT</a>, <a href="http://xml.resource.org/public/rfc/html/rfc4122.html">HTML</a>, <a href="http://xml.resource.org/public/rfc/xml/rfc4122.xml">XML</a>).</td></tr> | ||
4251 | <tr><td class="author-text" valign="top"><a name="XEP-0016">[XEP-0016]</a></td> | ||
4252 | <td class="author-text">Millard, P. and <a href="mailto:stpeter@jabber.org">P. Saint-Andre</a>, “<a href="http://www.xmpp.org/extensions/xep-0016.html">Privacy Lists</a>,” XSF XEP 0016, February 2007.</td></tr> | ||
4253 | <tr><td class="author-text" valign="top"><a name="XEP-0045">[XEP-0045]</a></td> | ||
4254 | <td class="author-text"><a href="mailto:stpeter@jabber.org">Saint-Andre, P.</a>, “<a href="http://www.xmpp.org/extensions/xep-0045.html">Multi-User Chat</a>,” XSF XEP 0045, July 2008.</td></tr> | ||
4255 | <tr><td class="author-text" valign="top"><a name="XEP-0054">[XEP-0054]</a></td> | ||
4256 | <td class="author-text"><a href="mailto:stpeter@jabber.org">Saint-Andre, P.</a>, “<a href="http://www.xmpp.org/extensions/xep-0054.html">vcard-temp</a>,” XSF XEP 0054, July 2008.</td></tr> | ||
4257 | <tr><td class="author-text" valign="top"><a name="XEP-0071">[XEP-0071]</a></td> | ||
4258 | <td class="author-text"><a href="mailto:stpeter@jabber.org">Saint-Andre, P.</a>, “<a href="http://www.xmpp.org/extensions/xep-0071.html">XHTML-IM</a>,” XSF XEP 0071, September 2008.</td></tr> | ||
4259 | <tr><td class="author-text" valign="top"><a name="XEP-0115">[XEP-0115]</a></td> | ||
4260 | <td class="author-text"><a href="mailto:jhildebrand@jabber.com">Hildebrand, J.</a>, <a href="mailto:stpeter@jabber.org">Saint-Andre, P.</a>, and <a href="mailto:public@el-tramo.be">R. Tronçon</a>, “<a href="http://www.xmpp.org/extensions/xep-0115.html">Entity Capabilities</a>,” XSF XEP 0115, February 2008.</td></tr> | ||
4261 | <tr><td class="author-text" valign="top"><a name="XEP-0147">[XEP-0147]</a></td> | ||
4262 | <td class="author-text"><a href="mailto:">Saint-Andre, P.</a>, “<a href="http://www.xmpp.org/extensions/xep-0147.html">XMPP URI Scheme Query Components</a>,” XSF XEP 0147, September 2006.</td></tr> | ||
4263 | <tr><td class="author-text" valign="top"><a name="XEP-0160">[XEP-0160]</a></td> | ||
4264 | <td class="author-text"><a href="mailto:stpeter@jabber.org">Saint-Andre, P.</a>, “<a href="http://www.xmpp.org/extensions/xep-0160.html">Best Practices for Handling Offline Messages</a>,” XSF XEP 0160, January 2006.</td></tr> | ||
4265 | <tr><td class="author-text" valign="top"><a name="XEP-0163">[XEP-0163]</a></td> | ||
4266 | <td class="author-text"><a href="mailto:stpeter@jabber.org">Saint-Andre, P.</a> and <a href="mailto:kevin@kismith.co.uk">K. Smith</a>, “<a href="http://xmpp.org/extensions/xep-0163.html">Personal Eventing Protocol</a>,” XSF XEP 0163, July 2010.</td></tr> | ||
4267 | <tr><td class="author-text" valign="top"><a name="XEP-0191">[XEP-0191]</a></td> | ||
4268 | <td class="author-text"><a href="mailto:">Saint-Andre, P.</a>, “<a href="http://www.xmpp.org/extensions/xep-0191.html">Simple Communications Blocking</a>,” XSF XEP 0191, February 2007.</td></tr> | ||
4269 | <tr><td class="author-text" valign="top"><a name="XEP-0201">[XEP-0201]</a></td> | ||
4270 | <td class="author-text"><a href="mailto:stpeter@jabber.org">Saint-Andre, P.</a>, <a href="mailto:ian.paterson@clientside.co.uk">Paterson, I.</a>, and <a href="mailto:kevin@kismith.co.uk">K. Smith</a>, “<a href="http://www.xmpp.org/extensions/xep-0201.html">Best Practices for Message Threads</a>,” XSF XEP 0201, November 2010.</td></tr> | ||
4271 | <tr><td class="author-text" valign="top"><a name="XEP-0237">[XEP-0237]</a></td> | ||
4272 | <td class="author-text"><a href="mailto:">Saint-Andre, P.</a> and <a href="mailto:dave.cridland@isode.com">D. Cridland</a>, “<a href="http://xmpp.org/extensions/xep-0237.html">Roster Versioning</a>,” XSF XEP 0237, March 2010.</td></tr> | ||
4273 | <tr><td class="author-text" valign="top"><a name="XML-DATATYPES">[XML-DATATYPES]</a></td> | ||
4274 | <td class="author-text">Biron, P. and A. Malhotra, “<a href="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/">XML Schema Part 2: Datatypes Second Edition</a>,” W3C REC-xmlschema-2, October 2004 (<a href="http://www.w3.org/TR/2004/REC-xmlschema-2-20041028">HTML</a>).</td></tr> | ||
4275 | <tr><td class="author-text" valign="top"><a name="XML-SCHEMA">[XML-SCHEMA]</a></td> | ||
4276 | <td class="author-text">Thompson, H., Maloney, M., Mendelsohn, N., and D. Beech, “<a href="http://www.w3.org/TR/2004/REC-xmlschema-1-20041028">XML Schema Part 1: Structures Second Edition</a>,” World Wide Web Consortium Recommendation REC-xmlschema-1-20041028, October 2004 (<a href="http://www.w3.org/TR/2004/REC-xmlschema-1-20041028">HTML</a>).</td></tr> | ||
4277 | <tr><td class="author-text" valign="top"><a name="XMPP-ADDR">[XMPP-ADDR]</a></td> | ||
4278 | <td class="author-text">Saint-Andre, P., “<a href="http://tools.ietf.org/html/rfc6122">Extensible Messaging and Presence Protocol (XMPP): Address Format</a>,” RFC 6122, March 2011.</td></tr> | ||
4279 | <tr><td class="author-text" valign="top"><a name="XMPP-URI">[XMPP-URI]</a></td> | ||
4280 | <td class="author-text">Saint-Andre, P., “<a href="http://tools.ietf.org/html/rfc5122">Internationalized Resource Identifiers (IRIs) and Uniform Resource Identifiers (URIs) for the Extensible Messaging and Presence Protocol (XMPP)</a>,” RFC 5122, February 2008 (<a href="http://www.rfc-editor.org/rfc/rfc5122.txt">TXT</a>).</td></tr> | ||
4281 | <tr><td class="author-text" valign="top"><a name="VCARD">[VCARD]</a></td> | ||
4282 | <td class="author-text"><a href="mailto:frank_dawson@lotus.com">Dawson, F.</a> and <a href="mailto:howes@netscape.com">T. Howes</a>, “<a href="http://tools.ietf.org/html/rfc2426">vCard MIME Directory Profile</a>,” RFC 2426, September 1998 (<a href="http://xml.resource.org/public/rfc/html/rfc2426.html">HTML</a>, <a href="http://xml.resource.org/public/rfc/xml/rfc2426.xml">XML</a>).</td></tr> | ||
4283 | </table> | ||
4284 | |||
4285 | <a name="substates"></a><br /><hr /> | ||
4286 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4287 | <a name="rfc.section.A"></a><h3>Appendix A. | ||
4288 | Subscription States</h3> | ||
4289 | |||
4290 | <p>This section provides detailed information about subscription states and server processing of subscription-related presence stanzas (i.e., presence stanzas of type "subscribe", "subscribed", "unsubscribe", and "unsubscribed"). | ||
4291 | </p> | ||
4292 | <a name="substates-defined"></a><br /><hr /> | ||
4293 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4294 | <a name="rfc.section.A.1"></a><h3>A.1. | ||
4295 | Defined States</h3> | ||
4296 | |||
4297 | <p>There are four primary subscription states (these states are described from the perspective of the user, not the contact): | ||
4298 | </p> | ||
4299 | <p> | ||
4300 | </p> | ||
4301 | <blockquote class="text"><dl> | ||
4302 | <dt>None:</dt> | ||
4303 | <dd>The user does not have a subscription to the contact's presence, and the contact does not have a subscription to the user's presence. | ||
4304 | </dd> | ||
4305 | <dt>To:</dt> | ||
4306 | <dd>The user has a subscription to the contact's presence, but the contact does not have a subscription to the user's presence. | ||
4307 | </dd> | ||
4308 | <dt>From:</dt> | ||
4309 | <dd>The contact has a subscription to the user's presence, but the user does not have a subscription to the contact's presence. | ||
4310 | </dd> | ||
4311 | <dt>Both:</dt> | ||
4312 | <dd>Both the user and the contact have subscriptions to each other's presence (i.e., the union of 'from' and 'to'). | ||
4313 | </dd> | ||
4314 | </dl></blockquote><p> | ||
4315 | |||
4316 | </p> | ||
4317 | <p></p> | ||
4318 | <blockquote class="text"> | ||
4319 | <p>Implementation Note: For the purpose of processing subscription-related presence stanzas as described in the following sections, a subscription state of "None" includes the case of the contact not being in the user's roster at all, i.e., an unknown entity from the perspective of the user's roster. | ||
4320 | </p> | ||
4321 | </blockquote> | ||
4322 | |||
4323 | <p>The foregoing states are supplemented by various sub-states related to pending inbound and outbound subscriptions, thus yielding nine possible subscription states: | ||
4324 | </p> | ||
4325 | <p> | ||
4326 | </p> | ||
4327 | <ol class="text"> | ||
4328 | <li>"None" = Contact and user are not subscribed to each other, and neither has requested a subscription from the other; this is reflected in the user's roster by subscription='none'. | ||
4329 | </li> | ||
4330 | <li>"None + Pending Out" = Contact and user are not subscribed to each other, and user has sent contact a subscription request but contact has not replied yet; this is reflected in the user's roster by subscription='none' and ask='subscribe'. | ||
4331 | </li> | ||
4332 | <li>"None + Pending In" = Contact and user are not subscribed to each other, and contact has sent user a subscription request but user has not replied yet. This state might or might not be reflected in the user's roster, as follows: if the user has created a roster item for the contact then the server MUST maintain that roster item and also note the existence of the inbound presence subscription request, whereas if the user has not created a roster item for the contact then the user's server MUST note the existence of the inbound presence subscription request but MUST NOT create a roster item for the contact (instead, the server MUST wait until the user has approved the subscription request before adding the contact to the user's roster). | ||
4333 | </li> | ||
4334 | <li>"None + Pending Out+In" = Contact and user are not subscribed to each other, contact has sent user a subscription request but user has not replied yet, and user has sent contact a subscription request but contact has not replied yet; this is reflected in the user's roster by subscription='none' and ask='subscribe'. | ||
4335 | </li> | ||
4336 | <li>"To" = User is subscribed to contact (one-way); this is reflected in the user's roster by subscription='to'. | ||
4337 | </li> | ||
4338 | <li>"To + Pending In" = User is subscribed to contact, and contact has sent user a subscription request but user has not replied yet; this is reflected in the user's roster by subscription='to'. | ||
4339 | </li> | ||
4340 | <li>"From" = Contact is subscribed to user (one-way); this is reflected in the user's roster by subscription='from'. | ||
4341 | </li> | ||
4342 | <li>"From + Pending Out" = Contact is subscribed to user, and user has sent contact a subscription request but contact has not replied yet; this is reflected in the user's roster by subscription='from' and ask='subscribe'. | ||
4343 | </li> | ||
4344 | <li>"Both" = User and contact are subscribed to each other | ||
4345 | (two-way); this is reflected in the user's roster by | ||
4346 | subscription='both'. | ||
4347 | </li> | ||
4348 | </ol><p> | ||
4349 | |||
4350 | </p> | ||
4351 | <a name="substates-out"></a><br /><hr /> | ||
4352 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4353 | <a name="rfc.section.A.2"></a><h3>A.2. | ||
4354 | Server Processing of Outbound Presence Subscription Stanzas</h3> | ||
4355 | |||
4356 | <p>Outbound presence subscription stanzas enable the user to manage his or her subscription to the contact's presence (via the "subscribe" and "unsubscribe" types), and to manage the contact's access to the user's presence (via the "subscribed" and "unsubscribed" types). | ||
4357 | </p> | ||
4358 | <p>The following rules apply to outbound routing of the stanza as well as changes to the user's roster. (These rules are described from the perspective of the user, not the contact. In addition, "S.N." stands for SHOULD NOT and "M.N." stands for MUST NOT.) | ||
4359 | </p> | ||
4360 | <a name="substates-out-subscribe"></a><br /><hr /> | ||
4361 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4362 | <a name="rfc.section.A.2.1"></a><h3>A.2.1. | ||
4363 | Subscribe</h3> | ||
4364 | |||
4365 | <p>Table 2: Processing of outbound "subscribe" stanzas | ||
4366 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
4367 | +------------------------------------------------------------------+ | ||
4368 | | EXISTING STATE | ROUTE? | NEW STATE | | ||
4369 | +------------------------------------------------------------------+ | ||
4370 | | "None" | MUST [1] | "None + Pending Out" | | ||
4371 | | "None + Pending Out" | MUST | no state change | | ||
4372 | | "None + Pending In" | MUST [1] | "None + Pending Out+In" | | ||
4373 | | "None + Pending Out+In" | MUST | no state change | | ||
4374 | | "To" | MUST | no state change | | ||
4375 | | "To + Pending In" | MUST | no state change | | ||
4376 | | "From" | MUST [1] | "From + Pending Out" | | ||
4377 | | "From + Pending Out" | MUST | no state change | | ||
4378 | | "Both" | MUST | no state change | | ||
4379 | +------------------------------------------------------------------+ | ||
4380 | </pre></div> | ||
4381 | <p></p> | ||
4382 | <blockquote class="text"> | ||
4383 | <p>[1] A state change to "pending out" includes setting the 'ask' flag to a value of "subscribe" in the user's roster. | ||
4384 | </p> | ||
4385 | </blockquote> | ||
4386 | |||
4387 | <a name="substates-out-unsubscribe"></a><br /><hr /> | ||
4388 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4389 | <a name="rfc.section.A.2.2"></a><h3>A.2.2. | ||
4390 | Unsubscribe</h3> | ||
4391 | |||
4392 | <p>Table 3: Processing of outbound "unsubscribe" stanzas | ||
4393 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
4394 | +-----------------------------------------------------------------+ | ||
4395 | | EXISTING STATE | ROUTE? | NEW STATE | | ||
4396 | +-----------------------------------------------------------------+ | ||
4397 | | "None" | MUST | no state change | | ||
4398 | | "None + Pending Out" | MUST | "None" | | ||
4399 | | "None + Pending In" | MUST | no state change | | ||
4400 | | "None + Pending Out+In" | MUST | "None + Pending In" | | ||
4401 | | "To" | MUST | "None" | | ||
4402 | | "To + Pending In" | MUST | "None + Pending In" | | ||
4403 | | "From" | MUST | no state change | | ||
4404 | | "From + Pending Out" | MUST | "From" | | ||
4405 | | "Both" | MUST | "From" | | ||
4406 | +-----------------------------------------------------------------+ | ||
4407 | </pre></div> | ||
4408 | <a name="substates-out-subscribed"></a><br /><hr /> | ||
4409 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4410 | <a name="rfc.section.A.2.3"></a><h3>A.2.3. | ||
4411 | Subscribed</h3> | ||
4412 | |||
4413 | <p>Table 4: Processing of outbound "subscribed" stanzas | ||
4414 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
4415 | +-----------------------------------------------------------------+ | ||
4416 | | EXISTING STATE | ROUTE? | NEW STATE | | ||
4417 | +-----------------------------------------------------------------+ | ||
4418 | | "None" | M.N. | pre-approval [1] | | ||
4419 | | "None + Pending Out" | M.N. | pre-approval [1] | | ||
4420 | | "None + Pending In" | MUST | "From" | | ||
4421 | | "None + Pending Out+In" | MUST | "From + Pending Out" | | ||
4422 | | "To" | M.N. | pre-approval [1] | | ||
4423 | | "To + Pending In" | MUST | "Both" | | ||
4424 | | "From" | M.N. | no state change | | ||
4425 | | "From + Pending Out" | M.N. | no state change | | ||
4426 | | "Both" | M.N. | no state change | | ||
4427 | +-----------------------------------------------------------------+ | ||
4428 | </pre></div> | ||
4429 | <p></p> | ||
4430 | <blockquote class="text"> | ||
4431 | <p>[1] Detailed information regarding subscription pre-approval is provided under <a class='info' href='#sub-preapproval'>Section 3.4<span> (</span><span class='info'>Pre-Approving a Subscription Request</span><span>)</span></a>. | ||
4432 | </p> | ||
4433 | </blockquote> | ||
4434 | |||
4435 | <a name="substates-out-unsubscribed"></a><br /><hr /> | ||
4436 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4437 | <a name="rfc.section.A.2.4"></a><h3>A.2.4. | ||
4438 | Unsubscribed</h3> | ||
4439 | |||
4440 | <p>Table 5: Processing of outbound "unsubscribed" stanzas | ||
4441 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
4442 | +-----------------------------------------------------------------+ | ||
4443 | | EXISTING STATE | ROUTE? | NEW STATE | | ||
4444 | +-----------------------------------------------------------------+ | ||
4445 | | "None" | S.N. | no state change [1] | | ||
4446 | | "None + Pending Out" | S.N. | no state change [1] | | ||
4447 | | "None + Pending In" | MUST | "None" | | ||
4448 | | "None + Pending Out+In" | MUST | "None + Pending Out" | | ||
4449 | | "To" | S.N. | no state change [1] | | ||
4450 | | "To + Pending In" | MUST | "To" | | ||
4451 | | "From" | MUST | "None" | | ||
4452 | | "From + Pending Out" | MUST | "None + Pending Out" | | ||
4453 | | "Both" | MUST | "To" | | ||
4454 | +-----------------------------------------------------------------+ | ||
4455 | </pre></div> | ||
4456 | <p></p> | ||
4457 | <blockquote class="text"> | ||
4458 | <p>[1] This event can result in cancellation of a subscription pre-approval, as described under <a class='info' href='#sub-preapproval'>Section 3.4<span> (</span><span class='info'>Pre-Approving a Subscription Request</span><span>)</span></a>. | ||
4459 | </p> | ||
4460 | </blockquote> | ||
4461 | |||
4462 | <a name="substates-in"></a><br /><hr /> | ||
4463 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4464 | <a name="rfc.section.A.3"></a><h3>A.3. | ||
4465 | Server Processing of Inbound Presence Subscription Stanzas</h3> | ||
4466 | |||
4467 | <p>Inbound presence subscription stanzas request a subscription-related action from the user (via the "subscribe" type), inform the user of subscription-related actions taken by the contact (via the "unsubscribe" type), or enable the user to manage the contact's access to the user's presence information (via the "subscribed" and "unsubscribed" types). | ||
4468 | </p> | ||
4469 | <p>The following rules apply to delivery of the inbound stanza as well as changes to the user's roster. (These rules for server processing of inbound presence subscription stanzas are described from the perspective of the user, not the contact. In addition, "S.N." stands for SHOULD NOT.) | ||
4470 | </p> | ||
4471 | <a name="substates-in-subscribe"></a><br /><hr /> | ||
4472 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4473 | <a name="rfc.section.A.3.1"></a><h3>A.3.1. | ||
4474 | Subscribe</h3> | ||
4475 | |||
4476 | <p>Table 6: Processing of inbound "subscribe" stanzas | ||
4477 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
4478 | +------------------------------------------------------------------+ | ||
4479 | | EXISTING STATE | DELIVER? | NEW STATE | | ||
4480 | +------------------------------------------------------------------+ | ||
4481 | | "None" | MUST [1] | "None + Pending In" | | ||
4482 | | "None + Pending Out" | MUST | "None + Pending Out+In" | | ||
4483 | | "None + Pending In" | S.N. | no state change | | ||
4484 | | "None + Pending Out+In" | S.N. | no state change | | ||
4485 | | "To" | MUST | "To + Pending In" | | ||
4486 | | "To + Pending In" | S.N. | no state change | | ||
4487 | | "From" | S.N. [2] | no state change | | ||
4488 | | "From + Pending Out" | S.N. [2] | no state change | | ||
4489 | | "Both" | S.N. [2] | no state change | | ||
4490 | +------------------------------------------------------------------+ | ||
4491 | </pre></div> | ||
4492 | <p></p> | ||
4493 | <blockquote class="text"> | ||
4494 | <p>[1] If the user previously sent presence of type "subscribed" as described under <a class='info' href='#substates-out-subscribed'>Appendix A.2.3<span> (</span><span class='info'>Subscribed</span><span>)</span></a> and <a class='info' href='#sub-preapproval'>Section 3.4<span> (</span><span class='info'>Pre-Approving a Subscription Request</span><span>)</span></a>, then the server MAY auto-reply with "subscribed" and change the state to "From" rather than "None + Pending In". | ||
4495 | </p> | ||
4496 | </blockquote> | ||
4497 | |||
4498 | <p></p> | ||
4499 | <blockquote class="text"> | ||
4500 | <p>[2] Server SHOULD auto-reply with "subscribed". | ||
4501 | </p> | ||
4502 | </blockquote> | ||
4503 | |||
4504 | <a name="substates-in-unsubscribe"></a><br /><hr /> | ||
4505 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4506 | <a name="rfc.section.A.3.2"></a><h3>A.3.2. | ||
4507 | Unsubscribe</h3> | ||
4508 | |||
4509 | <p>When the user's server receives a presence stanza of type "unsubscribe" for the user from the contact, if the stanza results in a subscription state change from the user's perspective then the user's server MUST change the state, MUST deliver the presence stanza from the contact to the user, and SHOULD auto-reply by sending a presence stanza of type "unsubscribed" to the contact on behalf of the user. Otherwise the user's server MUST NOT change the state and (because there is no state change) SHOULD NOT deliver the stanza. These rules are summarized in the following table. | ||
4510 | </p> | ||
4511 | <p>Table 7: Processing of inbound "unsubscribe" stanzas | ||
4512 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
4513 | +------------------------------------------------------------------+ | ||
4514 | | EXISTING STATE | DELIVER? | NEW STATE | | ||
4515 | +------------------------------------------------------------------+ | ||
4516 | | "None" | S.N. | no state change | | ||
4517 | | "None + Pending Out" | S.N. | no state change | | ||
4518 | | "None + Pending In" | MUST [1] | "None" | | ||
4519 | | "None + Pending Out+In" | MUST [1] | "None + Pending Out" | | ||
4520 | | "To" | S.N. | no state change | | ||
4521 | | "To + Pending In" | MUST [1] | "To" | | ||
4522 | | "From" | MUST [1] | "None" | | ||
4523 | | "From + Pending Out" | MUST [1] | "None + Pending Out" | | ||
4524 | | "Both" | MUST [1] | "To" | | ||
4525 | +------------------------------------------------------------------+ | ||
4526 | </pre></div> | ||
4527 | <p>[1] Server SHOULD auto-reply with "unsubscribed". | ||
4528 | </p> | ||
4529 | <a name="substates-in-subscribed"></a><br /><hr /> | ||
4530 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4531 | <a name="rfc.section.A.3.3"></a><h3>A.3.3. | ||
4532 | Subscribed</h3> | ||
4533 | |||
4534 | <p>When the user's server receives a presence stanza of type "subscribed" for the user from the contact, if there is no pending outbound request for access to the contact's presence information, then it MUST NOT change the subscription state and (because there is no state change) SHOULD NOT deliver the stanza to the user. If there is a pending outbound request for access to the contact's presence information and the inbound presence stanza of type "subscribed" results in a subscription state change, then the user's server MUST change the subscription state and MUST deliver the stanza to the user. If the user already is subscribed to the contact's presence information, the inbound presence stanza of type "subscribed" does not result in a subscription state change; therefore the user's server MUST NOT change the subscription state and (because there is no state change) SHOULD NOT deliver the stanza to the user. These rules are summarized in the following table. | ||
4535 | </p> | ||
4536 | <p>Table 8: Processing of inbound "subscribed" stanzas | ||
4537 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
4538 | +------------------------------------------------------------------+ | ||
4539 | | EXISTING STATE | DELIVER? | NEW STATE | | ||
4540 | +------------------------------------------------------------------+ | ||
4541 | | "None" | S.N. | no state change | | ||
4542 | | "None + Pending Out" | MUST | "To" | | ||
4543 | | "None + Pending In" | S.N. | no state change | | ||
4544 | | "None + Pending Out+In" | MUST | "To + Pending In" | | ||
4545 | | "To" | S.N. | no state change | | ||
4546 | | "To + Pending In" | S.N. | no state change | | ||
4547 | | "From" | S.N. | no state change | | ||
4548 | | "From + Pending Out" | MUST | "Both" | | ||
4549 | | "Both" | S.N. | no state change | | ||
4550 | +------------------------------------------------------------------+ | ||
4551 | </pre></div> | ||
4552 | <a name="substates-in-unsubscribed"></a><br /><hr /> | ||
4553 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4554 | <a name="rfc.section.A.3.4"></a><h3>A.3.4. | ||
4555 | Unsubscribed</h3> | ||
4556 | |||
4557 | <p>When the user's server receives a presence stanza of type "unsubscribed" for the user from the contact, if there is a pending outbound request for access to the contact's presence information or if the user currently is subscribed to the contact's presence information, then the user's server MUST change the subscription state and MUST deliver the stanza to the user. Otherwise, the user's server MUST NOT change the subscription state and (because there is no state change) SHOULD NOT deliver the stanza. These rules are summarized in the following table. | ||
4558 | </p> | ||
4559 | <p>Table 9: Processing of inbound "unsubscribed" stanzas | ||
4560 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
4561 | +------------------------------------------------------------------+ | ||
4562 | | EXISTING STATE | DELIVER? | NEW STATE | | ||
4563 | +------------------------------------------------------------------+ | ||
4564 | | "None" | S.N. | no state change | | ||
4565 | | "None + Pending Out" | MUST | "None" | | ||
4566 | | "None + Pending In" | S.N. | no state change | | ||
4567 | | "None + Pending Out+In" | MUST | "None + Pending In" | | ||
4568 | | "To" | MUST | "None" | | ||
4569 | | "To + Pending In" | MUST | "None + Pending In" | | ||
4570 | | "From" | S.N. | no state change | | ||
4571 | | "From + Pending Out" | MUST | "From" | | ||
4572 | | "Both" | MUST | "From" | | ||
4573 | +------------------------------------------------------------------+ | ||
4574 | </pre></div> | ||
4575 | <a name="blocking"></a><br /><hr /> | ||
4576 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4577 | <a name="rfc.section.B"></a><h3>Appendix B. | ||
4578 | Blocking Communication</h3> | ||
4579 | |||
4580 | <p>Sections 2.3.5 and 5.4.10 of <a class='info' href='#IMP-REQS'>[IMP‑REQS]<span> (</span><span class='info'>Day, M., Aggarwal, S., and J. Vincent, “Instant Messaging / Presence Protocol Requirements,” February 2000.</span><span>)</span></a> require that a compliant instant messaging and presence technology needs to enable a user to block communications from selected users. Protocols for doing so are specified in <a class='info' href='#XEP-0016'>[XEP‑0016]<span> (</span><span class='info'>Millard, P. and P. Saint-Andre, “Privacy Lists,” February 2007.</span><span>)</span></a> and <a class='info' href='#XEP-0191'>[XEP‑0191]<span> (</span><span class='info'>Saint-Andre, P., “Simple Communications Blocking,” February 2007.</span><span>)</span></a>. | ||
4581 | </p> | ||
4582 | <a name="vcard"></a><br /><hr /> | ||
4583 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4584 | <a name="rfc.section.C"></a><h3>Appendix C. | ||
4585 | vCards</h3> | ||
4586 | |||
4587 | <p>Sections 3.1.3 and 4.1.4 of <a class='info' href='#IMP-REQS'>[IMP‑REQS]<span> (</span><span class='info'>Day, M., Aggarwal, S., and J. Vincent, “Instant Messaging / Presence Protocol Requirements,” February 2000.</span><span>)</span></a> require that it be possible to retrieve out-of-band contact information for other users (e.g., telephone number or email address). An XML representation of the vCard specification defined in <a class='info' href='#VCARD'>RFC 2426<span> (</span><span class='info'>Dawson, F. and T. Howes, “vCard MIME Directory Profile,” September 1998.</span><span>)</span></a> [VCARD] is in common use within the XMPP community to provide such information but is out of scope for this specification (documentation of this protocol is contained in <a class='info' href='#XEP-0054'>[XEP‑0054]<span> (</span><span class='info'>Saint-Andre, P., “vcard-temp,” July 2008.</span><span>)</span></a>). | ||
4588 | </p> | ||
4589 | <a name="schema"></a><br /><hr /> | ||
4590 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4591 | <a name="rfc.section.D"></a><h3>Appendix D. | ||
4592 | XML Schema for jabber:iq:roster</h3> | ||
4593 | |||
4594 | <p>The following schema formally defines the 'jabber:iq:roster' namespace used in this document, in conformance with <a class='info' href='#XML-SCHEMA'>[XML‑SCHEMA]<span> (</span><span class='info'>Thompson, H., Maloney, M., Mendelsohn, N., and D. Beech, “XML Schema Part 1: Structures Second Edition,” October 2004.</span><span>)</span></a>. Because validation of XML streams and stanzas is optional, this schema is not normative and is provided for descriptive purposes only. For schemas defining core XMPP namespaces, refer to <a class='info' href='#XMPP-CORE'>[XMPP‑CORE]<span> (</span><span class='info'>Saint-Andre, P., “Extensible Messaging and Presence Protocol (XMPP): Core,” March 2011.</span><span>)</span></a>. | ||
4595 | </p><div style='display: table; width: 0; margin-left: 3em; margin-right: auto'><pre> | ||
4596 | <?xml version='1.0' encoding='UTF-8'?> | ||
4597 | |||
4598 | <xs:schema | ||
4599 | xmlns:xs='http://www.w3.org/2001/XMLSchema' | ||
4600 | targetNamespace='jabber:iq:roster' | ||
4601 | xmlns='jabber:iq:roster' | ||
4602 | elementFormDefault='qualified'> | ||
4603 | |||
4604 | <xs:element name='query'> | ||
4605 | <xs:complexType> | ||
4606 | <xs:sequence> | ||
4607 | <xs:element ref='item' | ||
4608 | minOccurs='0' | ||
4609 | maxOccurs='unbounded'/> | ||
4610 | </xs:sequence> | ||
4611 | <xs:attribute name='ver' | ||
4612 | type='xs:string' | ||
4613 | use='optional'/> | ||
4614 | </xs:complexType> | ||
4615 | </xs:element> | ||
4616 | |||
4617 | <xs:element name='item'> | ||
4618 | <xs:complexType> | ||
4619 | <xs:sequence> | ||
4620 | <xs:element ref='group' | ||
4621 | minOccurs='0' | ||
4622 | maxOccurs='unbounded'/> | ||
4623 | </xs:sequence> | ||
4624 | <xs:attribute name='approved' | ||
4625 | type='xs:boolean' | ||
4626 | use='optional'/> | ||
4627 | <xs:attribute name='ask' | ||
4628 | use='optional'> | ||
4629 | <xs:simpleType> | ||
4630 | <xs:restriction base='xs:NMTOKEN'> | ||
4631 | <xs:enumeration value='subscribe'/> | ||
4632 | </xs:restriction> | ||
4633 | </xs:simpleType> | ||
4634 | </xs:attribute> | ||
4635 | <xs:attribute name='jid' | ||
4636 | type='xs:string' | ||
4637 | use='required'/> | ||
4638 | <xs:attribute name='name' | ||
4639 | type='xs:string' | ||
4640 | use='optional'/> | ||
4641 | <xs:attribute name='subscription' | ||
4642 | use='optional' | ||
4643 | default='none'> | ||
4644 | <xs:simpleType> | ||
4645 | <xs:restriction base='xs:NMTOKEN'> | ||
4646 | <xs:enumeration value='both'/> | ||
4647 | <xs:enumeration value='from'/> | ||
4648 | <xs:enumeration value='none'/> | ||
4649 | <xs:enumeration value='remove'/> | ||
4650 | <xs:enumeration value='to'/> | ||
4651 | </xs:restriction> | ||
4652 | </xs:simpleType> | ||
4653 | </xs:attribute> | ||
4654 | </xs:complexType> | ||
4655 | </xs:element> | ||
4656 | |||
4657 | <xs:element name='group' type='xs:string'/> | ||
4658 | |||
4659 | </xs:schema> | ||
4660 | </pre></div> | ||
4661 | <a name="diffs"></a><br /><hr /> | ||
4662 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4663 | <a name="rfc.section.E"></a><h3>Appendix E. | ||
4664 | Differences From RFC 3921</h3> | ||
4665 | |||
4666 | <p>Based on consensus derived from implementation and deployment experience as well as formal interoperability testing, the following substantive modifications were made from <a class='info' href='#RFC3921'>[RFC3921]<span> (</span><span class='info'>Saint-Andre, P., Ed., “Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence,” October 2004.</span><span>)</span></a> (in addition to numerous changes of an editorial nature). | ||
4667 | </p> | ||
4668 | <p> | ||
4669 | </p> | ||
4670 | <ul class="text"> | ||
4671 | <li>The protocol for session establishment was determined to be unnecessary and therefore the content previously defined in Section 3 of RFC 3921 was removed. However, for the sake of backward-compatibility server implementations are encouraged to advertise support for the feature, even though session establishment is a "no-op". | ||
4672 | </li> | ||
4673 | <li>In order to more seamlessly repair lack of synchronization in subscription states between rosters located at different servers, clarified and modified error handling related to presence subscription requests, presence probes and presence notifications. | ||
4674 | </li> | ||
4675 | <li>Changed the 'from' address for presence probes so that it is the bare JID, not the full JID. | ||
4676 | </li> | ||
4677 | <li>Adjusted and clarified stanza delivery rules based on implementation and deployment experience. | ||
4678 | </li> | ||
4679 | <li>Explicitly specified that a server is allowed to deliver a message stanza of type "normal" or "chat" to all resources if it has a method for allowing resources to opt in to such behavior. | ||
4680 | </li> | ||
4681 | <li>Allowed a server to use its own algorithm for determining the "most available" resource for the purpose of message delivery, but mentioned the recommended algorithm from RFC 3921 (based on presence priority) as one possible algorithm. | ||
4682 | </li> | ||
4683 | <li>Added optional versioning of roster information to save bandwidth in cases where the roster has not changed (or has changed very little) between sessions; the relevant protocol interactions were originally described in <a class='info' href='#XEP-0237'>[XEP‑0237]<span> (</span><span class='info'>Saint-Andre, P. and D. Cridland, “Roster Versioning,” March 2010.</span><span>)</span></a>. | ||
4684 | </li> | ||
4685 | <li>Added optional server support for pre-approved presence subscriptions via presence stanzas of type "subscribed", including a new 'approved' attribute that can be set to "true" (for a pre-approved subscription) or "false" (the default). | ||
4686 | </li> | ||
4687 | <li>Added optional 'parent' attribute to <thread/> element. | ||
4688 | </li> | ||
4689 | <li>Moved the protocol for communications blocking (specified in Section 10 of RFC 3921) back to <a class='info' href='#XEP-0016'>[XEP‑0016]<span> (</span><span class='info'>Millard, P. and P. Saint-Andre, “Privacy Lists,” February 2007.</span><span>)</span></a>, from which it was originally taken. | ||
4690 | </li> | ||
4691 | <li>Recommended returning presence unavailable in response to probes. | ||
4692 | </li> | ||
4693 | <li>Clarified handling of presence probes sent to full JIDs. | ||
4694 | </li> | ||
4695 | <li>Explicitly specified that the default value for the presence <priority/> element is zero. | ||
4696 | </li> | ||
4697 | <li>Removed recommendation to support the "_im" and "_pres" SRV records. | ||
4698 | </li> | ||
4699 | </ul><p> | ||
4700 | |||
4701 | </p> | ||
4702 | <a name="acks"></a><br /><hr /> | ||
4703 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4704 | <a name="rfc.section.F"></a><h3>Appendix F. | ||
4705 | Acknowledgements</h3> | ||
4706 | |||
4707 | <p>This document is an update to, and derived from, RFC 3921. This document would have been impossible without the work of the contributors and commenters acknowledged there. | ||
4708 | </p> | ||
4709 | <p>Hundreds of people have provided implementation feedback, bug reports, requests for clarification, and suggestions for improvement since publication of RFC 3921. Although the document editor has endeavored to address all such feedback, he is solely responsible for any remaining errors and ambiguities. | ||
4710 | </p> | ||
4711 | <p>Some of the text about roster versioning was borrowed from <a class='info' href='#XEP-0237'>[XEP‑0237]<span> (</span><span class='info'>Saint-Andre, P. and D. Cridland, “Roster Versioning,” March 2010.</span><span>)</span></a>, and some of the text about message threads was borrowed from <a class='info' href='#XEP-0201'>[XEP‑0201]<span> (</span><span class='info'>Saint-Andre, P., Paterson, I., and K. Smith, “Best Practices for Message Threads,” November 2010.</span><span>)</span></a>. | ||
4712 | </p> | ||
4713 | <p>Special thanks are due to Kevin Smith, Matthew Wild, Dave Cridland, Waqas Hussain, Philipp Hancke, Florian Zeitz, Jonas Lindberg, Jehan Pages, Tory Patnoe, and others for their comments during Working Group Last Call. | ||
4714 | </p> | ||
4715 | <p>Thanks also to Richard Barnes for his review on behalf of the Security Directorate. | ||
4716 | </p> | ||
4717 | <p>The Working Group chairs were Ben Campbell and Joe Hildebrand. The responsible Area Director was Gonzalo Camarillo. | ||
4718 | </p> | ||
4719 | <a name="rfc.authors"></a><br /><hr /> | ||
4720 | <table summary="layout" cellpadding="0" cellspacing="2" class="TOCbug" align="right"><tr><td class="TOCbug"><a href="#toc"> TOC </a></td></tr></table> | ||
4721 | <h3>Author's Address</h3> | ||
4722 | <table width="99%" border="0" cellpadding="0" cellspacing="0"> | ||
4723 | <tr><td class="author-text"> </td> | ||
4724 | <td class="author-text">Peter Saint-Andre</td></tr> | ||
4725 | <tr><td class="author-text"> </td> | ||
4726 | <td class="author-text">Cisco</td></tr> | ||
4727 | <tr><td class="author-text"> </td> | ||
4728 | <td class="author-text">1899 Wyknoop Street, Suite 600</td></tr> | ||
4729 | <tr><td class="author-text"> </td> | ||
4730 | <td class="author-text">Denver, CO 80202</td></tr> | ||
4731 | <tr><td class="author-text"> </td> | ||
4732 | <td class="author-text">USA</td></tr> | ||
4733 | <tr><td class="author" align="right">Phone: </td> | ||
4734 | <td class="author-text">+1-303-308-3282</td></tr> | ||
4735 | <tr><td class="author" align="right">EMail: </td> | ||
4736 | <td class="author-text"><a href="mailto:psaintan@cisco.com">psaintan@cisco.com</a></td></tr> | ||
4737 | </table> | ||
4738 | </body></html> | ||