<p>&xep0012; defines a method for determining the last time that an XMPP entity was active. This document specifies that an online client MAY include last activity information when sending a presence update. Including such information essentially means "when I sent this presence notification I had last been active at time T".</p>
<p>There are two primary use cases:</p>
<olstart='1'>
<li>When a client sends initial presence to start a presence session, the last activity notation indicates when that client terminated its previous presence session.</li>
<li>When a client changes from available to "away" or "xa", the last activity notation indicates when that client was last active during the current presence session.</li>
</ol>
<p>The following sections show examples of each use case.</p>
<p>When a client begins a presence session, it can indicate when that particular client was last online. It does this by sending initial presence with a last activity notation.</p>
<examplecaption='Last Indication in Initial Presence'><![CDATA[
<presencefrom='juliet@capulet.com/balcony'>
<queryxmlns='jabber:iq:last'seconds='86511'/>
</presence>
]]></example>
<p>This can be read as "I'm now online and I was last online at this client 24 hours and 111 seconds ago".</p>
</section2>
<section2topic='Away and Extended Away'anchor='away'>
<p>When a client automatically sets the user's &SHOW; value to "away" or "xa" (extended away), it can indicate when that particular was last active during the current presence session.</p>
<examplecaption='Last Indication in Auto-Away'><![CDATA[
<p>This can be read as "I just went away and I was last active 10 minutes ago".</p>
<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>
<examplecaption='Last Indication in Auto-Away With Delayed Delivery'><![CDATA[
<p>Including a last activity notation in presence notifications can enable those who receive such notifications to determine exactly when a user has stopped interacting with his or her XMPP client, but this information is in essence already available if the user publishes timely presence updates. Therefore, this specification introduces no new vulnerabilities.</p>