Last Time Request

Jeremie Miller

The Jabber.org Project

414 DeLong St.
Cascade IA
52033
US
jeremie@jabber.org

01/25/2001


Introduction

It's often useful to know the "last" time of a particular jid. For a server or service, this time represents the number of seconds since it started, or server uptime. For a user account, this time represents the number of seconds since the user was last available, or when they last logged out. For a connected client, if supported by that client, it represents the number of seconds since there was user activity, or idle-time.


Server Uptime

Anyone can query the uptime of a server or any service.

Request:
  <iq type="get" to="jabber.org"><query xmlns='jabber:iq:last'/></iq>
Result:
  <iq type='result' from='jabber.org'><query xmlns='jabber:iq:last' seconds='78245'/></iq>

User Last-Logout

The same query, when sent to a user@host account, if supported by the server will return the number of seconds since the user logged out. It also includes the last-known unavailable status message. Clients should support the ability to send a "logout" or signoff message, which is the status of an unavailable presence sent before disconnecting. Not only is this broadcast to the subscriptions as a more descriptive logout action, but it is stored for future reference in the last namespace. This can be used for extended disconnects such as "Going on vacation, back on the 14th", or simple messages like "going home early today".

Request:
  <iq type="get" to="foo@jabber.org"><query xmlns='jabber:iq:last'/></iq>
Result:
  <iq type='result' from='foo@jabber.org'><query xmlns='jabber:iq:last' seconds='94315'>I'm gone for the weekend skiing!</query></iq> 

Client Idle Time

The same namespace may also be sent to clients, and if supported should return the number of seconds since there was user activity as detectable by that client.

Request:
  <iq type="get" to="foo@jabber.org/robojab"><query xmlns='jabber:iq:last'/></iq>
Result:
  <iq type='result' from='foo@jabber.org/robojab'><query xmlns='jabber:iq:last' seconds='634'/></iq>