Internet Draft A. Melnikov Document: draft-melnikov-imap-search-ret Isode Ltd Expires: July 2005 D. Cridland Inventure Systems Ltd February 2005 IMAP4 extension to SEARCH command for controlling what kind of information is returned draft-melnikov-imap-search-ret-00 Status of this Memo By submitting this Internet-Draft, I certify that any applicable patent or other IPR claims of which I am aware have been disclosed, or will be disclosed, and any of which I become aware will be disclosed, in accordance with RFC 3668. Internet Drafts are working documents of the Internet Engineering Task Force (IETF), its Areas, and its Working Groups. Note that other groups may also distribute working documents as Internet Drafts. Internet Drafts are draft documents valid for a maximum of six months. Internet Drafts may be updated, replaced, or obsoleted by other documents at any time. It is not appropriate to use Internet Drafts as reference material or to cite them other than as ''work in progress''. The list of current Internet-Drafts can be accessed at http://www.ietf.org/ietf/1id-abstracts.txt The list of Internet-Draft Shadow Directories can be accessed at http://www.ietf.org/shadow.html. A revised version of this draft document will be submitted to the RFC editor as a Standard Track RFC for the Internet Community. Discussion and suggestions for improvement are requested, and should be sent to ietf-imapext@imc.org and/or lemonade@ietf.org. Distribution of this memo is unlimited. Abstract This document extends SEARCH and UID SEARCH commands with result specifier, which can control what kind of information is returned. Several result specifiers are defined: minimal value, maximal value, all found messages and number of found messages. A new response ESEARCH is also specified. Table of Contents 1. Conventions Used in this Document 2 2. Introduction 2 3. IMAP Protocol Changes 3 3.1 SEARCH Command 3 3.2 ESEARCH Response 4 4. Formal Syntax 4 5. Security Considerations 5 6. IANA Considerations 5 7. References 5 7.1 Normative References 5 7.2 Informative References 5 8. Acknowledgments 5 9. Author's Addresses 6 10. Full Copyright Statement 6 11. Intellectual Property 6 12. Appendix A. Editorial. 7 12.1 Change Log 7 12.2 Open Issues for Discussion 7 1. Conventions Used in this Document In examples, "C:" and "S:" indicate lines sent by the client and server respectively. The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", and "MAY" in this document are to be interpreted as defined in "Key words for use in RFCs to Indicate Requirement Levels" [KEYWORDS]. <> 2. Introduction This document extends SEARCH and UID SEARCH commands with result specifier, which can control what kind of information is returned. Several result specifiers are defined: minimal value, maximal value, all found messages and number of found messages. A new response ESEARCH is also specified, which replaces the SEARCH response. <> 3. IMAP Protocol Changes 3.1 SEARCH Command Arguments: OPTIONAL result specifier OPTIONAL [CHARSET] specification searching criteria (one or more) Responses: REQUIRED untagged response: SEARCH or ESEARCH Result: OK - search completed NO - search error: can't search that [CHARSET] or criteria BAD - command unknown or arguments invalid This section updates definition of the SEARCH command described in section 6.4.4 of [IMAP4]. The SEARCH command is extended to allow for result options. This document defines 4 search result options: MIN Return the lowest message number/UID that satisfies the SEARCH criteria. MAX Return the highest message number/UID that satisfies the SEARCH criteria. ALL Return all message numbers/UIDs that satisfy the SEARCH criteria. Unlike regular (unextended) SEARCH, the messages are always returned using the sequence-set syntax. A sequence- set representation may be more compact and can be used as is in a subsequent command that accepts sequence-set. Note, the client MUST NOT assume that messages/UIDs will be listed in any particular order. COUNT Return number of the messages that satisfy the SEARCH criteria. If one or more result options is specified, the extended SEARCH command MUST return ESEARCH response, instead of the SEARCH response. If the list of result options is empty, that requests the server not to return any SEARCH or ESEARCH response, however the operation MUST still be performed by the server. This functionality can be used by an extension. Example: C: A282 SEARCH RETURN (MIN COUNT) FLAGGED SINCE 1-Feb-1994 NOT FROM "Smith" S: * ESEARCH MIN 2 COUNT 3 S: A282 OK SEARCH completed Example: C: A283 SEARCH RETURN () FLAGGED SINCE 1-Feb-1994 NOT FROM "Smith" S: A283 OK SEARCH completed 3.2 ESEARCH Response Contents: one or more search-return-data pairs The ESEARCH response occurs as a result of an extended SEARCH or UID SEARCH command specified in section 3.1. The ESEARCH response is immediately followed by an optional UID indicator. If this indicator is present, all data in the ESEARCH response is referring to UIDs, for example the MIN result specifier will be followed by an UID. If the UID indicator is missing, all returned data is referring to message numbers. An extended UID SEARCH command MUST cause a ESEARCH response with the UID indicator present. <> The rest of the ESEARCH response contains one or more search data pairs. Each pair starts with unique return item name, followed by a space and the corresponding data. Search data pairs may be returned in any order. Example: S: * ESEARCH UID COUNT 5 ALL 4:19,21,28 4. Formal Syntax The following syntax specification uses the Augmented Backus-Naur Form (ABNF) notation as specified in [ABNF]. Non-terminals referenced but not defined below are as defined by [IMAP4]. 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. capability =/ "X-DRAFT-I00-ESEARCH" mailbox-data =/ "ESEARCH" [SP "UID"] *(SP search-return-data) search = "SEARCH" [search-return-opts] [SP "CHARSET" SP astring] 1*(SP search-key) ; CHARSET argument to MUST be registered ; with IANA search-return-data = "MIN" SP nz-number / "MAX" SP nz-number / "ALL" SP sequence-set / "COUNT" SP number search-return-opts = "RETURN" SP "(" [search-return-opt *(SP search-return-opt)] ")" ; SEARCH return options, e.g. MIN search-return-opt = "MIN" / "MAX" / "ALL" / "COUNT" 5. Security Considerations <> 6. IANA Considerations <> 7. References 7.1 Normative References [KEYWORDS] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", RFC 2119, March 1997. [IMAP4], Crispin, M., "Internet Message Access Protocol - Version 4rev1", RFC 3501, University of Washington, March 2003. [ABNF], DRUMS working group, Dave Crocker Editor, "Augmented BNF for Syntax Specifications: ABNF", Work in Progress. 7.2 Informative References [TRANS-CAPA] Melnikov, A., "Transitional IMAP capabilities", work in progress, draft-melnikov-imap-transitional-capa-XX.txt 8. Acknowledgments Thanks to Michael Wener for comments and corrections. 9. Author's Addresses Alexey Melnikov Isode Limited 5 Castle Business Village 36 Station Road Hampton, Middlesex, TW12 2BX UK Email: Alexey.Melnikov@isode.com Dave A. Cridland Inventure Systems Limited Email: dave.cridland@inventuresystems.co.uk URL: http://invsys.co.uk/dave/ 10. Full Copyright Statement Copyright (C) The Internet Society (2005). This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights. This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 11. Intellectual Property The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79. Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr. The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf- ipr@ietf.org. Acknowledgement Funding for the RFC Editor function is currently provided by the Internet Society. 12. Appendix A. Editorial. <> 12.1 Change Log 00 Initial Revision. 12.2 Open Issues for Discussion