<?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>Extended Roster</title>
    <abstract>This document defines a way to handle extended roster items.</abstract>
    &LEGALNOTICE;
    <number>0057</number>
    <status>Retracted</status>
    <type>Standards Track</type>
    <sig>Standards</sig>
    <dependencies/>
    <supersedes/>
    <supersededby/>
    <shortname>None</shortname>
    <author>
      <firstname>Alexey</firstname>
      <surname>Shchepin</surname>
      <email>alexey@sevcom.net</email>
      <jid>aleksey@jabber.ru</jid>
    </author>
    <revision>
      <version>0.2</version>
      <date>2003-04-28</date>
      <initials>psa</initials>
      <remark>Changed the status to Retracted at the request of the author, since the proposed protocol was incompatible with XMPP and clients have begun using jabber:iq:private for this kind of functionality.</remark>
    </revision>
    <revision>
      <version>0.1</version>
      <date>2002-11-12</date>
      <initials>as</initials>
      <remark>Initial version.</remark>
    </revision>
  </header>

  <section1 topic="Introduction">
    <p>The main purpose of this document is to make roster not only a "contact list", but also a "list of useful items".  This means that the user has the ability to store not only users' JIDs, but any JID that he wants to quickly access with more information than just the name, subscription and roster groups.</p>
  </section1>

  <section1 topic="What we need to store">
    <p>All information, that can be stored for each item can be divided into three categories:</p>
    <ol>
      <li>Information necessary only for server-side.  E.g. we can have a server module that can process "visibility" to each user in roster (by sending custom presence to this user automatically, without special client-side support of this).</li>
      <li>Information, neccessary only for client-side.  E.g. user description of this item.</li>
      <li>Information for both sides.  This is at least the JID, category and type.</li>
    </ol>
  </section1>


  <section1 topic="Where to store">
    <p>Using <tt>jabber:iq:private</tt> as in &xep0048; for storing this information has one big problem: it is hard to mantain roster data in two separate places.  When a client is online, then the client application can handle <tt>jabber:iq:roster</tt> changes and make similar changes in private storage, but when the user is online with a few different resources, or when he is offline, then making the information consistent is very hard task (a roster can be changed when user offline, e.g. if someone is making an account transfer).</p>
    <p>But we have a place where this problem does not exist: <tt>jabber:iq:roster</tt>.  We can store it in <tt>&lt;item/&gt;</tt> subtags.  Existing server implementation MUST NOT remove <tt>&lt;x/&gt;</tt> tags from it.  In this case all information always relates to its JID and disappears when this JID removed.</p>
  </section1>

  <section1 topic="How to store">
    <section2 topic="General information">
      <p> JID, category and type are stored as attributes of <tt>&lt;item/&gt;</tt> tag.  Categories and types are the same as in disco.  Official categories and types associated with disco are administered by the &REGISTRAR; see &DISCOCATEGORIES;.</p>
      <example><![CDATA[<item jid="jdev@conference.jabber.org"
      category="conference"
      type="text">]]></example>
    </section2>
    <section2 topic="Server-side information">
      <p>This information is implementation-dependent, so to provide flexibility for it, the <tt>jabber:x:data</tt> namespace defined in &xep0004; must be used.  The client can set these parameters by setting this item with this form with <tt>type='submit'</tt>.</p>
      <example><![CDATA[<item jid="romeo@montague.net"
      name="Romeo"
      subscription="both">
  <x xmlns='jabber:x:data' type='form'>
    <field type='list-single' label='Visibility' var='visibility'>
      <value>visible</value>
      <option label='Normal'>
        <value>normal</value>
      </option>
      <option label='Always visible'>
        <value>visible</value>
      </option>
      <option label='Always invisible'>
        <value>invisible</value>
      </option>
    </field>
  </x>
  ...
</item>]]></example>
    </section2>
    <section2 topic="Client-side information">
      <p>This information stored in <tt>&lt;x/&gt;</tt> tag with namespace <tt>jabber:x:roster:item</tt>.  Following subtags can be used for diferent types of JIDs, however client applications can make this set bigger, to implement more functions.</p>
      <section3 topic="Generic JIDs">
	<p>
	  For all categories and types of JID allowed following subtag:
	</p>
	<ul>
	  <li>
	    <strong>desc</strong>: A description or note describing the JID.
	  </li>
	</ul>
      </section3>
      <section3 topic="Client JIDs">
        <p>For all JIDs with category=client allowed following subtags:</p>
        <ul>
          <li>
            <strong>always-visible</strong>, <strong>always-invisible</strong>:
            The client should send custom presence to this JID to be always
            visible or invisible to it.
          </li>
        </ul>
      </section3>
      <section3 topic="Conference JIDs">
	<p>
	  For all JIDs with category=conference allowed following subtags:
	</p>
	<ul>
	  <li>
	    <strong>nick</strong>: The nickname to be used when joining the
	    room.  If few such tags in one item, then first is used by default,
	    and others used if first not available.
	  </li>
	  <li>
	    <strong>password</strong>: The password to be used to joing the
	    room.
	  </li>
	  <li>
	    <strong>auto-join</strong>: The client should automatically join
	    this room once the user has been authenticated, and the roster have
	    been fetched.
	  </li>
	</ul>
      </section3>
      <example><![CDATA[<x xmlns="jabber:x:roster:item">
  <always-visible/>
  <desc>My old good friend</desc>
</x>]]></example>
    </section2>

    <section2 topic="Complete example">
    <example><![CDATA[<iq id="roster_1" type="result">
  <query xmlns="jabber:iq:roster">
    <item jid="romeo@montague.net"
  	name="Romeo"
        category="user"
  	type="client"
  	subscription="both">
      <x xmlns="jabber:x:roster:item">
        <always-visible/>
        <desc>bla bla bla</desc>
      </x>
      <x xmlns='jabber:x:data' type='form'>
        <field type='list-single' label='Visibility' var='visibility'>
          <value>visible</value>
          <option label='Normal'>
            <value>normal</value>
          </option>
          <option label='Always visible'>
            <value>visible</value>
          </option>
          <option label='Always invisible'>
            <value>invisible</value>
          </option>
        </field>
      </x>
    </item>
    <item jid="jdev@conference.jabber.org"
  	name="Developers Zone"
          category="conference"
  	type="text"
  	subscription="none">
      <x xmlns="jabber:x:roster:item">
        <password>bigsecret</password>
        <auto-join/>
        <nick>aleksey</nick>
        <nick>alexey</nick>
        <desc>Jabber developers talks</desc>
      </x>
    </item>
  </query>
</iq>]]> </example>

    </section2>
  </section1>

</xep>
