<?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>vCard Filtering</title>
  <abstract>This document specifies a mechanism for requesting specific sections of a vCard.</abstract>
  &LEGALNOTICE;
  <number>0164</number>
  <status>Deferred</status>
  <type>Standards Track</type>
  <sig>Standards</sig>
  <approver>Council</approver>
  <dependencies>
    <spec>XMPP Core</spec>
    <spec>XEP-0054</spec>
  </dependencies>
  <supersedes/>
  <supersededby/>
  <shortname>vcard-temp-filter</shortname>
  <author>
    <firstname>Daniel</firstname>
    <surname>Henninger</surname>
    <email>jadestorm@nc.rr.com</email>
    <jid>daniel@jabber.vorpalcloud.org</jid>
  </author>
  <revision>
    <version>0.1</version>
    <date>2005-11-16</date>
    <initials>psa</initials>
    <remark>Initial version.</remark>
  </revision>
  <revision>
    <version>0.0.2</version>
    <date>2005-11-05</date>
    <initials>dah</initials>
    <remark>Switched to filter out, instead of filter in.</remark>
  </revision>
  <revision>
    <version>0.0.1</version>
    <date>2005-10-22</date>
    <initials>dah</initials>
    <remark>First draft.</remark>
  </revision>
</header>
<section1 topic='Introduction' anchor='intro'>
  <p>Because XML vCards (see &xep0054;) are now actively used for storing avatars (see &xep0153;), the ability to retrieve only portions of a vCard has become desirable.  This protocol can eliminate unnecessary bandwidth usage when larger elements of a vCard are not needed.</p>
</section1>
<section1 topic='Requirements' anchor='reqs'>
  <p>Any entity supporting this extension MUST be prepared to accept more fields than were requested, in case the target does not support this extension.  A compliant target SHOULD exclude any fields listed in the filter element.  In the event that the filter element does not exist or is empty, the target MUST return the entire vCard as it would without this extension.</p>
</section1>
<section1 topic='Use Cases' anchor='usecases'>
  <section2 topic="Retrieving Another User's vCard Without The JABBERID Element">
    <p>To illustrate the functionality of this protocol, we will first request a standard vCard.  As shown in <cite>XEP-0054</cite>, a user may view another user's vCard by sending an IQ of type "get" to the other user's bare JID. A compliant server MUST return the vCard to the requestor and not forward the IQ to the requestee's connected resource.</p>
    <example caption="Requesting Another User's vCard"><![CDATA[
<iq to='jer@jabber.org'
    from='stpeter@jabber.org/home' 
    type='get'
    id='v1'>
  <vCard xmlns='vcard-temp'/>
</iq>
    ]]></example>
    <p>The server should then return the other user's vCard to the requestor:</p>
    <example caption="Receiving Another User's vCard"><![CDATA[
<iq from='jer@jabber.org' 
    to='stpeter@jabber.org/home' 
    type='result'
    id='v1'>
  <vCard xmlns='vcard-temp'>
    <FN>Jeremie Miller</FN>
    <N>
      <GIVEN>Jeremie</GIVEN>
      <FAMILY>Miller</FAMILY>
      <MIDDLE/>
    </N>
    <NICKNAME>jer</NICKNAME>
    <EMAIL><INTERNET/><PREF/><USERID>jeremie@jabber.org</USERID></EMAIL>
    <JABBERID>jer@jabber.org</JABBERID>
  </vCard>
</iq>
    ]]></example>
    <p>A user may request that specific portions of another user's vCard be excluded by including the requested field(s) inside a filter element qualified by the 'vcard-temp-filter' namespace, inside the vCard element.</p>
    <example caption="Requesting Another User's vCard Without the JABBERID Element"><![CDATA[
<iq to='jer@jabber.org'
    from='stpeter@jabber.org/home' 
    type='get'
    id='v2'>
  <vCard xmlns='vcard-temp'>
    <filter xmlns='vcard-temp-filter'>
       <JABBERID/>
    </filter>
  </vCard>
</iq>
    ]]></example>
    <p>The server should then return all available fields from the other user's vCard except for those listed in the filter stanza:</p>
    <example caption="Receiving Fields From Another User's vCard"><![CDATA[
<iq from='jer@jabber.org'
    to='stpeter@jabber.org/home'
    type='result'
    id='v2'>
  <vCard xmlns='vcard-temp'>
    <FN>JeremieMiller</FN>
    <N>
      <GIVEN>Jeremie</GIVEN>
      <FAMILY>Miller</FAMILY>
      <MIDDLE/>
    </N>
    <NICKNAME>jer</NICKNAME>
    <EMAIL><INTERNET/><PREF/><USERID>jeremie@jabber.org</USERID></EMAIL>
  </vCard>
</iq>
    ]]></example>
  </section2>
</section1>
<section1 topic='Security Considerations' anchor='security'>
  <p>This document introduces no new security concerns beyond those already involved in implementation and deployment of the 'vcard-temp' protocol.</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'>
  <p>The &REGISTRAR; shall add 'vcard-temp-filter' to its registry of official namespaces.</p>
</section1>
<section1 topic='XML Schema' anchor='schema'>
  <p>The schema for the 'vcard-temp-filter' namespace re-uses the element names from the DTD described in <cite>XEP-0054</cite>.</p>
  <code><![CDATA[
<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='vcard-temp-filter'
    xmlns='vcard-temp-filter'
    elementFormDefault='qualified'>

  <xs:element name='filter'>
    <xs:complexType>
      <xs:sequence>
        <xs:element name='VERSION' type='empty'/>
        <xs:element name='FN' type='empty'/>
        <xs:element name='N' type='empty'/>
        <xs:element name='NICKNAME' type='empty'/>
        <xs:element name='PHOTO' type='empty'/>
        <xs:element name='BDAY' type='empty'/>
        <xs:element name='ADR' type='empty'/>
        <xs:element name='LABEL' type='empty'/>
        <xs:element name='TEL' type='empty'/>
        <xs:element name='EMAIL' type='empty'/>
        <xs:element name='JABBERID' type='empty'/>
        <xs:element name='MAILER' type='empty'/>
        <xs:element name='TZ' type='empty'/>
        <xs:element name='GEO' type='empty'/>
        <xs:element name='TITLE' type='empty'/>
        <xs:element name='ROLE' type='empty'/>
        <xs:element name='LOGO' type='empty'/>
        <xs:element name='AGENT' type='empty'/>
        <xs:element name='ORG' type='empty'/>
        <xs:element name='CATEGORIES' type='empty'/>
        <xs:element name='NOTE' type='empty'/>
        <xs:element name='PRODID' type='empty'/>
        <xs:element name='REV' type='empty'/>
        <xs:element name='SORT-STRING' type='empty'/>
        <xs:element name='SOUND' type='empty'/>
        <xs:element name='UID' type='empty'/>
        <xs:element name='URL' type='empty'/>
        <xs:element name='CLASS' type='empty'/>
        <xs:element name='KEY' type='empty'/>
        <xs:element name='DESC' type='empty'/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>

  <xs:simpleType name='empty'>
    <xs:restriction base='xs:string'>
      <xs:enumeration value=''/>
    </xs:restriction>
  </xs:simpleType>

</xs:schema>
  ]]></code>
</section1>
</xep>
