<?xml version="1.0" encoding="US-ASCII"?>

<!DOCTYPE rfc SYSTEM "rfc2629.dtd">

<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<?rfc strict="yes" ?>
<?rfc toc="yes"?>
<?rfc tocdepth="4"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes" ?>
<?rfc compact="yes" ?>
<?rfc subcompact="no" ?>

<rfc category="std" docName="draft-bosch-imap-status-size-00" ipr="trust200902">
<!-- ***** FRONT MATTER ***** -->

<front>
<title abbrev="IMAP - STATUS=SIZE Extension">
Internet Message Access Protocol (IMAP) - STATUS=SIZE Extension
</title>

<author fullname="Stephan Bosch" initials="S." surname="Bosch">
	<organization>Dovecot Oy</organization>
  <address>
    <postal>
      <street>Lars Sonckin Kaari 10</street>
      <code>02600</code>
      <city>Espoo</city>
      <country>Finland</country>
    </postal>
    <email>stephan.bosch@dovecot.fi</email>
  </address>
</author>

<date/>

<area>General</area>
<!--<workgroup>APPSAWG</workgroup>-->
<keyword>imap</keyword>
<keyword>status</keyword>
<keyword>size</keyword>

<abstract>
<t>This document adds a new capability called "STATUS=SIZE" to the Internet
Message Access Protocol (IMAP). It allows retrieving the total storage size of a
mailbox with a single STATUS command rather than retrieving and summing the
sizes of all individual messages in that mailbox.
</t>
</abstract>
</front>

<middle>

<section title="Introduction">
<t>This document extends Internet Message Access Protocol
(IMAP) <xref target="IMAP4rev1"/> with a new capability called "STATUS=SIZE".
To determine the total storage size of a mailbox, an IMAP client currently needs
to retrieve all message sizes individually using the FETCH command with the
RFC822.SIZE data item. The "STATUS=SIZE" capability provides a more efficient
means to achieve this. It extends the STATUS command with a new "SIZE" data
item, which indicates the total size of all messages in the target mailbox.
This way, this information can be queried with just one STATUS command. When the
"LIST-STATUS" IMAP capability <xref target="LIST-STATUS"/> is also available,
the SIZE data item can be queried for many mailboxes at once using just one LIST
command.</t>

<t>This capability is particularly useful for IMAP clients that do not cache the
state of the message store, such as most webmail clients. Without the
"STATUS=SIZE" capability, such clients need to fetch all message sizes from the
server when the size of a mailbox needs to be determined, for example when the
user requests detailed quota usage information. The "QUOTA" capability
<xref target="QUOTA"/> is no help in that scenario, since the provided QUOTAROOT
command can only yield the "STORAGE" resource usage of a whole quota root, but
not for a single mailbox within that root.</t>
</section>

<section title="Conventions Used in This Document">
<t>In examples, "C:" indicates lines sent by a client that is connected
to a server.  "S:" indicates lines sent by the server to the client.
</t>
<t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
"SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
document are to be interpreted as described in <xref target="KEYWORDS"/>.
</t>
</section>

<section title="STATUS Command and Response Extensions">

<t>This extension defines one new status data item for the STATUS command and
response:
<list style="hanging">
  <t hangText="SIZE"><vspace blankLines="0"/>
  The total size of the mailbox in octets. This MUST be equal to the sum of the
  values of the <xref target="IMAP4rev1">RFC822.SIZE FETCH message data item
  </xref> of all messages in the mailbox.
	</t>
</list>
</t>

<t>Example:</t>
<?rfc needLines="4" ?>
<figure><artwork><![CDATA[
C: A01 STATUS frop (MESSAGES SIZE UIDNEXT)
S: * STATUS frop (MESSAGES 8 SIZE 44421 UIDNEXT 242344)
S: A01 OK STATUS completed
]]></artwork></figure>

<t>The same information can be obtained by using the following commands,
albeit less efficient:</t>
<?rfc needLines="20" ?>
<figure><artwork><![CDATA[
C: A02 SELECT "frop"
S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft)
S: * 8 EXISTS
S: * 1 RECENT
S: * OK [UNSEEN 7] First unseen.
S: * OK [UIDVALIDITY 1364851417] UIDs valid
S: * OK [UIDNEXT 242344] Predicted next UID
S: * OK [HIGHESTMODSEQ 3914] Highest
S: A02 OK [READ-WRITE] Select completed.
C: A03 FETCH 1:* (RFC822.SIZE)
S: * 1 FETCH (RFC822.SIZE 3224)
S: * 2 FETCH (RFC822.SIZE 1222)
S: * 3 FETCH (RFC822.SIZE 444)
S: * 4 FETCH (RFC822.SIZE 4516)
S: * 5 FETCH (RFC822.SIZE 544)
S: * 6 FETCH (RFC822.SIZE 922)
S: * 7 FETCH (RFC822.SIZE 31126)
S: * 8 FETCH (RFC822.SIZE 2423)
S: A03 OK Fetch completed.
]]></artwork></figure>

<t>When the LIST-STATUS IMAP capability <xref target="LIST-STATUS"/> is
also available, the STATUS command can be combined with the LIST command to
further improve efficiency. This way, the sizes of many mailboxes can be
queried with just one LIST command.</t>

<t>Example:</t>
<?rfc needLines="7" ?>
<figure><artwork><![CDATA[
C: A04 LIST "" % RETURN (STATUS (MESSAGES SIZE))
S: * LIST () "."  "INBOX"
S: * STATUS "INBOX" (MESSAGES 17 SIZE 16234)
S: * LIST () "." "frop"
S: * STATUS "frop" (MESSAGES 8 SIZE 44421)
S: A04 OK List completed.
]]></artwork></figure>

</section>

<section anchor="Syntax" title="Formal Syntax">
<t>The following syntax specification augments the grammar specified in
<xref target="IMAP4rev1"/>. It uses the Augmented Backus-Naur Form (ABNF)
notation as specified in <xref target="ABNF"/>. Elements not defined here are
taken from <xref target="IMAP4rev1"/>.</t>

<?rfc needLines="2" ?>
<figure><artwork type="ABNF"><![CDATA[
capability  =/ "STATUS=SIZE"

status-att  =/ "SIZE"
]]></artwork></figure>

<t>[FIXME: Interaction with 64BIT capability]
</t>
</section>

<section anchor="Security" title="Security Considerations">
<t>There are no known additional security issues with this extension
beyond those described in the base protocol described in
<xref target="IMAP4rev1"/>.</t>
</section>

<section anchor="IANA" title="IANA Considerations">
<t>The IANA is requested to add "STATUS=SIZE" to the "IMAP Capabilities"
registry located at
&lt;http://www.iana.org/assignments/imap-capabilities&gt;.</t>
</section>

<section title="Acknowledgements">
<t>Thanks to Alexey Melnikov and Michael Slusarz for reviews and suggestions.
</t>
<t>More reviews are appreciated.</t>
</section>
</middle>

<!--  *****BACK MATTER ***** -->

<back>
<!-- References split into informative and normative -->

<references title="Normative References">
  <reference anchor='KEYWORDS'>
    <front>
    <title abbrev='RFC Key Words'>Key words for use in RFCs to Indicate Requirement Levels</title>
    <author initials='S.' surname='Bradner' fullname='Scott Bradner'>
    <organization>Harvard University</organization>
    <address>
      <postal>
        <street>1350 Mass. Ave.</street>
        <street>Cambridge</street>
        <street>MA 02138</street>
      </postal>
      <phone>- +1 617 495 3864</phone>
      <email>sob@harvard.edu</email>
    </address>
    </author>
    <date year='1997' month='March' />
    <area>General</area>
    <keyword>keyword</keyword>
		</front>

    <seriesInfo name='BCP' value='14' />
    <seriesInfo name='RFC' value='2119' />
    <format type='TXT' octets='4723' target='http://www.rfc-editor.org/rfc/rfc2119.txt' />
    <format type='HTML' octets='17491' target='http://xml.resource.org/public/rfc/html/rfc2119.html' />
    <format type='XML' octets='5777' target='http://xml.resource.org/public/rfc/xml/rfc2119.xml' />
  </reference>

	<reference anchor='ABNF'>
		<front>
		<title>Augmented BNF for Syntax Specifications: ABNF</title>
		<author initials='D.' surname='Crocker' fullname='D. Crocker'>
			<organization />
		</author>
		<author initials='P.' surname='Overell' fullname='P. Overell'>
			<organization />
		</author>
		<date year='2008' month='January' />
		</front>
		<seriesInfo name='STD' value='68' />
		<seriesInfo name='RFC' value='5234' />
		<format type='TXT' octets='26359' target='http://www.rfc-editor.org/rfc/rfc5234.txt' />
	</reference>

	<reference anchor='IMAP4rev1'>
		<front>
		<title>INTERNET MESSAGE ACCESS PROTOCOL - VERSION 4rev1</title>
		<author initials='M.' surname='Crispin' fullname='M. Crispin'>
		<organization /></author>
		<date year='2003' month='March' />
		</front>
		<seriesInfo name='RFC' value='3501' />
		<format type='TXT' octets='227640' target='http://www.rfc-editor.org/rfc/rfc3501.txt' />
	</reference>

	<reference anchor='LIST-STATUS'>
		<front>
		<title>IMAP4 Extension for Returning STATUS Information in Extended LIST</title>
		<author initials='A.' surname='Melnikov' fullname='A. Melnikov'>
		<organization /></author>
		<author initials='T.' surname='Sirainen' fullname='T. Sirainen'>
		<organization /></author>
		<date year='2010' month='March' />
		</front>
		<seriesInfo name='RFC' value='5819' />
		<format type='TXT' octets='10584' target='http://www.rfc-editor.org/rfc/rfc5819.txt' />
	</reference>
</references>

<references title="Informative References">
	<reference anchor='QUOTA'>
		<front>
		<title abbrev='QUOTA'>IMAP4 QUOTA extension</title>
		<author initials='J.' surname='Myers' fullname='John G. Myers'>
		<organization>Carnegie-Mellon University</organization>
		<address>
		<postal>
		<street>5000 Forbes Ave.</street>
		<city>Pittsburgh</city>
		<region>PA</region>
		<code>15213-3890</code>
		<country>US</country></postal>
		<email>jgm+@cmu.edu</email></address></author>
		<date year='1997' month='January' />
		</front>
		<seriesInfo name='RFC' value='2087' />
		<format type='TXT' octets='8542' target='http://www.rfc-editor.org/rfc/rfc2087.txt' />
	</reference>
	</references>
	</back>
</rfc>
