<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
  <!ENTITY rfc2119 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'>
  <!ENTITY rfc3501 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.3501.xml'>
  <!ENTITY rfc4315 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.4315.xml'>
  <!ENTITY rfc7162 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.7162.xml'>
  <!ENTITY rfc8174 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml'>
  <!ENTITY rfc9051 PUBLIC '' 'http://xml.resource.org/public/rfc/bibxml/reference.RFC.9051.xml'>
    
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt"?>
<rfc category="std" ipr="pre5378Trust200902" docName="draft-melnikov-imap-uidonly-00">
	<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
	<?rfc toc="yes" ?>
	<?rfc symrefs="yes" ?>
	<?rfc sortrefs="yes"?>
	<?rfc iprnotified="no" ?>
	<?rfc strict="yes" ?>
	<?rfc comments="yes" ?>
	<?rfc inline="yes" ?>
	<?rfc compact="yes"?>
	<?rfc subcompact="no"?>
	<front>
		<title abbrev="IMAP UIDONLY">
      IMAP Extension for only using and returning UIDs
    </title>
		<author initials="A." surname="Melnikov" fullname="Alexey Melnikov">
			<organization abbrev="Isode">
				Isode Limited
			</organization>
			<address>
				<email>alexey.melnikov@isode.com</email>
				<uri>https://www.isode.com</uri>
			</address>
		</author>

    <author initials="A. P." surname="Achuthan" fullname="Arun Prakash Achuthan">
      <organization abbrev="Yahoo!">
        Yahoo Inc.
      </organization>
      <address>
        <email>arunprakash@myyahoo.com</email>
      </address>
    </author>

    <author initials="V." surname="Nagulakonda" fullname="Vikram Nagulakonda">
      <organization abbrev="Yahoo!">
        Yahoo Inc.
      </organization>
      <address>
        <email>nvikram_imap@yahoo.com</email>
      </address>
    </author>

    <author initials="A." surname="Singh" fullname="Ashutosh Singh">
      <organization abbrev="Yahoo!">
        Yahoo Inc.
      </organization>
      <address>
        <email>ashutoshvsingh@yahoo.com</email>
      </address>
    </author>

    <author initials="L." surname="Alves" fullname="Luis Alves">
      <address>
        <email>luis.alves@lafaspot.com</email>
      </address>
    </author>

    <date year="2022"/>
		<abstract>
			<t>The UIDONLY extension of the Internet Message Access Protocol (RFC 3501/RFC 9051)
			allows clients to request that all information about mailbox changes is returned only using UIDs.
      Message numbers are not going to be returned and can't be used once this extension is enabled.
      <!--///Does this really help clients?-->
      This helps both clients and servers to reduce resource usage required for maintenance of message number to UID map.
      </t>
      
    </abstract>
	</front>
	<middle>
    
        <section title="Introduction and Overview">

      <t>This document defines an extension to the Internet Message Access Protocol <xref target="RFC3501"/>
      for eliminating use of message numbers.
      This extension is compatible with both IMAP4rev1 <xref target="RFC3501"/> and IMAP4rev2 <xref target="RFC9051"/>.</t>

      <t>
      The UIDONLY extension of the Internet Message Access Protocol (RFC 3501/RFC 9051)
      allows clients to request that servers only use and return UIDs.
      This helps both clients and servers to reduce resource usage required for maintenance of message number to UID map.
      </t>

      <t>IMPLEMENTATION NOTE: this document is not yet at the state where it is implementable. Please contact document
      authors if you want to experiment with implementing UIDONLY.</t>

        </section>

		<section title="Document Conventions">
			<t>In protocol examples, this document uses a prefix of "C: " to denote lines sent by the client to the server, and
			"S: " for lines sent by the server to the client. Lines prefixed with "// " are comments explaining the previous protocol line.
			These prefixes and comments are not part of the protocol. Lines without any of these prefixes are continuations of the previous line,
			and no line break is present in the protocol unless specifically mentioned.</t>
      
			<t>
            The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
            "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and
            "OPTIONAL" in this document are to be interpreted as described in BCP
            14 <xref target="RFC2119"/> <xref target="RFC8174"/>
            when, and only when, they appear in all capitals, as shown here.
            </t>

      <!--///Confusion: IMAP keyword is something else. Use "Protocol elements" instead?-->
            <t>Other capitalised words are IMAP keywords <xref target="RFC3501"/><xref target="RFC9051"/>
            or keywords from this document.</t>
      
		</section>

    <section title="The UIDONLY extension" anchor="imap-uidonly">

        <t>An IMAP server advertises support for the UIDONLY extension
        by including the "UIDONLY" capability in the CAPABILITY response/response code.</t>

        <t>The UIDONLY extension affects how information about new, expunged
        or changed messages is returned in unsolicited responses. In partucular,
        it affects responses to UID FETCH/UID STORE/EXPUNGE/UID EXPUNGE,
        as well as how unsolicited mailbox changes are announced.
        </t>
      
<!--/////Do we need a response code for "UID expected"?-->  
        
        <t>The following subsections describe changes introduced by this extension
        in more details.</t>
        
      <section title="Enabling UIDONLY extension">

      <t>
      As the UIDONLY extension affects how information about new, expunged
      or changed messages is returned in unsolicited responses, it has to be
      enabled by the client first using the ENABLE command.
      </t>

<figure><artwork><![CDATA[
  S: * OK [CAPABILITY IMAP4rev1 ENABLE CONDSTORE QRESYNC UIDONLY AUTH=SCRAM-SHA-256]
  C: 01 ENABLE UIDONLY
  S: * ENABLED UIDONLY
  S: 01 OK ENABLE completed
]]></artwork></figure>
      
        </section>


        <section title="Changes to FETCH/STORE/SEARCH">

          <t><cref>Is this Ok or is this too restrictive? Should COPY/MOVE be restricted in the same way?</cref></t>

          <t>When UIDONLY is enabled, FETCH, STORE and SEARCH commands are prohibited
          and MUST result in a tagged BAD response. Clients should instead use UID FETCH,
          UID STORE and UID SEARCH respectively.</t>

        </section>


        <section title="Changes to UID FETCH/UID STORE">

          <t>When UIDONLY is enabled, all FETCH responses that would be returned by UID FETCH/UID STORE
          are replaced by UIDFETCH responses.</t>

          <t>Note that UIDFETCH response contains the same FETCH response data items, except
          the UID, which is returned differently at the beginning of a UIDFETCH response.
          Requesting UID FETCH data item is not an error and this is just ignored.</t>

<figure><artwork><![CDATA[
  C: 10 UID FETCH 25900:26600 (FLAGS)
  [...]
  S: * 25996 UIDFETCH (FLAGS (\Seen))
  S: * 25997 UIDFETCH (FLAGS (\Flagged \Answered))
  S: * 26600 UIDFETCH (FLAGS ())
  S: 10 OK FETCH completed
]]></artwork></figure>
      
<figure><artwork><![CDATA[
  C: 11 UID FETCH 25900:26600 (UID FLAGS)
  S: * 25900 UIDFETCH (FLAGS (\Seen))
  S: * 25902 UIDFETCH (FLAGS (\Flagged))
  S: * 26310 UIDFETCH (FLAGS (\Answered))
  S: * 26311 UIDFETCH (FLAGS ())
  S: * 26498 UIDFETCH (FLAGS (\Answered))
  [...]
  S: 11 OK FETCH completed
]]></artwork></figure>

        </section>

        <section title="Changes to EXPUNGE/UID EXPUNGE">

          <t>When UIDONLY is enabled, all EXPUNGED responses that would be returned by EXPUNGE/UID EXPUNGE
          are replaced by VANISHED responses, as defined in <xref target="RFC7162"/>. Note that a server
          that implements UIDONLY extension is not required to also implement CONDSTORE and/or QRESYNC extensions.</t>

<figure><artwork><![CDATA[
  C: 12 EXPUNGE
  S: * VANISHED 405,407,410,425
  S: 12 OK expunged
]]></artwork></figure>

        </section>

        <section title="Changes to how other mailbox changes are announced">

          <t>When UIDONLY is enabled, all changes to flags (and other dynamic message attributes)
          are returned using UIDFETCH responses, instead of FETCH responses.</t>

          <t>Similarly, all expunged messages are announced using VANISHED responses
          instead of EXPUNGE responses.</t>
          
          <t>UID MOVE/UID COPY commands SHOULD return COPYUID response code, as specified in <xref target="RFC4315"/>.
          </t>

          <t>Use of UIDNOTSTICKY response code (see <xref target="RFC4315"/>) is not compatible with the UIDONLY extension.
          I.e. a server that advertises UIDONLY extension MUST NOT return UIDNOTSTICKY response code.</t>

          <!--/////Add an example of UID MOVE with VANISHED?-->

          <t><cref>Also need to think about interaction with CONDSTORE/QRESYNC in more details.
          CONDSTORE is compatible with UIDONLY, but QRESYNC might not be, due to existence
          of message numbers in SELECT QRESYNC.</cref></t>

        </section>

      </section>

    <section title="Formal syntax">
			<t>The following syntax specification uses the Augmented Backus-Naur Form (ABNF) notation as specified in <xref target="ABNF"/>.</t>
			<t>Non-terminals referenced but not defined below are as defined by <xref target="RFC3501">IMAP4</xref>.</t>
			<t>Except as noted otherwise, all alphabetic characters are case-insensitive.  The use of upper or lower case characters to define token strings is for editorial clarity only.  Implementations MUST accept these strings in a case-insensitive fashion.</t>

<figure><artwork>
      <![CDATA[
SP                  = <Defined in RFC 5234>

capability          =/ "UIDONLY"
                       ;; <capability> from [RFC3501]

message-data        =/ uidfetch-resp

uidfetch-resp       = uniqueid SP "UIDFETCH" SP msg-att
                      ;; UID msg-att is never used. It is replaced by the uniqueid
                      ;; at the beginning of the UIDFETCH response

message-data        =/ expunged-resp

expunged-resp       = <defines VANISHED response, see RFC 7162>
]]></artwork></figure>
      
		</section>

    
    
    
    
		<section title="Security Considerations">

			<t>
      TBD.
			</t>

		</section>
		
    
    
    
    
		<section title="IANA Considerations">
      
      <section title="Changes/additions to the IMAP4 capabilities registry">
        
			<t>
				IMAP4 capabilities are registered by publishing a standards track or
				IESG approved Informational or Experimental RFC.
        The registry is currently located at:
			</t>

			<figure><artwork><![CDATA[
   https://www.iana.org/assignments/imap4-capabilities
    ]]></artwork></figure>

			<t>IANA is requested to add definition of the UIDONLY extension to
			point to this document.
      </t>

      </section>

    </section>

    <section title="Acknowledgments">

      <t>TBD.</t>

      <!--
			<t>
				Editor of this document would like to thank the following people
				who provided useful comments or participated in discussions that
				lead to this update to RFC 2087:<vspace/>
			    John Myers,<vspace/>
			    Cyrus Daboo,<vspace/>
			    Lyndon Nerenberg,
          Éric Vyncke.
			</t>
      -->

		</section>
		
	</middle>
	<back>
		<references title="Normative References">
			&rfc2119;
      &rfc8174;
      &rfc3501;
      <reference anchor="ABNF">
				<front>
					<title>Augmented BNF for Syntax Specifications: ABNF</title>
					<author initials="D" surname="Crocker" fullname="Dave Crocker" role="editor">
						<organization />
					</author>
					<author initials="P" surname="Overell" fullname="Paul Overell" role="editor">
						<organization />
					</author>
					<date year="2008" month="January"/>
				</front>
				<seriesInfo name="RFC" value="5234" />
				<format type="TXT" target="https://www.rfc-editor.org/info/rfc5234" />
			</reference>

      &rfc4315;
      &rfc7162;
      &rfc9051;

    </references>

<!--
    <references title="Informative References">
    </references>
  -->

	</back>
</rfc>
