<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type='text/xsl' href='xep.xsl'?>
<xep xmlns="">
<header>
  <title>vCard Filtering</title>
  <abstract>This document specifies a mechanism for requesting specific sections of a vCard.</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>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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0054.html">vcard-temp (XEP-0054)</link></span> <note>XEP-0054: vcard-temp &lt;<link url="https://xmpp.org/extensions/xep-0054.html">https://xmpp.org/extensions/xep-0054.html</link>&gt;.</note>) are now actively used for storing avatars (see <span class="ref"><link url="https://xmpp.org/extensions/xep-0153.html">vCard-Based Avatars (XEP-0153)</link></span> <note>XEP-0153: vCard-Based Avatars &lt;<link url="https://xmpp.org/extensions/xep-0153.html">https://xmpp.org/extensions/xep-0153.html</link>&gt;.</note>), 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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0054.html">vcard-temp (XEP-0054)</link></span> <note>XEP-0054: vcard-temp &lt;<link url="https://xmpp.org/extensions/xep-0054.html">https://xmpp.org/extensions/xep-0054.html</link>&gt;.</note>, 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 the <span class="ref"><link url="http://www.iana.org/">Internet Assigned Numbers Authority (IANA)</link></span> <note>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 &lt;<link url="http://www.iana.org/">http://www.iana.org/</link>&gt;.</note>.</p>
</section1>
<section1 topic="XMPP Registrar Considerations" anchor="registrar">
  <p>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> 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 <span class="ref"><link url="https://xmpp.org/extensions/xep-0054.html">vcard-temp (XEP-0054)</link></span> <note>XEP-0054: vcard-temp &lt;<link url="https://xmpp.org/extensions/xep-0054.html">https://xmpp.org/extensions/xep-0054.html</link>&gt;.</note>.</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>
