<?xml version="1.0"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
  <!ENTITY rfc2119 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml'>
  <!ENTITY rfc3501 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.3501.xml'>
  <!ENTITY rfc4315 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.4315.xml'>
  <!ENTITY rfc5256 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.5256.xml'>
  <!ENTITY rfc7162 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7162.xml'>
  <!ENTITY rfc8174 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml'>
  <!ENTITY rfc9051 PUBLIC '' 'https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9051.xml'>
    
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt"?>
<rfc category="std" ipr="pre5378Trust200902" docName="draft-ietf-extra-imap-uidonly-01">
	<?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="2023"/>
		<abstract>

			<t>The UIDONLY extension to the Internet Message Access Protocol (RFC 3501/RFC 9051)
			allows clients to enable a mode in which information
      about mailbox changes is returned using only UIDs.
      Message numbers are not returned in responses,
      and can't be used in requests 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.
      <!--Bron's version:
      This allows both clients and servers to avoid requiring resources to maintain a map between message numbers and UIDs.
      -->
      </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>

      <t>
      Other capitalised words are names of IMAP commands or responses <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>
        Once the UIDONLY extension is enabled <xref target="enabling"/>,
        the client MUST NOT use message sequence numbers (including the special marker "*")
        in any arguments to IMAP commands, and the server MUST return tagged BAD response
        if the client uses message sequence numbers.
        Additionally, once the UIDONLY extension is enabled <xref target="enabling"/>,
        the server MUST NOT return message sequence numbers in any response.
        </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" anchor="enabling">

      <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/COPY/MOVE">

          <t>When UIDONLY is enabled, FETCH, STORE, SEARCH, COPY and MOVE commands are prohibited
          and MUST result in a tagged BAD response. Clients should instead use UID FETCH,
          UID STORE, UID SEARCH, UID COPY or UID MOVE 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.
          <!--///Bron thinks that the following should be changed: either return UID when requested or disallow it.-->
          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 (but allowed) 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 UID SEARCH">

          <t>The "&lt;sequence set&gt;" UID SEARCH criterion is prohibited (and results in tagged BAD response) once UIDONLY is enabled.
          Clients should use ALL or "UID &lt;sequence set&gt;" UID SEARCH criterion instead.</t>

        </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?-->

        </section>

        <section title="Interaction with CONDSTORE and QRESYNC extensions">

          <t>
          CONDSTORE extension is compatible with the UIDONLY extension.
          The MODSEQ message data item is returned in UIDFETCH responses instead of FETCH responses.
          </t>

          <t>
          QRESYNC extension is compatible with the UIDONLY extension, but once UIDONLY is enabled,
          the fourth SELECT QRESYNC parameter ("Message Sequence Match Data", see Section 3.2.5.2 of <xref target="RFC7162"/>)
          MUST NOT be used. The server MUST return a tagged BAD response if such parameter is observed once UIDONLY is enabled.
          </t>

        </section>

        <section title="Interaction with other extensions">
          
          <t>IMAP extensions might define other commands that accept message sequence numbers ("sequence-set" ABNF non terminal)
          Once UIDONLY is enabled, server MUST reject such commands with tagged BAD response.
          
          For example, SORT and THREAD <xref target="RFC5256"/> commands are prohibited, similarly to the SEARCH command.
          However UID SORT and UID THREAD can be used instead.
          </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
      this registry with [RFCXXXX] as the reference.
      </t>

      </section>

    </section>

    <section title="Acknowledgments">

      <t>
      Editor of this document would like to thank the following people
      who provided useful comments and/or participated in discussions that
      lead to this document, in particular: Arnt Gulbrandsen and Bron Gondwana.
      </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;
      &rfc5256;
      &rfc7162;
      &rfc9051;

    </references>

<!--
    <references title="Informative References">
    </references>
  -->

	</back>
</rfc>
