<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep xmlns="">
<header>
  <title>Last User Interaction in Presence</title>
  <abstract>This specification defines a way to communicate time of last user interaction with her system using XMPP presence notifications.</abstract>
  
<legal>
<copyright>This XMPP Extension Protocol is copyright © 1999 – 2024 by the <link url="https://xmpp.org/">XMPP Standards Foundation</link> (XSF).</copyright>
<permissions>Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.</permissions>
<warranty>## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##</warranty>
<liability>In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.</liability>
<conformance>This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at &lt;<link url="https://xmpp.org/about/xsf/ipr-policy">https://xmpp.org/about/xsf/ipr-policy</link>&gt; or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).</conformance>
</legal>
  <number>0319</number>
  <status>Draft</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XMPP IM</spec>
    <spec>XEP-0082</spec>
  </dependencies>
  <supersedes>
    <spec>XEP-0256</spec>
  </supersedes>
  <supersededby/>
  <shortname>idle</shortname>
  
  <author>
    <firstname>Tobias</firstname>
    <surname>Markmann</surname>
    <email>tobias.markmann@isode.com</email>
    <jid>tm@ayena.de</jid>
  </author>

  <revision>
    <version>1.0.2</version>
    <date>2017-07-17</date>
    <initials>egp</initials>
    <remark><p>Make the schema more precise about a date being a xs:dateTime.</p></remark>
  </revision>
  <revision>
    <version>1.0.1</version>
    <date>2017-05-30</date>
    <initials>egp</initials>
    <remark><p>Be precise about the <span class="ref"><link url="https://xmpp.org/extensions/xep-0082.html">XMPP Date and Time Profiles (XEP-0082)</link></span> <note>XEP-0082: XMPP Date and Time Profiles &lt;<link url="https://xmpp.org/extensions/xep-0082.html">https://xmpp.org/extensions/xep-0082.html</link>&gt;.</note> profile used.</p></remark>
  </revision>
  <revision>
    <version>1.0</version>
    <date>2015-04-02</date>
    <initials>XEP editor (mam)</initials>
    <remark><p>Per a vote of the XMPP Council, advanced specification from Experimental to Draft.</p></remark>
  </revision>
  <revision>
    <version>0.2</version>
    <date>2013-08-27</date>
    <initials>tobias</initials>
    <remark><p>Fix issues raised in XMPP Council meeting.</p></remark>
  </revision>
  <revision>
    <version>0.1</version>
    <date>2013-03-04</date>
    <initials>psa</initials>
    <remark><p>Initial published version approved by the XMPP Council.</p></remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2013-02-17</date>
    <initials>tobias</initials>
    <remark><p>Initial version.</p></remark>
  </revision>
</header>
<section1 topic="Introduction" anchor="intro">
  <p>This protocol describes a way to communicate a user's last interaction time with other XMPP entities over &lt;presence/&gt; stanzas. For the purposes of this document, user interaction here refers to a human end user interacting with her device by means of a keyboard, mouse, touch screen, and so on. Based on this information XMPP clients can display the time a contact went idle or a duration for how long a contact has been idle, thereby allowing end users to estimate the expected responsiveness of their contacts.</p>
  <p>This protocol uses absolute timestamps formatted according to the DateTime profile of <span class="ref"><link url="https://xmpp.org/extensions/xep-0082.html">XMPP Date and Time Profiles (XEP-0082)</link></span> <note>XEP-0082: XMPP Date and Time Profiles &lt;<link url="https://xmpp.org/extensions/xep-0082.html">https://xmpp.org/extensions/xep-0082.html</link>&gt;.</note>, indicated as value of the 'since' attribute in the &lt;idle/&gt; element.</p>
  <p>Experience has shown a number of issues with <span class="ref"><link url="https://xmpp.org/extensions/xep-0256.html">Last Activity in Presence (XEP-0256)</link></span> <note>XEP-0256: Last Activity in Presence &lt;<link url="https://xmpp.org/extensions/xep-0256.html">https://xmpp.org/extensions/xep-0256.html</link>&gt;.</note>:</p>
  <ul>
    <li>The use of relative durations is too vague. It requires additional information from <span class="ref"><link url="https://xmpp.org/extensions/xep-0203.html">Delayed Delivery (XEP-0203)</link></span> <note>XEP-0203: Delayed Delivery &lt;<link url="https://xmpp.org/extensions/xep-0203.html">https://xmpp.org/extensions/xep-0203.html</link>&gt;.</note> to provide a reliable user experience.</li>
    <li>Distinguishing between the idle and last online use cases is very difficult.</li>
    <li>It is desirable to have idle time indiciated for &lt;presence/&gt; &lt;show/&gt; values other than "away" and "xa".</li>
  </ul>
  <p>Updating <span class="ref"><link url="https://xmpp.org/extensions/xep-0256.html">Last Activity in Presence (XEP-0256)</link></span> <note>XEP-0256: Last Activity in Presence &lt;<link url="https://xmpp.org/extensions/xep-0256.html">https://xmpp.org/extensions/xep-0256.html</link>&gt;.</note> directly would be problematic as it would break compatibility with existing implementations.  Instead a new protocol is described for handling the idle time use case; the last online use case is handled by <span class="ref"><link url="https://xmpp.org/extensions/xep-0312.html">PubSub Since (XEP-0312)</link></span> <note>XEP-0312: PubSub Since &lt;<link url="https://xmpp.org/extensions/xep-0312.html">https://xmpp.org/extensions/xep-0312.html</link>&gt;.</note>.</p>
</section1>
<section1 topic="Use Cases" anchor="usecases">
  <p>There are two main use cases for this extension, explained in more detail in the following sections.</p>
  <section2 topic="Presence with Last Interaction" anchor="last-interact">
  <p>After a user has not interacted with her device for some amount of time the user wants to inform her contacts about this fact. The client sends a &lt;presence/&gt; stanza with time of last interaction.</p>
  <example caption="Time of Last User Interaction in Auto-Away"><![CDATA[
<presence from='juliet@capulet.com/balcony'>
  <show>away</show>
  <idle xmlns='urn:xmpp:idle:1' since='1969-07-21T02:56:15Z'/>
</presence>
]]></example>
  <p>The amount of time the user has to be idle before a client sends this enhanced presence is application-specific; it is suggested that a sensible default interval of 5 minutes be used.</p>
  </section2>
  <section2 topic="Presence Indicating User Coming Back From Idle" anchor="back-from-idle">
    <p>When a user comes back and uses her device again the client informs user's contacts by sending a normal presence stanza like shown in the following example, omiting the &lt;idle/&gt; element.</p>
    <example caption="Presence Indicating Return to Device"><![CDATA[
<presence from='juliet@capulet.com/balcony' />
]]></example>
  </section2>
</section1>
<section1 topic="XML Schema" anchor="schema">
    <code><![CDATA[
<?xml version="1.0" encoding="utf-8"?>

<xs:schema
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    elementFormDefault="qualified"
    targetNamespace="urn:xmpp:idle:1"
    xmlns="urn:xmpp:idle:1">

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0319: http://www.xmpp.org/extensions/xep-0319.html
    </xs:documentation>
  </xs:annotation>

  <xs:element name="idle">
    <xs:complexType>
      <xs:attribute name="since" use="required" type="xs:dateTime"/>
    </xs:complexType>
  </xs:element>

</xs:schema>
]]></code>
</section1>
<section1 topic="Acknowledgements" anchor="ack">
  <p>Thanks to Florian Schmaus, Christian Schudt, and Lance Stout for their helpful comments.</p>
</section1>
<section1 topic="Security Considerations" anchor="security">
  <p>The security considerations of <span class="ref"><link url="https://xmpp.org/extensions/xep-0082.html">XMPP Date and Time Profiles (XEP-0082)</link></span> <note>XEP-0082: XMPP Date and Time Profiles &lt;<link url="https://xmpp.org/extensions/xep-0082.html">https://xmpp.org/extensions/xep-0082.html</link>&gt;.</note> apply to this protocol.</p>
  <p>This specification introduces no new security or privacy concerns. While including a last user interaction notation in &lt;presence/&gt; updates can enable recipients to determine exactly when a user has stopped interacting with her XMPP client or even their system, this information is in essence already available if the user's client publishes timely presence updates.</p>
</section1>
<section1 topic="IANA Considerations" anchor="iana">
  <p>This document requires no interaction with the <span class="ref"><link url="http://www.iana.org/">Internet Assigned Numbers Authority (IANA)</link></span> <note>The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see &lt;<link url="http://www.iana.org/">http://www.iana.org/</link>&gt;.</note>.</p>
</section1>
<section1 topic="XMPP Registrar Considerations" anchor="registrar">
  <section2 topic="Protocol Namespace">
    <p>The <span class="ref"><link url="https://xmpp.org/registrar/">XMPP Registrar</link></span> <note>The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see &lt;<link url="https://xmpp.org/registrar/">https://xmpp.org/registrar/</link>&gt;.</note> shall add 'urn:xmpp:idle:1' to its registry at <link url="http://xmpp.org/registrar/namespaces.html">http://xmpp.org/registrar/namespaces.html</link>.</p>
  </section2>
</section1>
</xep>
