XEP-0108: User Activity

Abstract:This specification defines a payload format for communicating information about user activities, such as whether a person is currently working, travelling, or relaxing. The payload format is typically transported using the personal eventing protocol, a profile of XMPP publish-subscribe specified in XEP-0163.
Authors:Ralph Meijer, Peter Saint-Andre
Copyright:© 1999 - 2014 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status:Draft
Type:Standards Track
Version:1.3
Last Updated:2008-10-29

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.


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

Appendices
    A: Document Information
    B: Author Information
    C: Legal Notices
    D: Relation to XMPP
    E: Discussion Venue
    F: Requirements Conformance
    G: Notes
    H: 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>
    <tanning xmlns='http://www.ilovetanning.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

Activity information SHOULD be communicated and transported by means of the Publish-Subscribe (XEP-0060) [3] subset specified in Personal Eventing Protocol (XEP-0163) [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/>.

Example 1. User Publishes Activity

<iq type='set' 
    from='juliet@capulet.lit/ca486eba-0f9a-11dc-8835-000bcd821bfb'
    id='publish1'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='http://jabber.org/protocol/activity'>
      <item>
        <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='juliet@capulet.lit' 
    to='romeo@montague.lit'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/activity'>
      <item id='b5ac48d0-0f9c-11dc-8754-001143d5d5db'>
        <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>
    

In order to indicate that the user is no longer publishing activities, the user's client shall send an empty <activity/> element, which can be considered a "stop command" for user activities:

Example 3. User Disables Publishing

<iq from='juliet@capulet.lit/balcony'
    id='publish1'
    type='set'>
  <pubsub xmlns='http://jabber.org/protocol/pubsub'>
    <publish node='http://jabber.org/protocol/activity'>
      <item>
        <activity xmlns='http://jabber.org/protocol/activity'/>
      </item>
    </publish>
  </pubsub>
</iq>
    

Example 4. Empty Activity Information is Delivered to All Subscribers

<message 
    from='juliet@capulet.lit'
    to='romeo@montague.net'>
  <event xmlns='http://jabber.org/protocol/pubsub#event'>
    <items node='http://jabber.org/protocol/activity'>
      <item id='b5ac48d0-0f9c-11dc-8754-001143d5d5db'>
        <activity xmlns='http://jabber.org/protocol/activity'/>
      </item>
    </items>
  </event>
</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. [5]

4. Mapping to RPID

RFC 4480 [6] defines several extensions to the Presence Information Data Format (PIDF) [7] 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 [8]
busy [9]
holiday inactive scheduled_holiday
in-transit traveling [10]
meal eating [11]
meeting working in_a_meeting
on-the-phone talking on_the_phone
performance -- --
permanent-absence [12]
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) [14].

8. XMPP Registrar Considerations

8.1 Protocol Namespaces

The XMPP Registrar [15] 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 minOccurs='0'>
          <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='undefined' 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='dancing' 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='fishing' 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='hiding' 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='on_video_phone' type='specific'/>
        <xs:element name='other' type='specific'/>
        <xs:element name='partying' type='specific'/>
        <xs:element name='playing_sports' type='specific'/>
        <xs:element name='praying' 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='smoking' 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='thinking' type='specific'/>
        <xs:element name='walking' type='specific'/>
        <xs:element name='walking_the_dog' type='specific'/>
        <xs:element name='watching_a_movie' type='specific'/>
        <xs:element name='watching_tv' 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>
  

Appendices


Appendix A: Document Information

Series: XEP
Number: 0108
Publisher: XMPP Standards Foundation
Status: Draft
Type: Standards Track
Version: 1.3
Last Updated: 2008-10-29
Approving Body: XMPP Council
Dependencies: XMPP Core, XEP-0163
Supersedes: None
Superseded By: None
Short Name: activity
Schema: <http://www.xmpp.org/schemas/activity.xsd>
Source Control: HTML
This document in other formats: XML  PDF


Appendix B: Author Information

Ralph Meijer

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

Peter Saint-Andre

Email: stpeter@jabber.org
JabberID: stpeter@jabber.org
URI: https://stpeter.im/


Appendix C: Legal Notices

Copyright

This XMPP Extension Protocol is copyright © 1999 - 2014 by the XMPP Standards Foundation (XSF).

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.

Disclaimer of 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. ##

Limitation of 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.

IPR 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 <http://xmpp.org/about-xmpp/xsf/xsf-ipr-policy/> or obtained by writing to XMPP Standards Foundation, 1899 Wynkoop Street, Suite 600, Denver, CO 80202 USA).

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) 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.


Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <http://xmpp.org/about/discuss.shtml> for a complete list.

Errata can be sent to <editor@xmpp.org>.


Appendix F: Requirements Conformance

The following requirements 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".


Appendix G: Notes

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

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

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

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

5. 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. ;-)

6. RFC 4480: RPID: Rich Presence Extensions to the Presence Information Data Format (PIDF) <http://tools.ietf.org/html/rfc4480>.

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

8. 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).

9. 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.

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

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

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

13. RFC 6120: Extensible Messaging and Presence Protocol (XMPP): Core <http://tools.ietf.org/html/rfc6120>.

14. 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/>.

15. 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://xmpp.org/registrar/>.


Appendix H: Revision History

Note: Older versions of this specification might be available at http://xmpp.org/extensions/attic/

Version 1.3 (2008-10-29)

Allowed empty activity element to signify a pause in publishing; added undefined element to handle any unspecified activity; also added more activities: dancing, fishing, hiding, praying, smoking, thinking.

(psa)

Version 1.2 (2007-07-11)

Added on_video_phone activity.

(psa)

Version 1.1 (2007-06-04)

Corrected PEP examples.

(psa)

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