1.4rc1: added presence use case

git-svn-id: file:///home/ksmith/gitmigration/svn/xmpp/trunk@2512 4b5297f7-1745-476d-ba37-a9c6900126ab
This commit is contained in:
Peter Saint-Andre 2008-11-14 23:25:50 +00:00
parent ece2439e93
commit ed44aca5e9
1 changed files with 69 additions and 15 deletions

View File

@ -26,6 +26,12 @@
&jer;
&temas;
&stpeter;
<revision>
<version>1.4rc1</version>
<date>2008-11-13</date>
<initials>psa</initials>
<remark><p>Added use case for inclusion of last activity information in presence.</p></remark>
</revision>
<revision>
<version>1.3</version>
<date>2008-07-16</date>
@ -75,13 +81,19 @@
<section1 topic='Protocol' anchor='protocol'>
<p>In order to request last activity information regarding another entity, the requesting entity shall send an &IQ; stanza of type "get" to the target entity, containing a &QUERY; element qualified by the 'jabber:iq:last' namespace:</p>
<example caption='Last Activity Query'><![CDATA[
<iq from='romeo@montague.net/orchard' to='juliet@capulet.com' type='get' id='last1'>
<iq from='romeo@montague.net/orchard'
id='last1'
to='juliet@capulet.com'
type='get'>
<query xmlns='jabber:iq:last'/>
</iq>
]]></example>
<p>The target entity MUST return either an IQ-result or an IQ-error. When returning an IQ-result, the target entity sends an &IQ; stanza of type='result' containing a &QUERY; element with a REQUIRED 'seconds' attribute and OPTIONAL XML character data.</p>
<example caption='Last Activity Response'><![CDATA[
<iq from='juliet@capulet.com' to='romeo@montague.net/orchard' type='result' id='last1'>
<iq from='juliet@capulet.com'
id='last1'
to='romeo@montague.net/orchard'
type='result'>
<query xmlns='jabber:iq:last' seconds='903'/>
</iq>
]]></example>
@ -90,14 +102,20 @@
<section1 topic='Offline User Query' anchor='offline'>
<p>The primary usage of the 'jabber:iq:last' namespace is to find out how long ago a user logged out (and, additionally, what their status message was at that time). This primary usage assumes that the IQ-get is sent to a bare JID &BAREJID;. When used in this way, the &QUERY; element contained in the IQ-result has a 'seconds' attribute, which is the number of seconds that have passed since the user last logged out. In addition, the element MAY contain XML character data that specifies the status message of the last unavailable presence received from the user. An example is shown below:</p>
<example caption='Last Activity Query'><![CDATA[
<iq from='romeo@montague.net/orchard' to='juliet@capulet.com' type='get' id='last1'>
<iq from='romeo@montague.net/orchard'
id='last1'
to='juliet@capulet.com'
type='get'>
<query xmlns='jabber:iq:last'/>
</iq>
]]></example>
<p>As specified in &xmppcore; and &xmppim;, an IQ stanza of type "get" sent to a bare JID &LOCALBARE; is handled by the user's server on the user's behalf, not delivered to one or more active resources.</p>
<p>If the requesting entity is not authorized to view the user's presence information (normally via a presence subscription as defined in <cite>XMPP-IM</cite>), the user's server MUST NOT return last activity information but instead MUST return a &forbidden; error in response to the last activity request.</p>
<example caption='Requesting Entity is Not Authorized to Retrieve Last Activity Information'><![CDATA[
<iq from='juliet@capulet.com' to='romeo@montague.net/orchard' type='result' id='last1'>
<iq from='juliet@capulet.com'
id='last1'
to='romeo@montague.net/orchard'
type='result'>
<error type='auth'>
<forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
@ -122,7 +140,10 @@
<p>In this case, the user's server shall either deliver the IQ to an available resource or respond on behalf of the user.</p>
<p>In particular, as with the offline query use case above, if the requesting entity is not authorized to view the user's presence information (normally via a presence subscription as defined in <cite>XMPP IM</cite>), the user's server MUST NOT deliver the IQ-get to an available resource but instead MUST return a &forbidden; error in response to the last activity request.</p>
<example caption='Requesting Entity is Not Authorized to Retrieve Last Activity Information'><![CDATA[
<iq from='juliet@capulet.com' to='romeo@montague.net/orchard' type='result' id='last1'>
<iq from='juliet@capulet.com'
id='last1'
to='romeo@montague.net/orchard'
type='result'>
<error type='auth'>
<forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
@ -130,14 +151,20 @@
]]></example>
<p>If the user's server delivers the IQ-get to one of the user's available resources, the user's client MAY respond with the idle time of the user (i.e., the last time that the user interacted with the client application).</p>
<example caption='Last Activity Response by Client'><![CDATA[
<iq from='juliet@capulet.com/balcony' to='romeo@montague.net/orchard' type='result' id='last2'>
<iq from='juliet@capulet.com/balcony'
id='last2'
to='romeo@montague.net/orchard'
type='result'>
<query xmlns='jabber:iq:last' seconds='123'/>
</iq>
]]></example>
<p>In this example, the user has been idle for about two minutes.</p>
<p>Support for this functionality is OPTIONAL. A client that does not support the protocol, or that does not wish to divulge this information, MUST return a &unavailable; error.</p>
<example caption='Service Unavailable Error'><![CDATA[
<iq from='juliet@capulet.com/balcony' to='romeo@montague.net/orchard' type='error' id='last2'>
<iq from='juliet@capulet.com/balcony'
id='last2'
to='romeo@montague.net/orchard'
type='error'>
<error type='cancel'>
<service-unavailable xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>
</error>
@ -145,39 +172,66 @@
]]></example>
<p>If there is no available resource matching the user@host/resource in the 'to' attribute of the request, the server MUST follow the rules in <cite>XMPP IM</cite> in order to determine what error stanza to return.</p>
</section1>
<section1 topic='Inclusion in Presence' anchor='presence'>
<p>An online client MAY include last activity information when sending presence updates. The prototypical use case is including the idle time when automatically setting the user's &SHOW; value to "away" or "xa" (extended away). For example, consider a user who has configured her client to automatically change her presence to "away" after 10 minutes of inactivity. The client could include an iq:last flag to specify how long the user has been idle.</p>
<example caption='Last Indication in Auto-Away'><![CDATA[
<presence from='juliet@capulet.com/balcony'>
<show>away</show>
<query xmlns='jabber:iq:last' seconds='600'/>
</presence>
]]></example>
<p>If one of the user's contacts receives that presence notification with delayed delivery (see &xep0203;) on login in response to a presence probe as described in &xmppim;, the contact will then know how long the user has been idle (i.e., the number of seconds since the delayed delivery timestamp, plus the iq:last seconds). Thus the contact does not need to send an iq:last query.</p>
<example caption='Last Indication in Auto-Away With Delayed Delivery'><![CDATA[
<presence from='juliet@capulet.com/balcony' to='romeo@montague.net'>
<show>away</show>
<query xmlns='jabber:iq:last' seconds='600'/>
<delay xmlns='urn:xmpp:delay'
from='capulet.com'
stamp='2002-09-10T23:41:07Z'/>
</presence>
]]></example>
<p>If no last indication is included in a presence notification, the recipient MUST assume that the idle time is zero.</p>
</section1>
<section1 topic='Server and Component Query' anchor='server'>
<p>When the last activity query is sent to a server or component (i.e., to a JID of the form &DOMAINBARE;), the information contained in the IQ reply reflects the uptime of the JID sending the reply. The seconds attribute specifies how long the host has been up and running. The &QUERY; element SHOULD NOT contain XML character data.</p>
<example caption='Last Activity Query Sent to Server or Service'><![CDATA[
<iq from='romeo@montague.net/orchard' to='capulet.com' type='get' id='last3'>
<iq from='romeo@montague.net/orchard'
id='last3'
to='capulet.com'
type='get'>
<query xmlns='jabber:iq:last'/>
</iq>
<iq from='capulet.com' to='romeo@montague.net/orchard' type='result' id='last3'>
<iq from='capulet.com'
id='last3'
to='romeo@montague.net/orchard'
type='result'>
<query xmlns='jabber:iq:last' seconds='123456'/>
</iq>
]]></example>
<p>In this example, the server has been up for a little more than 34 hours.</p>
</section1>
<section1 topic='Determining Support' anchor='disco'>
<p>In order for a requesting entity to determine if a responding entity supports the last activity protocol, it SHOULD send a &xep0030; information request to the responding entity:</p>
<section1 topic='Determining Support' anchor='support'>
<p>If an entity supports the Last Activity protocol, it MUST advertise that fact in its responses to &xep0030; information ("disco#info") requests by returning a feature of "jabber:iq:last".</p>
<example caption='Requesting entity queries responding entity regarding protocol support'><![CDATA[
<iq from='stpeter@jabber.org/roundabout'
id='disco1'
to='jabber.org'
id='disco1'>
type='get'>
<query xmlns='http://jabber.org/protocol/disco#info'/>
</iq>
]]></example>
<example caption='Responding entity communicates protocol support'><![CDATA[
<iq from='jabber.org'
id='disco1'
to='stpeter@jabber.org/roundabout'
id='disco1'>
type='result'>
<query xmlns='http://jabber.org/protocol/disco#info'>
...
<feature var='jabber:iq:last'/>
...
</query>
</iq>
]]></example>
<p>In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined in &xep0115;. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.</p>
</section1>
<section1 topic='Implementation Notes' anchor='impl'>
<p>The information contained in an IQ reply for this namespace is inherently ambiguous. Specifically, for a bare JID &LOCALBARE; the information is the time since the JID was last connected to its server; for a full JID &LOCALFULL; the information is the time since the resource was last active in the context of an existing session; and for a bare domain the information is the uptime for the server or component. An application must take these differences into account when presenting the information to a human user.</p>