IMAP Extensions Working Group C. Daboo Internet Draft: IMAP ANNOTATE Extension R. Gellens Document: draft-gellens-imapext-annotate-00.txt March 2000 IMAP ANNOTATE Extension Status of this Memo This document is an Internet-Draft and is in full conformance with all provisions of Section 10 of RFC2026. 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 and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate 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. Copyright Notice Copyright (C) The Internet Society 2000. All Rights Reserved. Daboo & Gellens Expires September 2000 [Page 1] Internet Draft IMAP ANNOTATE Extension March 2000 Table of Contents 1 Abstract . . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Conventions Used in This Document . . . . . . . . . . . . . 2 3 Introduction and Overview . . . . . . . . . . . . . . . . . . 2 4 Data Model . . . . . . . . . . . . . . . . . . . . . . . . . 3 4.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . 3 4.2 Namespace of entries and attributes . . . . . . . . . . 3 4.2.1 Entry Names . . . . . . . . . . . . . . . . . . . . . 4 4.2.2 Attribute Names . . . . . . . . . . . . . . . . . . 5 5 IMAP Protocol Changes . . . . . . . . . . . . . . . . . . . . 6 5.1 ANNOTATION message data item in FETCH Command . . . . . 6 5.2 ANNOTATION message data item in FETCH Response . . . . . 7 5.3 ANNOTATION message data item in STORE . . . . . . . . . 8 5.4 ANNOTATION criterion in SEARCH . . . . . . . . . . . . . 9 5.5 ANNOTATION key in SORT . . . . . . . . . . . . . . . . . 10 6 Formal Syntax . . . . . . . . . . . . . . . . . . . . . . . . 11 7 IANA Considerations . . . . . . . . . . . . . . . . . . . . 12 7.1 Entry and Attribute Registration Template . . . . . . . . 12 8 Security Considerations . . . . . . . . . . . . . . . . . . 13 9 References . . . . . . . . . . . . . . . . . . . . . . . . . 13 10 Full Copyright Statement . . . . . . . . . . . . . . . . . . 14 1 Abstract The ANNOTATE extension to the Internet Message Access Protocol [IMAP4] permits clients and servers to maintain "metadata" for messages stored in an IMAP4 mailbox. 2 Conventions Used in This Document 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 RFC 2119 [KEYWORDS]. Formal syntax is defined using ABNF [ABNF] as modified by [IMAP4]. In examples, "C:" and "S:" indicate lines sent by the client and server respectively. 3 Introduction and Overview The ANNOTATE extension is present in any IMAP4 implementation which returns "ANNOTATE" as one of the supported capabilities in the CAPABILITY command response. The ANNOTATE extension adds a new message data item to the FETCH and STORE commands, as well as adding SEARCH and SORT keys. Daboo & Gellens Expires September 2000 [Page 2] Internet Draft IMAP ANNOTATE Extension March 2000 This extension makes the following changes to the IMAP4 protocol: a) adds a new ANNOTATION message data item for use in the FETCH command b) adds a new ANNOTATION message data item for use in the STORE command c) adds a new ANNOTATION search criterion for use in the SEARCH command d) adds a new ANNOTATION sort key for use in the SORT command extension The data model used for the storage of annotations is based on that of the Application Configuration Access Protocol [ACAP], with the exception of inheritence which is not deemed necessary here. The rest of this document describes the data model and protocol changes more rigorously. 4 Data Model 4.1 Overview The data model used in ANNOTATE is one of a uniquely named entry with a set of uniquely named attributes, each of which has a value. A message annotation can contain multiple named entries. For example, a general comment being added to a message may have an entry name of "/message/comment". This entry could include named attributes such as "value", "modifiedsince", "acl" etc to represent properties and data associated with the entry. The protocol changes to IMAP described below allow a client to access or change the values of any attributes in any entries in a message annotation, assuming it has sufficient access rights to do so. 4.2 Namespace of entries and attributes Each message annotation is made up of a set of entries. Each entry has a hierarchical name in UTF-8, with each component of the name separated by a slash ("/"). Each entry is made up of a set of attributes. Each attribute has a hierarchical name in UTF-8, with each component of the name separated by a period ("."). The value of an attribute is NIL (has no value), or a string of zero or more octets. Entry and attribute names are not permitted to contain asterisk ("*") or percent ("%") characters and MUST be valid UTF-8 strings Daboo & Gellens Expires September 2000 [Page 3] Internet Draft IMAP ANNOTATE Extension March 2000 which do not contain NUL. Invalid entry or attribute names result in a BAD response in any IMAP commands where they are used. Use of non-visible UTF-8 characters in entry and attribute names is discouraged. This specification defines an initial set of entry and attribute names available for use in message annotations. In addition an extension mechanism is described to allow additional names to be added for extensibility. 4.2.1 Entry Names Entry names MUST be specified in a standards track or IESG approved experimental RFC, or fall under the vendor namespace. See section 7.1 for the registration template. /message Defines the top-level of entries associated with an entire message. This entry itself does not have any associated attributes. /message/comment Defines a comment or note associated with an entire message. /message/flags Defines the top-level of entries for client-use flags associated with an entire message. All sub-entries are maintained entirely by the client. There is no implicit change to any flag by the server. /message/flags/redirected /message/flags/forwarded /message/flags/queued Defines client-use flags for an entire message. The "value" attribute of these entries must be either "1", "0" or NIL. The "queued" flag MUST only be set for messages which have the DRAFT flag set. The "queued" flag indicates that a message is eligible to be sent (submitted into the mail system for delivery) by any client at any time. The "queued" flag SHOULD be reset while a client is attempting to submit the message. /message/smtp-envelope Defines the SMTP envelope used in delivery of the message. The client SHOULD NOT modify the /message/smtp-envelope entry or its attributes, except in messages which have the DRAFT flag set. /message/subject Contains text supplied by the message recipient, to be used by the client instead of the original message Subject. Daboo & Gellens Expires September 2000 [Page 4] Internet Draft IMAP ANNOTATE Extension March 2000 /message/vendor/ Defines the top-level of entries associated with an entire message as created by a particular product of some vendor. This entry can be used by vendors to provide client specific attributes. The vendor-token MUST be registered with IANA. /body/ Defines the top-level of entries associated with a specific body part of a message. This entry itself does not have any associated attributes. The part-specifier uses the same part specifier syntax as the BODY message data item in the FETCH command [IMAP4]. /body//comment Defines a comment or note associated with a specific body part of a message. /body//flags Defines the top-level of entries associated with flag state for a specific body part of a message. All sub-entries are maintained entirely by the client. There is no implicit change to any flag by the server. /body//flags/seen /body//flags/answered /body//flags/flagged Defines flags for a specific body part of a message. The "value" attribute of these entries must be either "1", "0" or NIL. /body//vendor/ Defines the top-level of entries associated with a specific body part of a message as created by a particular product of some vendor. This entry can be used by vendors to provide client specific attributes. The vendor-token MUST be registered with IANA. 4.2.2 Attribute Names Attribute names MUST be specified in a standards track or IESG approved experimental RFC, or fall under the vendor namespace. See section 7.1 for the registration template. value The data value of the attribute. modifiedsince An opaque value set by the server when this entry is modified. It can be used by the client to request notification of which entries have changed since a particular point in time and is useful for disconnected/synchronisation operations. (The value Daboo & Gellens Expires September 2000 [Page 5] Internet Draft IMAP ANNOTATE Extension March 2000 is intended to be used only for comparisons within a server, not as an accurate timestamp.) content-type A MIME [MIME] content type and subtype that describes the nature of the content of the "value" attribute. vendor. Defines an attribute associated with a particular product of some vendor. This attribute can be used by vendors to provide client specific attributes. The vendor-token MUST be registered with IANA. 5 IMAP Protocol Changes 5.1 ANNOTATION message data item in FETCH Command This extension adds an ANNOTATION message data item to the FETCH command. This allows clients to retrieve annotations for a range of messages in the currently selected mailbox. ANNOTATION The ANNOTATION message data item, when used by the client in the FETCH command, takes an entry specifier and an attribute specifier. Example: C: a FETCH 1 (ANNOTATION ("/message/comment" "value")) S: * 1 FETCH (ANNOTATION ("/message/comment" (("value" "My comment")))) S: a OK Fetch complete In the above example, the contents of the "value" attribute for the "/message/comment" entry is requested by the client and returned by the server. "*" and "%" wildcard characters can be used in either specifier to match match one or more characters at that position, with the exception that "%" does not match the hierarchy delimiter for the specifier it appears in (that is, "/" for an entry specifier or "." for an attribute specifer). Thus an entry specifier of "/message/%" matches entries such as "/message/comment" and "/message/subject", but not "/message/comment/note". Examples: C: a FETCH 1 (ANNOTATION ("/message/*" "value")) S: * 1 FETCH (ANNOTATION (("/message/comment" ("value" "My comment")) ("/message/version" ("value" "1.1")) ("/message/version/last" ("value" "1.0.1")))) Daboo & Gellens Expires September 2000 [Page 6] Internet Draft IMAP ANNOTATE Extension March 2000 S: a OK Fetch complete In the above example, the contents of the "value" attributes for any entries in the "/message" hierarchy are requested by the client and returned by the server. C: a FETCH 1 (ANNOTATION ("/message/%" "value")) S: * 1 FETCH (ANNOTATION (("/message/comment" ("value" "My comment")) ("/message/version" ("value" "1.1")))) S: a OK Fetch complete In the above example, the contents of the "value" attributes for entries at the top level of the "/message" hierarchy only, are requested by the client and returned by the server. Entry and attribute specifiers can be lists of atomic specifiers, so that multiple items of each type may be returned in a single FETCH command. Examples: C: a FETCH 1 (ANNOTATION (("/message/comment" "/message/version") "value")) S: * 1 FETCH (ANNOTATION (("/message/comment" ("value" "My comment")) ("/message/version" ("value" "1.1")))) S: a OK Fetch complete In the above example, the contents of the "value" attributes for the two entries "/message/comment" and "/message/version" are requested by the client and returned by the server. C: a FETCH 1 (ANNOTATION ("/message/comment" ("value" "modifiedsince"))) S: * 1 FETCH (ANNOTATION (("/message/comment" ("value" "My comment" "modifiedsince" "19990203205432")))) S: a OK Fetch complete In the above example, the contents of the "value" and "modifiedsince" attributes for the "/message/comment" entry are requested by the client and returned by the server. 5.2 ANNOTATION message data item in FETCH Response The ANNOTATION message data item in the FETCH response displays information about annotations in a message. Daboo & Gellens Expires September 2000 [Page 7] Internet Draft IMAP ANNOTATE Extension March 2000 ANNOTATION parenthesised list The response consists of a list of entries each of which has a list of attribute-value pairs. Examples: C: a FETCH 1 (ANNOTATION ("/message/comment" "value")) S: * 1 FETCH (ANNOTATION ("/message/comment" (("value" "My comment")))) S: a OK Fetch complete In the above example, a single entry with a single attribute-value pair is returned by the server. C: a FETCH 1 (ANNOTATION (("/message/comment" "/message/version") "value")) S: * 1 FETCH (ANNOTATION (("/message/comment" ("value" "My comment")) ("/message/version" ("value" "1.1")))) S: a OK Fetch complete In the above example, two entries each with a single attribute-value pair are returned by the server. C: a FETCH 1 (ANNOTATION ("/message/comment" ("value" "modifiedsince"))) S: * 1 FETCH (ANNOTATION (("/message/comment" ("value" "My comment" "modifiedsince" "19990203205432")))) S: a OK Fetch complete In the above example, a single entry with two attribute-value pairs is returned by the server. Servers SHOULD send ANNOTATION message data items in unsolicted FETCH responses if the annotation is changed by a third-party, allowing servers to keep clients updated with changes to annotations by other clients. 5.3 ANNOTATION message data item in STORE ANNOTATION Sets the specified list of entries by adding or replacing the specified attributes with the values provided. Clients can use NIL for values of attributes it wants to remove from entries. The ANNOTATION message data item used with the STORE command has an implicit ".SILENT" behaviour. This means the server does not generate an untagged FETCH in response to the STORE command and assumes that the client updates its own cache if the command succeeds. Daboo & Gellens Expires September 2000 [Page 8] Internet Draft IMAP ANNOTATE Extension March 2000 Examples: C: a STORE 1 ANNOTATION ("/message/comment" ("value" "My new comment")) S: a OK Store complete In the above example, the entry "/message/comment" is created (if not already present) and the attribute "value" with data set to "My new comment" is created if not already present, or replaced if it previously exists. C: a STORE 1 ANNOTATION ("/message/comment" ("value" NIL)) S: a OK Store complete In the above example, the "value" attribute of the entry "/message/comment" is removed. Multiple entries can be set in a single STORE command by listing entry-attribute-value pairs in the list. Example: C: a STORE 1 ANNOTATION ("/message/comment" ("value" "My new comment") "/message/version" ("value" "1.1")) S: a OK Store complete In the above example, the entries "/message/comment" and "/message/version" are created (if not already present) and the attribute "value" is created for each entry if not already present, or replaced if they previously exist. Multiple attributes can be set in a single STORE command by listing multiple attribute-value pairs in the entry list. Example: C: a STORE 1 ANNOTATION ("/message/comment" ("value" "My new comment" "vendor.foobar" "foo's bar")) S: a OK Store complete In the above example, the entry "/message/comment" is created (if not already present) and the attributes "value" and "vendor.foobar" are created if not already present, or replaced if they previously exist. 5.4 ANNOTATION criterion in SEARCH The ANNOTATION criterion for the SEARCH command allows a client to search for the specified string in the value of an annotation in a message. ANNOTATION Messages that have annotations with entries matching and attributes matching and Daboo & Gellens Expires September 2000 [Page 9] Internet Draft IMAP ANNOTATE Extension March 2000 the specified string in their values are returned in the SEARCH results. The "*" character can be used in the entry or attribute name fields to match any content in those items. The "%" character can be used in the entry or attribute name fields to match a single level of hierarchy only. Examples: C: a SEARCH ANNOTATION "/message/comment" "value" "IMAP4" S: * SEARCH 2 3 5 7 11 13 17 19 23 S: a OK Search complete In the above example, the message numbers of any messages containing the string "IMAP4" in the "value" attribute of the "/message/comment" entry are returned in the search results. C: a SEARCH ANNOTATION "*" "*" "IMAP4" S: * SEARCH 1 2 3 5 8 13 21 34 S: a OK Search complete In the above example, the message numbers of any messages containing the string "IMAP4" in any attribute of any entry are returned in the search results. A special case exists when the "modifiedsince" attribute is used as the parameter in the ANNOTATION search criterion. In this case the server matches messages when the corresponding "modifiedsince" value is greater than the value supplied in the ANNOTATION criterion. This allows a client, for example, to find out which messages contain annotations that have changed since the last time it updated its disconnected cache. Example: C: a SEARCH ANNOTATION "*" "modifiedsince" "1999101713283412" S: * SEARCH 1 3 6 10 15 21 28 36 45 55 S: a OK Search complete In the above example, the message numbers of any messages whose "modifiedsince" attribute of any entry 'exceeds' the value "1999101713283412" are returned in the search results. 5.5 ANNOTATION key in SORT The ANNOTATION criterion for the SORT command [SORT-EXT] instructs the server to return the message numbers or UIDs of a mailbox, sorted using the values of the specified annotations. ANNOTATION Messages are sorted using the values of the attributes in the entries. (The charset Daboo & Gellens Expires September 2000 [Page 10] Internet Draft IMAP ANNOTATE Extension March 2000 argument determines sort order, as specified in the SORT extension description.) Examples: C: a SORT (ANNOTATION "/message/subject" "value") UTF-8 ALL S: * SORT 2 3 4 5 1 11 10 6 7 9 8 S: a OK Sort complete In the above example, the message numbers of all messages are returned, sorted according to the "value" attribute of the "/message/subject" entry. Note that the ANNOTATION sort key must include a fully specified entry and attribute -- wildcards are not allowed. 6 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. fetch-att =/ fetch-annotate ; modifies original IMAP4 fetch-att fetch-annotate = "ANNOTATION" SP "(" entries SP attribs ")" fetch-ann-resp = "ANNOTATION" SP "(" entry-att *(SP entry-att) ")" store-att-flags =/ store-att-annotate ; modifies original IMAP4 STORE command store-att-annotate = "(" entry-att *(SP entry-att) ")" search-key =/ search-annotate ; modifies original IMAP4 search-key search-annotate = "ANNOTATION" SP entry-match SP attrib-match SP value sort-key =/ sort-annotate ; modifies original ; draft-crispin-imapext-sort-xx.txt sort-key sort_annotate = "ANNOTATION" SP entry SP attrib Daboo & Gellens Expires September 2000 [Page 11] Internet Draft IMAP ANNOTATE Extension March 2000 entries = entry-match / "(" entry-match *(SP entry-match) ")" attribs = attrib-match / "(" attrib-match *(SP attrib-match) ")" entry-att = entry SP "(" att-value *(SP att-value) ") att-value = attrib SP value atom-slash = any ATOM_CHAR except "/" atom-dot = any ATOM_CHAR except "." entry = DQUOTE 1*atom-slash *("/" 1*atom-slash) DQUOTE entry-match = DQUOTE 1*entry-match-atom *("/" 1*entry-match-atom) DQUOTE entry-match-atom = 1*(list-wildcards / atom-slash) *(list-wildcards / atom-slash) attrib = DQUOTE 1*atom-dot *("/" 1*atom-dot) DQUOTE attrib-match = DQUOTE 1*attrib-match-atom *("/" 1*attrib-match-atom) DQUOTE attrib-match-atom = 1*(list-wildcards / atom-dot) *(list-wildcards / atom-dot) value = nstring 7 IANA Considerations Both entry names and attribute names MUST be specified in a standards track or IESG approved experimental RFC, or fall under the vendor namespace. Vendor names MUST be registered. Daboo & Gellens Expires September 2000 [Page 12] Internet Draft IMAP ANNOTATE Extension March 2000 7.1 Entry and Attribute Registration Template To: iana@iana.org Subject: IMAP Annotate Registration Please register the following IMAP Annotate item: [] Entry [] Attribute [] Vendor [] Open: RFC _______ Name: ______________________________ Description: _______________________ ____________________________________ ____________________________________ Contact person: ____________________ email: ____________________ 8 Security Considerations There are no known security issues with this extension. 9 References [ABNF] Crocker, Overell, "Augmented BNF for Syntax Specifications: ABNF", RFC 2234, Internet Mail Consortium, Demon Internet Ltd, November 1997. [IMAP4] Crispin, M., "Internet Message Access Protocol - Version 4rev1", RFC 2060, University of Washington, December 1996. [KEYWORDS] Bradner, "Key words for use in RFCs to Indicate Requirement Levels", RFC 2119, Harvard University, March 1997. [SORT-EXT] Crispin, M., "Internet Message Access Protocol -- SORT Extension", work in progress. Cyrus Daboo Cyrusoft International, Inc. Suite 780, 5001 Baum Blvd. Pittsburgh, PA 15213 U.S.A. Phone: +1 412 605 0499 Daboo & Gellens Expires September 2000 [Page 13] Internet Draft IMAP ANNOTATE Extension March 2000 Email: daboo@cyrusoft.com Randall Gellens QUALCOMM Incorporated 5775 Morehouse Dr. San Diego, CA 92121-2779 U.S.A. Phone: +1 858 651 5115 Email: randy@qualcomm.com 10 Full Copyright Statement Copyright (C) The Internet Society 2000. All Rights Reserved. This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English. The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns. This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS 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. Daboo & Gellens Expires September 2000 [Page 14]