forked from xsf/xeps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
xep-0022.xml
331 lines (309 loc) · 17 KB
/
xep-0022.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
<!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
<title>Message Events</title>
<abstract>This document defines an XMPP protocol extension used to request and respond to events relating to the delivery, display, and composition of messages. Note: This specification has been obsoleted in favor of XEP-0085 and XEP-0184.</abstract>
&LEGALNOTICE;
<number>0022</number>
<status>Obsolete</status>
<type>Historical</type>
<sig>Standards</sig>
<dependencies>
<spec>XMPP Core</spec>
</dependencies>
<supersedes/>
<supersededby>
<spec>XEP-0085</spec>
<spec>XEP-0184</spec>
</supersededby>
<shortname>x-event</shortname>
<schemaloc>
<url>http://www.xmpp.org/schemas/x-event.xsd</url>
</schemaloc>
&jer;
<author>
<firstname>DJ</firstname>
<surname>Adams</surname>
<email>[email protected]</email>
<jid>[email protected]</jid>
</author>
&stpeter;
<revision>
<version>1.4</version>
<date>2009-05-27</date>
<initials>psa</initials>
<remark>Per a vote of the XMPP Council, changed status to Obsolete.</remark>
</revision>
<revision>
<version>1.3</version>
<date>2004-01-06</date>
<initials>psa</initials>
<remark>Added XML schema.</remark>
</revision>
<revision>
<version>1.2</version>
<date>2003-02-11</date>
<initials>psa</initials>
<remark>Attempted to clarify usage and business rules.</remark>
</revision>
<revision>
<version>1.1</version>
<date>2003-01-26</date>
<initials>psa</initials>
<remark>Added more detailed information and clarified a few points.</remark>
</revision>
<revision>
<version>1.0</version>
<date>2002-05-08</date>
<initials>psa</initials>
<remark>Changed status to Active.</remark>
</revision>
<revision>
<version>0.2</version>
<date>2002-03-13</date>
<initials>dja</initials>
<remark>Minor corrections and additions.</remark>
</revision>
<revision>
<version>0.1</version>
<date>2002-03-05</date>
<initials>dja</initials>
<remark>Initial draft.</remark>
</revision>
</header>
<section1 topic='Introduction'>
<p>The 'jabber:x:event' namespace defines extensions used to request and respond to events relating to the delivery, display, and composition of messages.</p>
<p>By attaching a jabber:x:event extension to a &MESSAGE; element, the sender can track stages in the delivery of that message to its recipient.</p>
<p><em>Note: More modern protocol extensions for this functionality have been defined in &xep0085; for the composing and offline events and in &xep0184; for the delivered and displayed events; those specifications supersede this one.</em></p>
</section1>
<section1 topic='The Events'>
<p>There are four message events currently defined in this namespace:</p>
<section2 topic='Offline'>
<p>Indicates that the message has been stored offline by the intended recipient's server. This event is triggered only if the intended recipient's server supports offline storage, has that support enabled, and the recipient is offline when the server receives the message for delivery.</p>
</section2>
<section2 topic='Delivered'>
<p>Indicates that the message has been delivered to the recipient. This signifies that the message has reached the recipient's Jabber client, but does not necessarily mean that the message has been displayed. This event is to be raised by the Jabber client.</p>
</section2>
<section2 topic='Displayed'>
<p>Once the message has been received by the recipient's Jabber client, it may be displayed to the user. This event indicates that the message has been displayed, and is to be raised by the Jabber client. Even if a message is displayed multiple times, this event should be raised only once.</p>
</section2>
<section2 topic='Composing'>
<p>In threaded chat conversations, this indicates that the recipient is composing a reply to a message. The event is to be raised by the recipient's Jabber client. A Jabber client is allowed to raise this event multiple times in response to the same request, providing the original event is cancelled first.</p>
</section2>
</section1>
<section1 topic='Usage'>
<p>Extensions qualified by the jabber:x:event namespace may be used only in the context of &MESSAGE; elements. That is, event information should be requested, and given in response, in relation to &MESSAGE; elements only, and not &PRESENCE; or &IQ; elements.</p>
<p>Event information should only be sent in response to a request for that information. Unsolicited event information is illegal. In addition, a client should not request message event information from a correspondent if it is known (for example through the results of a previous browse request) that the correspondent does not support message events.</p>
<p>Any request for the offline event in a message that has been stored offline must be removed by the server before the message is forwarded to the Jabber client. This means that any <offline/> tag should be removed from the extension.</p>
<section2 topic='Requesting Event Notifications'>
<p>Event notifications are requested by attaching an extension qualified by the jabber:x:event namespace to a &MESSAGE; element. A tag representing each event type requested for that message should be placed within the extension. Only one jabber:x:event extension may be attached to a &MESSAGE; element, but multiple event types may be requested within that one extension. The tags representing each of the event types are <offline/>, <delivered/>, <displayed/>, and <composing/>.</p>
<p>An example of a &MESSAGE; element with a jabber:x:event extension is shown here.</p>
<example caption='Requesting notification of offline storage and delivery for a message'><![CDATA[
<message to='[email protected]' id='message22'>
<body>Art thou not Romeo, and a Montague?</body>
<x xmlns='jabber:x:event'>
<offline/>
<delivered/>
<composing/>
</x>
</message>
]]></example>
<p>Here we see the sender wants to be notified if the message is stored offline (by the server), notified when the message is delivered (to the client), and notified if the recipient begins replying to the message. In this case, the sender will potentially receive three events based on this request. The first if the recipient is offline and the message is stored on the server, the second when the recipient becomes available and the message is delivered, and the third if the recipient begins composing a reply to the message.</p>
<p>Note that the &MESSAGE; element requesting event notification contains an 'id' attribute. While these attributes are optional in the Jabber protocol, messages that contain event notification requests MUST contain an 'id' attribute so that raised events may be matched up with their original requests.</p>
</section2>
<section2 topic='Raising Events'>
<p>If the message is stored by the server, the server must raise the requested event (offline) by sending a message to the sender as shown in this example:</p>
<example caption='Raising the offline event'><![CDATA[
<message
from='[email protected]'
to='[email protected]/balcony'>
<x xmlns='jabber:x:event'>
<offline/>
<id>message22</id>
</x>
</message>
]]></example>
<p>When raising an event, the raiser must send a &MESSAGE; element constructed according to the following rules:</p>
<ul>
<li>The element must contain only a jabber:x:event extension. Standard message elements such as <subject/>, <body/>, MUST NOT be included.</li>
<li>The extension must contain one tag representing the event being raised. For example, if the offline event is being raised, an <offline/> tag must be included. (The events are temporally exclusive, thus only one event tag should ever be included.)</li>
<li>The extension must also contain an <id/> tag. The contents of this tag MUST be the value of the 'id' <em>attribute</em> of the original message to which this event notification pertains. (If no 'id' attribute was included in the original message, then the <id/> tag must still be included with no CDATA.)</li>
<li>The message's from attribute should be set to the recipient of the original message for which the event is being raised. (This is an issue more relevant for the server, in responding to the offline event, because clients should rely on the server to stamp the elements that they send out with a from attribute.)</li>
<li>The link between the original message for which the event is being raised, and the message containing that raised event, is the <id/> tag in the jabber:x:event extension of the message containing that raised event, that points to the id attribute of the original message.</li>
</ul>
</section2>
<section2 topic='The Composing Event'>
<p>The composing event is slightly different from the other events in that it can be raised and cancelled multiple times. This is to allow the reflection of what actually is happening when a user replies to a message; he may start composing a reply, which would trigger the composing event, get halfway through, and stop (by some definition of "stop", which may be implementation-specific). At this stage the event is no longer valid, or at least doesn't make much sense. So the client may send a cancellation for the composing event just raised.</p>
<p>The cancellation is raised by sending another jabber:x:event; however, in contrast to how the events are usually raised, no <composing/> tag is sent, just an <id/> tag, like this:</p>
<example caption='Romeo begins to compose a reply'><![CDATA[
<message
from='[email protected]'
to='[email protected]/balcony'>
<x xmlns='jabber:x:event'>
<composing/>
<id>message22</id>
</x>
</message>
]]></example>
<example caption='Romeo pauses to reflect before answering, thus cancelling the composing event'><![CDATA[
<message
from='[email protected]'
to='[email protected]/balcony'>
<x xmlns='jabber:x:event'>
<id>message22</id>
</x>
</message>
]]></example>
<p>The lack of an <composing/> tag (and any other event tag) signifies that the composing event, indicated previously by the id value, has been cancelled. In this example, the composing event being cancelled is that event that was previously raised with the id of message22. After cancelling a composing event, a new one may be raised, following the same rules as before, when the typing of the reply is resumed.</p>
</section2>
</section1>
<section1 topic='Examples'>
<p>This section contains a number of examples to illustrate the full flow of messages, event notifications, and event cancellations for a fictional conversation.</p>
<example caption='Juliet sends a message to Romeo and requests all event types'><![CDATA[
SEND: <message to='[email protected]' id='message22'>
<body>Art thou not Romeo, and a Montague?</body>
<x xmlns='jabber:x:event'>
<offline/>
<delivered/>
<displayed/>
<composing/>
</x>
</message>
]]></example>
<p>Romeo temporarily loses his wireless connection in the Capulet's orchard and therefore his message is stored offline by the montague.net server, which generates the offline event and sends that notification to Juliet.</p>
<example caption='Receiving the offline event'><![CDATA[
RECV: <message
from='[email protected]'
to='[email protected]/balcony'>
<x xmlns='jabber:x:event'>
<offline/>
<id>message22</id>
</x>
</message>
]]></example>
<p>Romeo reconnects and the message is delivered to his Jabber client, which generates a delivered event and sends it to Juliet's client.</p>
<example caption='Juliet receives notification of message delivery'><![CDATA[
RECV: <message
from='[email protected]/orchard'
to='[email protected]/balcony'>
<x xmlns='jabber:x:event'>
<delivered/>
<id>message22</id>
</x>
</message>
]]></example>
<p>Romeo's Jabber client displays the message and sends a displayed event to Juliet's client.</p>
<example caption='Juliet receives notification of message display'><![CDATA[
RECV: <message
from='[email protected]/orchard'
to='[email protected]/balcony'>
<x xmlns='jabber:x:event'>
<displayed/>
<id>message22</id>
</x>
</message>
]]></example>
<p>Romeo begins composing a reply to Juliet's heartfelt question, and his Jabber client notifies Juliet that he is composing a reply.</p>
<example caption='Juliet receives notification of message composing'><![CDATA[
RECV: <message
from='[email protected]/orchard'
to='[email protected]/balcony'>
<x xmlns='jabber:x:event'>
<composing/>
<id>message22</id>
</x>
</message>
]]></example>
<p>Romeo realizes his reply is too rash and pauses to choose the right words; his Jabber client senses the delay and cancels the previous composing event.</p>
<example caption='Juliet receives cancellation of message composing'><![CDATA[
RECV: <message
from='[email protected]/orchard'
to='[email protected]/balcony'>
<x xmlns='jabber:x:event'>
<id>message22</id>
</x>
</message>
]]></example>
<p>Romeo starts composing again, and his Jabber client sends a notification to Juliet's client.</p>
<example caption='Juliet receives a second notification of message composing'><![CDATA[
RECV: <message
from='[email protected]/orchard'
to='[email protected]/balcony'>
<x xmlns='jabber:x:event'>
<composing/>
<id>message22</id>
</x>
</message>
]]></example>
<p>Romeo finally sends his reply, and requests composing events related to it.</p>
<example caption='Romeo replies'><![CDATA[
SEND: <message to='[email protected]' id='GabberMessage43'>
<body>Neither, fair saint, if either thee dislike.</body>
<x xmlns='jabber:x:event'>
<composing/>
</x>
</message>
]]></example>
</section1>
<section1 topic='Implementation Notes'>
<p>Compliant implementations SHOULD observe the following business rules:</p>
<ol>
<li>Every outgoing message sent from a compliant client should contain a request for event notifications (if such notifications are desired). The request for notifications cannot be sent just once in a conversation, since it applies to every message sent.</li>
<li>When a client receives a request for events from another entity, it should cache the most recent ID.</li>
<li>When a user begins replying to a message received from a contact, the user's client should check to see whether events have been requested by the contact for that message and set the CDATA of the <id/> element to the cached ID value.</li>
<li>The CDATA of the <id/> element MUST be the same as the value of the 'id' attribute of the notification request.</li>
</ol>
</section1>
<section1 topic='Security Considerations'>
<p>There are no security features or concerns related to this proposal.</p>
</section1>
<section1 topic='IANA Considerations'>
<p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations'>
<p>No action on the part of the ®ISTRAR; is necessary as a result of this document, since 'jabber:x:event' is already a registered protocol namespace.</p>
</section1>
<section1 topic='XML Schema'>
<code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>
<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
targetNamespace='jabber:x:event'
xmlns='jabber:x:event'
elementFormDefault='qualified'>
<xs:annotation>
<xs:documentation>
The protocol documented by this schema is defined in
XEP-0022: http://www.xmpp.org/extensions/xep-0022.html
</xs:documentation>
</xs:annotation>
<xs:element name='x'>
<xs:complexType>
<xs:sequence>
<xs:element name='offline' minOccurs='0' type='empty'/>
<xs:element name='delivered' minOccurs='0' type='empty'/>
<xs:element name='displayed' minOccurs='0' type='empty'/>
<xs:element name='composing' minOccurs='0' type='empty'/>
<xs:element name='id' minOccurs='0' type='xs:NMTOKEN'/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:simpleType name='empty'>
<xs:restriction base='xs:string'>
<xs:enumeration value=''/>
</xs:restriction>
</xs:simpleType>
</xs:schema>
]]></code>
</section1>
<section1 topic='Open Issues'>
<ol>
<li>In a Standards Track specification addressing event functionality, it would be desirable to have more cancellation methods for composing events than those defined in this Informational document. For instance, is someone still composing if they become unavailable? This example points to the fact that cancellation of a composing event can either be explicit (the default or desired scenario) or implicit (e.g., through a change in the availability state of a client or the existence of the session associated with the message composition).</li>
</ol>
</section1>
</xep>