<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE xep SYSTEM 'xep.dtd' [
  <!ENTITY % ents SYSTEM 'xep.ent'>
%ents;
]>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep>
<header>
  <title>User Activity</title>
  <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.</abstract>
  &LEGALNOTICE;
  <number>0108</number>
  <status>Draft</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XEP-0163</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>activity</shortname>
  <schemaloc>
    <url>http://www.xmpp.org/schemas/activity.xsd</url>
  </schemaloc>
  &ralphm;
  &stpeter;
  <revision>
    <version>1.3</version>
    <date>2008-10-29</date>
    <initials>psa</initials>
    <remark><p>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.</p></remark>
  </revision>
  <revision>
    <version>1.2</version>
    <date>2007-07-11</date>
    <initials>psa</initials>
    <remark><p>Added on_video_phone activity.</p></remark>
  </revision>
  <revision>
    <version>1.1</version>
    <date>2007-06-04</date>
    <initials>psa</initials>
    <remark><p>Corrected PEP examples.</p></remark>
  </revision>
  <revision>
    <version>1.0</version>
    <date>2004-10-20</date>
    <initials>psa/rm</initials>
    <remark><p>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.</p></remark>
  </revision>
  <revision>
    <version>0.4</version>
    <date>2004-09-15</date>
    <initials>psa</initials>
    <remark><p>Added internationalization considerations.</p></remark>
  </revision>
  <revision>
    <version>0.3</version>
    <date>2004-04-25</date>
    <initials>psa</initials>
    <remark><p>Corrected several errors; added reference to XEP-0033.</p></remark>
  </revision>
  <revision>
    <version>0.2</version>
    <date>2004-02-19</date>
    <initials>psa</initials>
    <remark><p>Minor text and schema changes; added RPID mapping.</p></remark>
  </revision>
  <revision>
    <version>0.1</version>
    <date>2003-07-22</date>
    <initials>rm</initials>
    <remark><p>Initial version.</p></remark>
  </revision>
</header>
<section1 topic='Introduction' anchor='intro'>
  <p>This document defines an extension mechanism for capturing "extended presence" data about user activities, above and beyond availability as defined in &xmppim; (e.g., the 'away', 'extended away', and 'dnd' values of the &lt;show/&gt; child of the &lt;presence/&gt; stanza).</p>
</section1>
<section1 topic='Protocol' anchor='proto'>
  <section2 topic='Data Format' anchor='proto-format'>
    <p>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 &lt;activity/&gt; 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 &lt;activity/&gt; element (e.g., &lt;relaxing/&gt;); 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., &lt;partying/&gt;). The user MAY also specify a natural-language description of the activity in the OPTIONAL &lt;text/&gt; child of the &lt;activity/&gt; element. Here is an example:</p>
    <code><![CDATA[
<activity xmlns='http://jabber.org/protocol/activity'>
  <relaxing>
    <partying/>
  </relaxing>
  <text xml:lang='en'>My nurse&apos;s birthday!</text>
</activity>
]]></code>
    <p>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:</p>
    <code><![CDATA[
<activity xmlns='http://jabber.org/protocol/activity'>
  <relaxing>
    <tanning xmlns='http://www.ilovetanning.info'/>
  </relaxing>
</activity>
]]></code>
    <p>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:</p>
    <code><![CDATA[
<activity xmlns='http://jabber.org/protocol/activity'>
  <inactive>
    <sleeping>
      <hibernating xmlns='http://www.ursus.info/states'/>
    </sleeping>
  </inactive>
</activity>
]]></code>
    <p>In accordance with &xmppcore;, the receiving application MUST ignore a specific activity element or detailed activity element if it does not understand the namespace that qualifies the element.</p>
  </section2>
  <section2 topic='Pubsub Transport' anchor='proto-pubsub'>
    <p>Activity information SHOULD be communicated and transported by means of the &xep0060; subset specified in &xep0163;. 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;.</p>
  <example caption='User Publishes Activity'><![CDATA[
<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>
]]></example>
    <p>The activity is then delivered to all subscribers:</p>
    <example caption='Activity is Delivered to All Subscribers'><![CDATA[
<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>
]]></example>
    <p>In order to indicate that the user is no longer publishing activities, the user's client shall send an empty &lt;activity/&gt; element, which can be considered a "stop command" for user activities:</p>
    <example caption='User Disables Publishing'><![CDATA[
<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>
    <example caption='Empty Activity Information is Delivered to All Subscribers'><![CDATA[
<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>
]]></example>
  </section2>
</section1>
<section1 topic='Activity Values' anchor='activities'>
  <p>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").</p>
  <p>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").</p>

  <ul>

    <li>doing_chores
      <ul>
        <li>buying_groceries</li>
        <li>cleaning</li>
        <li>cooking</li>
        <li>doing_maintenance</li>
        <li>doing_the_dishes</li>
        <li>doing_the_laundry</li>
        <li>gardening</li>
        <li>running_an_errand</li>
        <li>walking_the_dog</li>
      </ul>
    </li>

    <li>drinking
      <ul>
        <li>having_a_beer</li>
        <li>having_coffee</li>
        <li>having_tea</li>
      </ul>
    </li>

    <li>eating
      <ul>
        <li>having_a_snack</li>
        <li>having_breakfast</li>
        <li>having_dinner</li>
        <li>having_lunch</li>
      </ul>
    </li>

    <li>exercising
      <ul>
        <li>cycling</li>
        <li>dancing</li>
        <li>hiking</li>
        <li>jogging</li>
        <li>playing_sports</li>
        <li>running</li>
        <li>skiing</li>
        <li>swimming</li>
        <li>working_out</li>
      </ul>
    </li>

    <li>grooming
      <ul>
        <li>at_the_spa</li>
        <li>brushing_teeth</li>
        <li>getting_a_haircut</li>
        <li>shaving</li>
        <li>taking_a_bath</li>
        <li>taking_a_shower</li>
      </ul>
    </li>

    <li>having_appointment</li>

    <li>inactive
      <ul>
        <li>day_off</li>
        <li>hanging_out</li>
        <li>hiding</li>
        <li>on_vacation</li>
        <li>praying</li>
        <li>scheduled_holiday</li>
        <li>sleeping</li>
        <li>thinking</li>
      </ul>
    </li>

    <li>relaxing
      <ul>
        <li>fishing</li>
        <li>gaming</li>
        <li>going_out</li>
        <li>partying</li>
        <li>reading</li>
        <li>rehearsing</li>
        <li>shopping</li>
        <li>smoking</li>
        <li>socializing</li>
        <li>sunbathing</li>
        <li>watching_tv</li>
        <li>watching_a_movie</li>
      </ul>
    </li>

    <li>talking
      <ul>
        <li>in_real_life</li>
        <li>on_the_phone</li>
        <li>on_video_phone</li>
      </ul>
    </li>

    <li>traveling
      <ul>
        <li>commuting</li>
        <li>cycling</li>
        <li>driving</li>
        <li>in_a_car</li>
        <li>on_a_bus</li>
        <li>on_a_plane</li>
        <li>on_a_train</li>
        <li>on_a_trip</li>
        <li>walking</li>
      </ul>
    </li>

    <li>working
      <ul>
        <li>coding</li>
        <li>in_a_meeting</li>
        <li>studying</li>
        <li>writing</li>
      </ul>
    </li>

  </ul>

  <p>In addition, the specific activity element can be &lt;other/&gt; in order to handle activities not defined herein. <note>In the absence of a &lt;text/&gt; 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 &lt;text/&gt; element. ;-)</note></p>

</section1>
<section1 topic='Mapping to RPID' anchor='rpid-mapping'>
  <p>&rfc4480; defines several extensions to the &pidf; for so-called "rich presence". One such extension is the &lt;activity/&gt; 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.</p>
  <table caption='RPID-to-Jabber mappings'>
    <tr>
      <th>RPID &lt;activity/&gt;</th>
      <th>General activity element</th>
      <th>Specific activity element</th>
    </tr>
    <tr>
      <td>appointment</td>
      <td align='center'>having_appointment</td>
      <td align='center'>--</td>
    </tr>
    <tr>
      <td>away</td>
      <td colspan='2' align='center'><note>In XMPP, "away" is not an activity, but an availability state captured by means of a &lt;presence/&gt; stanza with a &lt;show&gt;away&lt;/show&gt; child (see <cite>XMPP IM</cite>).</note></td>
    </tr>
    <tr>
      <td>busy</td>
      <td colspan='2' align='center'><note>In XMPP, "busy" is not an activity, but an availability state captured by means of a &lt;presence/&gt; stanza with &lt;show&gt;dnd&lt;/show&gt; child (see <cite>XMPP IM</cite>). Alternatively, the RPID "busy" activity could map to any number of more specific Jabber activities as defined herein.</note></td>
    </tr>
    <tr>
      <td>holiday</td>
      <td align='center'>inactive</td>
      <td align='center'>scheduled_holiday</td>
    </tr>
    <tr>
      <td>in-transit</td>
      <td align='center'>traveling</td>
      <td align='center'><note>Appropriate specific values in the "traveling" category would be "in_a_car", "on_a_bus", and "on_a_train".</note></td>
    </tr>
    <tr>
      <td>meal</td>
      <td align='center'>eating</td>
      <td align='center'><note>The "eating" category can be further specified by "having_a_snack", "having_breakfast", "having_lunch", or "having_dinner".</note></td>
    </tr>
    <tr>
      <td>meeting</td>
      <td align='center'>working</td>
      <td align='center'>in_a_meeting</td>
    </tr>
    <tr>
      <td>on-the-phone</td>
      <td align='center'>talking</td>
      <td align='center'>on_the_phone</td>
    </tr>
    <tr>
      <td>performance</td>
      <td align='center'>--</td>
      <td align='center'>--</td>
    </tr>
    <tr>
      <td>permanent-absence</td>
      <td colspan='2' align='center'><note>In XMPP, "permanent absence" is not an activity, but instead would be sent to a contact via the &lt;gone/&gt; stanza error (see &xmppcore;).</note></td>
    </tr>
    <tr>
      <td>sleeping</td>
      <td align='center'>inactive</td>
      <td align='center'>sleeping</td>
    </tr>
    <tr>
      <td>steering</td>
      <td align='center'>traveling</td>
      <td align='center'>driving</td>
    </tr>
    <tr>
      <td>travel</td>
      <td align='center'>traveling</td>
      <td align='center'>on_a_trip</td>
    </tr>
    <tr>
      <td>vacation</td>
      <td align='center'>inactive</td>
      <td align='center'>on_vacation</td>
    </tr>
  </table>
  <p>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.</p>
</section1>
<section1 topic='Internationalization Considerations' anchor='i18n'>
  <p>The XML character data values of the &lt;text/&gt; element are intended for presentation to human users; therefore, if a &lt;text/&gt; element is included the sending application SHOULD also ensure that the &lt;text/&gt; element or the parent &lt;activity/&gt; element possesses an 'xml:lang' attribute with an appropriate value.</p>
</section1>
<section1 topic='Security Considerations' anchor='security'>
  <p>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.</p>
</section1>
<section1 topic='IANA Considerations' anchor='iana'>
  <p>This document requires no interaction with &IANA;.</p>
</section1>
<section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
    <p>The &REGISTRAR; includes 'http://jabber.org/protocol/activity' in its registry of protocol namespaces.</p>
  </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'
    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>
]]></code>
</section1>
</xep>
