XEP-0108: User Activity

This document defines an XMPP protocol extension for communicating information about user activities.


NOTICE: The protocol defined herein is a Draft Standard of the XMPP Standards Foundation. Implementations are encouraged and the protocol is appropriate for deployment in production systems, but some changes to the protocol are possible before it becomes a Final Standard.


Document Information

Series: XEP
Number: 0108
Publisher: XMPP Standards Foundation
Status: Draft
Type: Standards Track
Version: 1.0
Last Updated: 2004-10-20
Approving Body: XMPP Council
Dependencies: XMPP Core, XEP-0060
Supersedes: None
Superseded By: None
Short Name: activity
Schema: <http://www.xmpp.org/schemas/activity/activity.xsd>
Wiki Page: <http://wiki.jabber.org/index.php/User Activity (XEP-0108)>

Author Information

Ralph Meijer

Email: ralphm@ik.nu
JabberID: ralphm@ik.nu

Peter Saint-Andre

Email: stpeter@jabber.org
JabberID: stpeter@jabber.org

Legal Notice

This XMPP Extension Protocol is copyright 1999 - 2007 by the XMPP Standards Foundation (XSF) and is in full conformance with the XSF's Intellectual Property Rights Policy <http://www.xmpp.org/extensions/ipr-policy.shtml>. This material may be distributed only subject to the terms and conditions set forth in the Creative Commons Attribution License (<http://creativecommons.org/licenses/by/2.5/>).

Discussion Venue

The preferred venue for discussion of this document is the Standards discussion list: <http://mail.jabber.org/mailman/listinfo/standards>.

Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 3920) and XMPP IM (RFC 3921) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Conformance Terms

The following keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".


Table of Contents


1. Introduction
2. Protocol
    2.1. Data Format
    2.2. Pubsub Transport
3. Activity Values
4. Mapping to RPID
5. Internationalization Considerations
6. Security Considerations
7. IANA Considerations
8. XMPP Registrar Considerations
    8.1. Protocol Namespaces
9. XML Schema
Notes
Revision History


1. Introduction

This document defines an extension mechanism for capturing "extended presence" data about user activities, above and beyond availability as defined in XMPP IM [1] (e.g., the 'away', 'extended away', and 'dnd' values of the <show/> child of the <presence/> stanza).

2. Protocol

2.1 Data Format

Information about user activities is provided by the user and propagated on the network by the user's client. The information is structured by means of an <activity/> element that is qualified by the 'http://jabber.org/protocol/activity' namespace. The general activity is provided as the element name of a first-level child of the <activity/> element (e.g., <relaxing/>); one such general activity element is REQUIRED. The general activity element MAY contain a child element that specifies a more particular form of the general activity (e.g., <partying/>). The user MAY also specify a natural-language description of the activity in the OPTIONAL <text/> child of the <activity/> element. Here is an example:

<activity xmlns='http://jabber.org/protocol/activity'>
  <relaxing>
    <partying/>
  </relaxing>
  <text xml:lang='en'>My nurse&apos;s birthday!</text>
</activity>
    

Instead of (but not in addition to) one of the specific activity elements defined herein, an application MAY include a properly-namespaced child element for the specific activity. Here is an example:

<activity xmlns='http://jabber.org/protocol/activity'>
  <relaxing>
    <fishing xmlns='http://www.ilovefishing.info'/>
  </relaxing>
</activity>
    

Finally, one of the specific activity elements defined herein MAY itself contain a properly-namespaced child element that provides more detailed information about the specific activity. Here is an example:

<activity xmlns='http://jabber.org/protocol/activity'>
  <inactive>
    <sleeping>
      <hibernating xmlns='http://www.ursus.info/states'/>
    </sleeping>
  </inactive>
</activity>
    

In accordance with XMPP Core [2], the receiving application MUST ignore a specific activity element or detailed activity element if it does not understand the namespace that qualifies the element.

2.2 Pubsub Transport

The <activity/> element SHOULD be communicated by means of Publish-Subscribe [3] or the subset of publish-subscribe specified in Personal Eventing via Pubsub [4]. Because activity information is not pure presence information and can change independently of the user's availability, it SHOULD NOT be provided as an extension to <presence/>.

Note: The following examples show use of the publish-subscribe subset specified in XEP-0163.

Example 1. User Publishes Activity

<iq type='set' 
    from='juliet@capulet.com/balcony' 
    to='pubsub.shakespeare.lit' 
    id='publish1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='http://jabber.org/protocol/activity'>
      <item id='zjsdf929la982873j'>
        <activity xmlns='http://jabber.org/protocol/activity'>
          <relaxing>
            <partying/>
          </relaxing>
          <text xml:lang='en'>My nurse&apos;s birthday!</text>
        </activity>
      </item>
    </publish>
  </pubsub>
</iq>
    

The activity is then delivered to all subscribers:

Example 2. Activity is Delivered to All Subscribers

<message 
    from='pubsub.shakespeare.lit' 
    to='romeo@montague.net/orchard'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/activity'>
      <item id='zjsdf929la982873j'>
        <activity xmlns='http://jabber.org/protocol/activity'>
          <relaxing>
            <partying/>
          </relaxing>
          <text xml:lang='en'>My nurse&apos;s birthday!</text>
        </activity>
      </item>
    </items>
  </event>
</message>
.
.
.
    

As mentioned in XEP-0060, the stanza containing the event notification or payload MAY also include 'replyto' data (as specified by the Extended Stanza Addressing [5] protocol) to provide an explicit association between the published data and the user:

Example 3. Event notification with extended stanza addressing

<message 
    from='pubsub.shakespeare.lit' 
    to='romeo@montague.net/orchard'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='generic/juliet-activity'>
      <item id='current'>
        <activity xmlns='http://jabber.org/protocol/activity'>
          <relaxing>
            <partying/>
          </relaxing>
          <text xml:lang='en'>My nurse&apos;s birthday!</text>
        </activity>
      </item>
    </items>
  </event>
  <addresses xmlns='http://jabber.org/protocol/address'>
    <address type='replyto' jid='juliet@capulet.com'/>
  </addresses>
</message>
    

3. Activity Values

Each activity has a REQUIRED general category and an OPTIONAL specific instance. One can understand each specifier as '[user] is [activity]' (e.g., 'Juliet is partying'), where the relevant value is the most specific activity provided (e.g., specifically "partying" rather than generally "relaxing").

The activity values defined in this taxonomy are as follows, where the first indentation level is the general category and the second indentation level is the specific instance. Note: The specific activity elements are RECOMMENDED as forms of the general activities shown below, but can be included under any general activity (e.g., "gardening" could be used as the specific activity under "relaxing" rather than "doing_chores").

In addition, the specific activity element can be <other/> in order to handle activities not defined herein. [6]

4. Mapping to RPID

RFC 4480 [7] defines several extensions to the Presence Information Data Format (PIDF) [8] for so-called "rich presence". One such extension is the <activity/> element (see Section 4.2), which "describes what the presentity is currently doing". The following table shows a mapping from the defined RPID activity values to the Jabber values defined herein.

Table 1: RPID-to-Jabber mappings

RPID <activity/> General activity element Specific activity element
appointment having_appointment --
away [9]
busy [10]
holiday inactive scheduled_holiday
in-transit traveling [11]
meal eating [12]
meeting working in_a_meeting
on-the-phone talking on_the_phone
performance -- --
permanent-absence [13]
sleeping inactive sleeping
steering traveling driving
travel traveling on_a_trip
vacation inactive on_vacation

The full range of activities defined herein is considerably richer than that defined in RPID; no mapping to RPID is provided by this specification for activity values that are not present in RPID, and any such mapping is the responsibility of a gateway between the two systems.

5. Internationalization Considerations

The XML character data values of the <text/> element are intended for presentation to human users; therefore, if a <text/> element is included the sending application SHOULD also ensure that the <text/> element or the parent <activity/> element possesses an 'xml:lang' attribute with an appropriate value.

6. Security Considerations

Because user activities may be published to a large number of pubsub subscribers, users should take care in approving subscribers and in characterizing their current activities.

7. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [15].

8. XMPP Registrar Considerations

8.1 Protocol Namespaces

The XMPP Registrar [16] includes 'http://jabber.org/protocol/activity' in its registry of protocol namespaces.

9. XML Schema

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='http://jabber.org/protocol/activity'
    xmlns='http://jabber.org/protocol/activity'
    elementFormDefault='qualified'>

  <xs:element name='activity'>
    <xs:complexType>
      <xs:sequence>
        <xs:choice>
          <xs:element name='doing_chores' type='general'/>
          <xs:element name='drinking' type='general'/>
          <xs:element name='eating' type='general'/>
          <xs:element name='exercising' type='general'/>
          <xs:element name='grooming' type='general'/>
          <xs:element name='having_appointment' type='general'/>
          <xs:element name='inactive' type='general'/>
          <xs:element name='relaxing' type='general'/>
          <xs:element name='talking' type='general'/>
          <xs:element name='traveling' type='general'/>
          <xs:element name='working' type='general'/>
        </xs:choice>
        <xs:element name='text' minOccurs='0' type='xs:string'/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:complexType name='general'>
    <xs:choice minOccurs='0'>
      <xs:choice minOccurs='0'>
        <xs:element name='at_the_spa' type='specific'/>
        <xs:element name='brushing_teeth' type='specific'/>
        <xs:element name='buying_groceries' type='specific'/>
        <xs:element name='cleaning' type='specific'/>
        <xs:element name='coding' type='specific'/>
        <xs:element name='commuting' type='specific'/>
        <xs:element name='cooking' type='specific'/>
        <xs:element name='cycling' type='specific'/>
        <xs:element name='day_off' type='specific'/>
        <xs:element name='doing_maintenance' type='specific'/>
        <xs:element name='doing_the_dishes' type='specific'/>
        <xs:element name='doing_the_laundry' type='specific'/>
        <xs:element name='driving' type='specific'/>
        <xs:element name='gaming' type='specific'/>
        <xs:element name='gardening' type='specific'/>
        <xs:element name='getting_a_haircut' type='specific'/>
        <xs:element name='going_out' type='specific'/>
        <xs:element name='hanging_out' type='specific'/>
        <xs:element name='having_a_beer' type='specific'/>
        <xs:element name='having_a_snack' type='specific'/>
        <xs:element name='having_breakfast' type='specific'/>
        <xs:element name='having_coffee' type='specific'/>
        <xs:element name='having_dinner' type='specific'/>
        <xs:element name='having_lunch' type='specific'/>
        <xs:element name='having_tea' type='specific'/>
        <xs:element name='hiking' type='specific'/>
        <xs:element name='in_a_car' type='specific'/>
        <xs:element name='in_a_meeting' type='specific'/>
        <xs:element name='in_real_life' type='specific'/>
        <xs:element name='jogging' type='specific'/>
        <xs:element name='on_a_bus' type='specific'/>
        <xs:element name='on_a_plane' type='specific'/>
        <xs:element name='on_a_train' type='specific'/>
        <xs:element name='on_a_trip' type='specific'/>
        <xs:element name='on_the_phone' type='specific'/>
        <xs:element name='on_vacation' type='specific'/>
        <xs:element name='other' type='specific'/>
        <xs:element name='partying' type='specific'/>
        <xs:element name='playing_sports' type='specific'/>
        <xs:element name='reading' type='specific'/>
        <xs:element name='rehearsing' type='specific'/>
        <xs:element name='running' type='specific'/>
        <xs:element name='running_an_errand' type='specific'/>
        <xs:element name='scheduled_holiday' type='specific'/>
        <xs:element name='shaving' type='specific'/>
        <xs:element name='shopping' type='specific'/>
        <xs:element name='skiing' type='specific'/>
        <xs:element name='sleeping' type='specific'/>
        <xs:element name='socializing' type='specific'/>
        <xs:element name='studying' type='specific'/>
        <xs:element name='sunbathing' type='specific'/>
        <xs:element name='swimming' type='specific'/>
        <xs:element name='taking_a_bath' type='specific'/>
        <xs:element name='taking_a_shower' type='specific'/>
        <xs:element name='walking' type='specific'/>
        <xs:element name='walking_the_dog' type='specific'/>
        <xs:element name='watching_tv' type='specific'/>
        <xs:element name='watching_a_movie' type='specific'/>
        <xs:element name='working_out' type='specific'/>
        <xs:element name='writing' type='specific'/>
      </xs:choice>
      <xs:any namespace='##other'/>
    </xs:choice>
  </xs:complexType>

  <xs:complexType name='specific'>
    <xs:sequence minOccurs='0'>
      <xs:any namespace='##other'/>
    </xs:sequence>
  </xs:complexType>

</xs:schema>
  

Notes

1. RFC 3921: Extensible Messaging and Presence Protocol (XMPP): Instant Messaging and Presence <http://tools.ietf.org/html/rfc3921>.

2. RFC 3920: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc3920>.

3. XEP-0060: Publish-Subscribe <http://www.xmpp.org/extensions/xep-0060.html>.

4. XEP-0163: Personal Eventing via Pubsub <http://www.xmpp.org/extensions/xep-0163.html>.

5. XEP-0033: Extended Stanza Addressing <http://www.xmpp.org/extensions/xep-0033.html>.

6. In the absence of a <text/> element, the recipient is free to draw whatever conclusions he or she may like regarding the nature of the "other" activity. Naturally, emoticons can be provided as the XML character data of the <text/> element. ;-)

7. RFC 4480: RPID: Rich Presence Extensions to the Presence Information Data Format (PIDF) <http://www.rfc-editor.org/rfc/rfc4480.txt>.

8. RFC 3863: Presence Information Data Format (PIDF) <http://tools.ietf.org/html/rfc3863>.

9. In XMPP, "away" is not an activity, but an availability state captured by means of a <presence/> stanza with a <show>away</show> child (see XMPP IM).

10. In XMPP, "busy" is not an activity, but an availability state captured by means of a <presence/> stanza with <show>dnd</show> child (see XMPP IM). Alternatively, the RPID "busy" activity could map to any number of more specific Jabber activities as defined herein.

11. Appropriate specific values in the "traveling" category would be "in_a_car", "on_a_bus", and "on_a_train".

12. The "eating" category can be further specified by "having_a_snack", "having_breakfast", "having_lunch", or "having_dinner".

13. In XMPP, "permanent absence" is not an activity, but instead would be sent to a contact via the <gone/> stanza error (see XMPP Core [14]).

14. RFC 3920: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc3920>.

15. 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 <http://www.iana.org/>.

16. 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 <http://www.xmpp.org/registrar/>.


Revision History

Version 1.0 (2004-10-20)

Per a vote of the Jabber Council, advanced status to Draft; per Council discussion, also adjusted structure to use nested elements rather than XML character data. (psa/rm)

Version 0.4 (2004-09-15)

Added internationalization considerations. (psa)

Version 0.3 (2004-04-25)

Corrected several errors; added reference to XEP-0033. (psa)

Version 0.2 (2004-02-19)

Minor text and schema changes; added RPID mapping. (psa)

Version 0.1 (2003-07-22)

Initial version. (rm)

END