<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="xep.xsl"?>
<xep xmlns="">
  <header>
    <title>Extended Roster</title>
    <abstract>This document defines a way to handle extended roster items.</abstract>
    
<legal>
<copyright>This XMPP Extension Protocol is copyright © 1999 – 2024 by the <link url="https://xmpp.org/">XMPP Standards Foundation</link> (XSF).</copyright>
<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.</permissions>
<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. ##</warranty>
<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.</liability>
<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 &lt;<link url="https://xmpp.org/about/xsf/ipr-policy">https://xmpp.org/about/xsf/ipr-policy</link>&gt; or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).</conformance>
</legal>
    <number>0057</number>
    <status>Retracted</status>
    <type>Standards Track</type>
    <sig>Standards</sig>
    <approver>Council</approver>
    <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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0048.html">Bookmark Storage (XEP-0048)</link></span> <note>XEP-0048: Bookmark Storage &lt;<link url="https://xmpp.org/extensions/xep-0048.html">https://xmpp.org/extensions/xep-0048.html</link>&gt;.</note> 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 <span class="ref"><link url="https://xmpp.org/registrar/">XMPP Registrar</link></span> <note>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 &lt;<link url="https://xmpp.org/registrar/">https://xmpp.org/registrar/</link>&gt;.</note> see &lt;<link url="https://xmpp.org/registrar/disco-categories.html">https://xmpp.org/registrar/disco-categories.html</link>&gt;.</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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0004.html">Data Forms (XEP-0004)</link></span> <note>XEP-0004: Data Forms &lt;<link url="https://xmpp.org/extensions/xep-0004.html">https://xmpp.org/extensions/xep-0004.html</link>&gt;.</note> 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>
