idnits 2.17.1 draft-ietf-imapext-condstore-00.txt: ** The Abstract section seems to be numbered Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- ** Looks like you're using RFC 2026 boilerplate. This must be updated to follow RFC 3978/3979, as updated by RFC 4748. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- ** The document seems to lack a 1id_guidelines paragraph about Internet-Drafts being working documents. ** The document is more than 15 pages and seems to lack a Table of Contents. == No 'Intended status' indicated for this document; assuming Proposed Standard == The page length should not exceed 58 lines per page, but there was 1 longer page, the longest (page 1) being 884 lines Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- ** The document seems to lack an IANA Considerations section. (See Section 2.2 of https://www.ietf.org/id-info/checklist for how to handle the case when there are no actions for IANA.) ** There are 162 instances of too long lines in the document, the longest one being 16 characters in excess of 72. ** There are 3 instances of lines with control characters in the document. Miscellaneous warnings: ---------------------------------------------------------------------------- -- The document seems to lack a disclaimer for pre-RFC5378 work, but may have content which was first submitted before 10 November 2008. If you have contacted all the original authors and they are all willing to grant the BCP78 rights to the IETF Trust, then this is fine, and you can ignore this comment. If not, you may need to add the pre-RFC5378 disclaimer. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (March 2003) is 7713 days in the past. Is this intentional? -- Found something which looks like a code comment -- if you have code sections in the document, please surround them with '' and '' lines. Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) == Missing Reference: 'UNSEEN 12' is mentioned on line 292, but not defined == Missing Reference: 'UIDVALIDITY 3857529045' is mentioned on line 293, but not defined == Missing Reference: 'UIDNEXT 4392' is mentioned on line 294, but not defined == Missing Reference: 'HIGHESTMODSEQ 20010715194045007' is mentioned on line 297, but not defined == Missing Reference: 'MODIFIED 7' is mentioned on line 329, but not defined -- Looks like a reference, but probably isn't: '9' on line 329 == Missing Reference: 'MODIFIED 12' is mentioned on line 343, but not defined == Missing Reference: 'MODIFIED 101' is mentioned on line 362, but not defined == Unused Reference: 'ACAP' is defined on line 788, but no explicit reference was found in the text ** Obsolete normative reference: RFC 2234 (ref. 'ABNF') (Obsoleted by RFC 4234) ** Obsolete normative reference: RFC 3501 (ref. 'IMAP4') (Obsoleted by RFC 9051) -- Possible downref: Non-RFC (?) normative reference: ref. 'ANNOTATE' -- Possible downref: Non-RFC (?) normative reference: ref. 'SORT' -- Obsolete informational reference (is this intentional?): RFC 2086 (ref. 'ACL') (Obsoleted by RFC 4314) -- Obsolete informational reference (is this intentional?): RFC 1305 (ref. 'NTP') (Obsoleted by RFC 5905) Summary: 9 errors (**), 0 flaws (~~), 10 warnings (==), 8 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 1 Internet Draft: IMAP Extension for Conditional STORE A. Melnikov 2 Document: draft-ietf-imapext-condstore-00.txt S. Hole 3 Expires: September 2003 ACI WorldWide/MessagingDirect 4 March 2003 6 IMAP Extension for Conditional STORE operation 8 Status of this Memo 10 This document is an Internet-Draft and is in full conformance with 11 all provisions of Section 10 of RFC2026. Internet-Drafts are 12 working documents of the Internet Engineering Task Force (IETF), its 13 areas, and its working groups. Note that other groups may also 14 distribute working documents as Internet-Drafts. 16 Internet-Drafts are draft documents valid for a maximum of six 17 months and may be updated, replaced, or obsoleted by other documents 18 at any time. It is inappropriate to use Internet-Drafts as 19 reference material or to cite them other than as "work in progress." 21 The list of current Internet-Drafts can be accessed at 22 http://www.ietf.org/ietf/1id-abstracts.txt. The list of Internet- 23 Draft Shadow Directories can be accessed at 24 http://www.ietf.org/shadow.html. 26 Copyright Notice 28 Copyright (C) The Internet Society 2001-2003. All Rights Reserved. 30 0.1. Open issues 32 1). Should conditional STORE be atomic accross message set (i.e. either 33 all messages in message set weren't changed since and conditional 34 STORE succeeds or operation fails for all messages)? 35 This can be difficult to implement for some servers. 37 Is a server allowed to reply NO to a conditional STORE operation that 38 contains more than one message? Do we need a special response code 39 for this (probably yes). 41 0.2. Change History 43 Changes from draft-melnikov-imap-condstore-09: 44 1. Some text clarifications based on suggestions by Harrie Hazewinkel 45 2. Added paragraph about mailbox locking and DOS when conditional STORE 46 operation is performed on a large mailbox. 47 3. Fixed syntax of to match the ANNOTATE extention. 48 4. Added sentence that a system flag MUST always be considered existent, 49 when UNCHANGEDSINCE 0 is used. Is this a good idea? 50 5. Clarified client behavior upon receipt of MODIFIED response code. 51 6. Updated ABNF to clarify where 0 is allowed as mod-sequence and where 52 it is not. 53 7. Got rid of MODSEQ response code and return this data in the untagged 54 SEARCH/SORT responses. 55 8. Updated RFC number for the IMAP4rev1 document. 57 Changes from -08 to -09: 58 1. Added an extended example about reporting regular (non-conditional) flag 59 changes to other sessions. 60 2. Simplified FETCH MODSEQ syntax by removing per-metadata requests and 61 responses. 63 Changes from -07 to -08: 64 1. Added note saying the change to UIDVALIDITY also invalidates HIGHESTMODSEQ. 65 2. Fixed several bugs in ABNF for STATUS and STORE commands. 67 Changes from -06 to -07: 68 1. Added clarification that when a server does command reordering, the second 69 completed operation gets the higher mod sequence. 70 2. Renamed annotation type specifier "both" to "all" as per suggestion 71 from Minneapolis meeting. 72 3. Removed PERFLAGMODSEQ capability, as it doesn't buy anything: a client 73 has to work with both types of servers (i.e. servers that support per 74 message per flag modseqs and servers that support only per message 75 modseqs) anyway. 76 4. Per flag mod-sequences are optional for a server to return. Updated syntax. 77 5. Allow MODSEQ response code only as a result of SEARCH/SORT as suggested 78 by John Myers. MODSEQ response code is not allowed after FETCH or STORE. 80 Changes from -05 to -06: 81 1. Replaced "/message/flags/system" with "/message/flags" to 82 match ANNOTATE draft. 83 2. Extended FETCH/SEARCH/SORT syntax to allow for specifying 84 whether an operation should be performed on a shared or a private 85 annotation (or both). 86 3. Corrected some examples. 88 Changes from -04 to -05: 89 1. Added support for SORT extension. 90 2. Multiple language/spelling fixes by Randall Gellens. 92 Changes from -03 to -04: 93 1. Added text saying that MODSEQ fetch data items cause server 94 to include MODSEQ data response in all subsuquent unsolicited FETCH 95 responses. 96 2. Added "authors address" section. 98 Changes from -02 to -03: 99 1. Changed MODTIME untagged response to MODTIME response code. 100 2. Added MODTIME response code to the tagged OK response for SEARCH. 101 Updated examples accordingly. 102 3. Changed rule for sending untagged FETCH response as a result of 103 STORE when .SILENT prefix is used. If .SILENT prefix is used, 104 server doesn't have to send untagged FETCH response, because 105 MODTIME response code already contains modtime. 106 4. Renamed MODTIME to MODSEQ to make sure there is no confusion 107 between mod-sequence and ACAP modtime. 108 5. Minor ABNF changes. 109 6. Minor language corrections. 111 Changes from -01 to -02: 112 1. Added MODTIME data item to STATUS command. 113 2. Added OK untagged response to SELECT/EXAMINE. 114 3. Clarified that MODIFIED response code contains list of UIDs for 115 conditional UID STORE and message set for STORE. 116 4. Added per-message modtime. 117 5. Added PERFLAGMODTIME capability. 118 6. Fixed several bugs in examples. 119 7. Added more comments to ABNF. 121 Changes from -00 to -01: 122 1. Refreshed the list of Open Issues. 123 2. Changed "attr-name" to "entry-name", because modtime applies to 124 entry, not attribute. 125 3. Added MODTIME untagged response. 126 4. Cleaned up ABNF. 127 5. Added "Acknowledgments" section. 128 6. Fixed some spelling mistakes. 130 Table of Contents 132 1 Abstract .................................................. X 133 2 Conventions Used in This Document ......................... X 134 3 Introduction and Overview ................................. X 135 4 IMAP Protocol Changes ..................................... X 136 4.1 New OK untagged responses for SELECT and EXAMINE ......... X 137 4.1.1 HIGHESTMODSEQ response code ............................ X 138 4.2 STORE and UID STORE Commands ............................. X 139 4.3 MODSEQ message data item in FETCH Command ................ X 140 4.4 MODSEQ search criterion in SEARCH ........................ X 141 4.5 MODSEQ Sort Criterion .................................... X 142 4.6 Modified SEARCH and SORT untagged responses .............. X 143 4.7 HIGHESTMODSEQ status data items .......................... X 144 5 Formal Syntax ............................................. X 145 6 Security Considerations ................................... X 146 7 References ................................................ X 147 7.1 Normative References ..................................... X 148 7.2 Informative References ................................... X 149 8 Acknowledgments ........................................... X 150 9 Author's Addresses ........................................ X 151 10 Full Copyright Statement ................................. X 153 1. Abstract 155 Often, multiple IMAP clients need to coordinate changes to a common 156 IMAP mailbox. Examples include different clients for the same user, 157 and multiple users accessing shared mailboxes. These clients 158 need a mechanism to synchronize state changes for messages within the 159 mailbox. They must be able to guarantee that only one client can change 160 message state (e.g., message flags or annotations) at any time. An 161 example of such an application is use of an IMAP mailbox as a message 162 queue with multiple dequeueing clients. 164 The Conditional Store facility provides a protected update mechanism for 165 message state information that can detect and resolve conflicts between 166 multiple writing mail clients. 168 2. Conventions Used in This Document 170 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 171 "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this 172 document are to be interpreted as described in RFC 2119 [KEYWORDS]. 174 In examples, lines beginning with "S:" are sent by the IMAP server, and 175 lines beginning with "C:" are sent by the client. Line breaks may appear 176 in example commands solely for editorial clarity; when present in 177 the actual message they are represented by "CRLF". 179 Formal syntax is defined using ABNF [ABNF] as modified by [IMAP4]. 181 The term "metadata" or "metadata item" is used throughout this document. 182 It refers to any system or user defined keyword or an annotation 183 [ANNOTATE]. 185 Some IMAP mailboxes are private, accessible only to the owning user. 186 Other mailboxes are not, either because the owner has set an ACL 187 [ACL] which permits access by other users, or because it is a 188 shared mailbox. Let's call a metadata item "shared" for the mailbox 189 if any changes to the metadata items are persistent and visible to all 190 other users accessing the mailbox. Otherwise the metadata item is called 191 "private". Note, that private metadata items are still visible to all 192 sessions accessing the mailbox as the same user. Also note, that different 193 mailboxes may have different metadata items as shared. 195 3. Introduction and Overview 197 The Conditional STORE extension is present in any IMAP4 implementation 198 which returns "CONDSTORE" as one of the supported capabilities in the 199 CAPABILITY command response. 201 Every IMAP message has an associated positive unsigned 64-bit value called a 202 modification sequence (mod-sequence). This is an opaque value updated by 203 the server whenever a metadata item is modified. The value is intended to 204 be used only for comparisons within a server. However, the server MUST 205 guarantee that each STORE command performed on the same mailbox, including 206 simultaneous stores to different metadata items from different connections, 207 will get a different mod-sequence value. Also, for any two successful 208 STORE operations performed in the same session on the same mailbox, 209 the mod-sequence of the second completed operation MUST be greater than 210 the mod-sequence of the first completed. Note that the latter rule disallows 211 the use of the system clock as a mod-sequence, because if system time changes 212 (e.g., a NTP [NTP] client adjusting the time), the next generated value might 213 be less than the previous one. 215 Mod-sequences allow a client that supports the CONDSTORE extension to 216 determine if a message metadata has changed since some known 217 moment. Whenever the state of a flag changes (i.e., the flag is added and 218 before it wasn't set, or the flag is removed and before it was set) the 219 value of the modification sequence for the message MUST be updated. 220 Adding the flag when it is already present or removing when it is not 221 present SHOULD NOT change the mod-sequence. 223 When a message is appended to a mailbox (via the IMAP APPEND command, 224 COPY to the mailbox or using an external mechanism) the server 225 generates a new modification sequence that is higher than the highest 226 modification sequence of all messages in the mailbox and assigns it to 227 the appended message. 229 When an annotation is added, modified or removed the corresponding message 230 mod-sequence MUST be updated. 232 The server MAY store separate (per message) modification sequence values for 233 different metadata items. If the server does so, per message mod-sequence is 234 the highest mod-sequence of all metadata items for the specified message. 236 This extension makes the following changes to the IMAP4 protocol: 238 a) extends the syntax of the STORE command to allow STORE 239 modifiers 241 b) adds the MODIFIED response code which should be used with 242 a NO response to the STORE command 244 c) adds a new MODSEQ message data item for use with the FETCH command 246 d) adds a new MODSEQ search criterion 248 e) extends syntax of untagged SEARCH and SORT responses to include 249 mod-sequence. 251 f) adds a new OK untagged responses for the SELECT and EXAMINE commands 253 g) adds the HIGHESTMODSEQ status data item to the STATUS command 255 h) adds a new MODSEQ sort criterion 257 The rest of this document describes the protocol changes more rigorously. 259 4. IMAP Protocol Changes 261 4.1. New OK untagged responses for SELECT and EXAMINE 263 4.1.1. HIGHESTMODSEQ response code 265 This document adds a new response code that is returned in the OK 266 untagged response for the SELECT and EXAMINE commands. A server 267 supporting the CONDSTORE extension MUST send the OK untagged 268 response including HIGHESTMODSEQ response code with every successful 269 SELECT or EXAMINE command: 271 OK [HIGHESTMODSEQ ] 273 Where is the highest mod-sequence value of all 274 messages in the mailbox. When the server changes UIDVALIDITY for a 275 mailbox, it doesn't have to keep the same HIGHESTMODSEQ for the 276 mailbox. 278 A disconnected client can use the value of HIGHESTMODSEQ to check if 279 it has to refetch flags and/or annotations from the server. If the 280 UIDVALIDITY value has changed for the selected mailbox, the client 281 MUST delete the cached value of HIGHESTMODSEQ. If UIDVALIDITY for 282 the mailbox is the same and if the HIGHESTMODSEQ value stored in 283 the client's cache is less than the value returned by the server, 284 then some metadata items on the server have changed since the last 285 synchronization, and the client needs to update its cache. The client 286 MAY use SEARCH MODSEQ as described in section 4.4 to find out exactly 287 which metadata items have changed. 289 Example: C: A142 SELECT INBOX 290 S: * 172 EXISTS 291 S: * 1 RECENT 292 S: * OK [UNSEEN 12] Message 12 is first unseen 293 S: * OK [UIDVALIDITY 3857529045] UIDs valid 294 S: * OK [UIDNEXT 4392] Predicted next UID 295 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 296 S: * OK [PERMANENTFLAGS (\Deleted \Seen \*)] Limited 297 S: * OK [HIGHESTMODSEQ 20010715194045007] 298 S: A142 OK [READ-WRITE] SELECT completed 300 4.2. STORE and UID STORE Commands 302 Arguments: message set 303 OPTIONAL store modifiers 304 message data item name 305 value for message data item 307 Responses: untagged responses: FETCH 309 Result: OK - store completed 310 NO - store error: can't store that data 311 BAD - command unknown or arguments invalid 313 This document extends the syntax of the STORE and UID STORE 314 commands (see section 6.4.6 of [IMAP4]) to include an optional STORE 315 modifier. The document defines the following modifier: 317 UNCHANGEDSINCE 318 If the mod-sequence of any metadata item specified in the STORE 319 operation for any message in the message set is greater than the 320 specified unchangedsince value, then the command fails. 321 On failure, a MODIFIED response code is returned which includes 322 the message set (for STORE) or set of UIDs (for UID STORE) 323 of all messages that failed the UNCHANGESINCE test. 325 Example: 327 C: a101 STORE 7,5,9 (UNCHANGEDSINCE 20000320162338) 328 +FLAGS.SILENT (\Deleted) 329 S: a101 NO [MODIFIED 7,9] Conditional STORE failed 331 In spite of the failure of the conditional STORE operation 332 for message 7, the server continues to process the conditional 333 STORE in order to find all messages which fail the test. 335 Use of UNCHANGEDSINCE with a modification sequence of 0 336 always fails if the metadata item exists. A system flag 337 MUST always be considered existent, whether it was set or not. 339 Example: 341 C: a102 STORE 12 (UNCHANGEDSINCE 0) 342 +FLAGS.SILENT ($MDNSent) 343 S: a102 NO [MODIFIED 12] Conditional STORE failed 345 Note: A client trying to atomically change the state of a particular 346 flag (or a set of flags) should be prepared to deal with the case 347 when the server returns MODIFIED response code if the state 348 of the flag being watched hasn't changed (but the state of some 349 other flag has). This is necessary, because some servers don't store 350 separate mod-sequences for different flags or annotations. However, 351 server implementations are discouraged from doing that, as it is 352 possible not to return spurious errors even when storing a single 353 mod-sequence per message. 355 Upon the receipt of MODIFIED response code the client SHOULD try to 356 figure out if the required flags have indeed changed. If they haven't 357 the client SHOULD retry the command. 359 Example: 360 C: a106 STORE 100:150 (UNCHANGEDSINCE 200212030000000) 361 +FLAGS.SILENT ($Processed) 362 S: a106 NO [MODIFIED 101] Conditional STORE failed 364 the flag $Processed was set on the message 101 ... 365 C: a107 NOOP 366 S: * 101 FETCH (MODSEQ (200303011130956) FLAGS ($Processed)) 367 S: a107 OK 369 ... so the client retries the operation for the rest of the messages 371 C: a108 STORE 100,102:150 (UNCHANGEDSINCE 200303011130956) 372 +FLAGS.SILENT ($Processed) 373 S: * 100 FETCH (MODSEQ (200303181230852)) 374 S: * 102 FETCH (MODSEQ (200303181230852)) 375 ... 376 S: a108 OK Conditional Store completed 378 Or the flag hasn't changed ... 379 C: b107 NOOP 380 S: * 101 FETCH (MODSEQ (200303011130956) FLAGS (\Deleted \Answered)) 381 S: b107 OK 383 ... and the client retries the operation for all messages 385 C: b108 STORE 100:150 (UNCHANGEDSINCE 200212030000000) 386 +FLAGS.SILENT ($Processed) 387 S: * 100 FETCH (MODSEQ (200303181230852)) 388 S: * 101 FETCH (MODSEQ (200303181230852)) 389 S: * 102 FETCH (MODSEQ (200303181230852)) 390 ... 391 S: b108 OK Conditional Store completed 393 If the operation is successful the server MUST update the 394 mod-sequence attribute for every message that was changed. 395 Untagged FETCH responses MUST be sent (even if .SILENT is 396 specified) and each response MUST include MODSEQ message data 397 item if its mod-sequence has changed. This is required to 398 update clients cache with the correct mod-sequence values. 399 See section 4.3 for more details. 401 Example: 403 C: a103 UID STORE 6,4,8 (UNCHANGEDSINCE 200012121230045) 404 +FLAGS.SILENT (\Deleted) 405 S: * 1 FETCH (UID 4 MODSEQ (200012121231000)) 406 S: * 2 FETCH (UID 6 MODSEQ (200012101230852)) 407 S: * 4 FETCH (UID 8 MODSEQ (200012121130956)) 408 S: a103 OK Conditional Store completed 410 Example: 412 C: a104 STORE * (UNCHANGEDSINCE 200012121230045) +FLAGS.SILENT 413 (\Deleted $Processed) 414 S: * 50 FETCH (MODSEQ (200012111230045)) 415 S: a104 OK Store (conditional) completed 417 Note: If a message is specified multiple times in the message 418 set, and the server doesn't internally eliminate duplicates from 419 the message set, it MUST NOT fail the conditional STORE 420 operation for the second (or subsequent) occurrence of the message 421 if the operation completed successfully for the first occurrence. 422 For example, if the client specifies: 424 a105 STORE 7,3:9 (UNCHANGEDSINCE 200012121230045) 425 +FLAGS.SILENT (\Deleted) 427 the server must not fail the operation for message 7 as part of 428 processing "3:9" if it succeeded when message 7 was processed 429 the first time. 431 4.3. MODSEQ message data item in FETCH Command 433 This extension adds a MODSEQ message data item to the FETCH command. 434 The MODSEQ message data item allows clients to retrieve mod-sequence 435 values for a range of messages in the currently selected mailbox. 437 Once the client specified the MODSEQ message data item in a FETCH request, 438 the server MUST include the MODSEQ fetch response data items in all 439 subsequent unsolicited FETCH responses. 441 Syntax: MODSEQ 443 The MODSEQ message data item causes the server to return MODSEQ fetch 444 response data items. 446 Syntax: MODSEQ ( ) 448 MODSEQ response data items contain per-message mod-sequences. 450 The MODSEQ response data item is returned if the client issued FETCH with 451 MODSEQ message data item. It also allows the server to notify the client 452 about mod-sequence changes caused by conditional STOREs (section 4.2) and/or 453 changes caused by external sources. 455 Example: 457 C: a FETCH 1:3 (MODSEQ) 458 S: * 1 FETCH (MODSEQ (20000624140003)) 459 S: * 2 FETCH (MODSEQ (20000624140007)) 460 S: * 3 FETCH (MODSEQ (20000624140005)) 461 S: a OK Fetch complete 463 In this example the client requests per message mod-sequences for a 464 set of messages. 466 When a flag for a message is modified in a different session, the server 467 sends an unsolicited FETCH response containing the mod-sequence for the 468 message. 470 Example: 472 (Session 1, authenticated as a user "alex"). The user adds a shared 473 flag \Deleted: 475 C: A142 SELECT INBOX 476 ... 477 S: * FLAGS (\Answered \Flagged \Deleted \Seen \Draft) 478 S: * OK [PERMANENTFLAGS (\Answered \Deleted \Seen \*)] Limited 479 ... 481 C: A160 STORE 7 +FLAGS.SILENT (\Deleted) 482 S: * 7 FETCH (MODSEQ (200012121231000)) 483 S: A160 OK Store completed 485 (Session 2, also authenticated as the user "alex"). Any changes to flags 486 are always reported to all sessions authenticated as the same user as in 487 the session 1. 489 C: C180 NOOP 490 S: * 7 FETCH (FLAGS (\Deleted \Answered) MODSEQ (200012121231000)) 491 S: C180 OK Noop completed 493 (Session 3, authenticated as a user "andrew"). As \Deleted is a shared 494 flag, changes in the session 1 are also reported in the session 3: 496 C: D210 NOOP 497 S: * 7 FETCH (FLAGS (\Deleted \Answered) MODSEQ (200012121231000)) 498 S: D210 OK Noop completed 500 The user modifies a private flag \Seen in the session 1 ... 502 C: A240 STORE 7 +FLAGS.SILENT (\Seen) 503 S: * 7 FETCH (MODSEQ (200012121231777)) 504 S: A240 OK Store completed 506 ... which is only reported in the session 2 ... 508 C: C270 NOOP 509 S: * 7 FETCH (FLAGS (\Deleted \Answered \Seen) MODSEQ (200012121231777)) 510 S: C270 OK Noop completed 512 ... but not in the session 3. 514 C: D300 NOOP 515 S: D300 OK Noop completed 517 And finally the user removes flags \Answered (shared) and \Seen (private) 518 in the session 1. 520 C: A330 STORE 7 -FLAGS.SILENT (\Answered \Seen) 521 S: * 7 FETCH (MODSEQ (200012121245160)) 522 S: A330 OK Store completed 524 Both changes are reported in the session 2 ... 526 C: C360 NOOP 527 S: * 7 FETCH (FLAGS (\Deleted) MODSEQ (200012121245160)) 528 S: C360 OK Noop completed 530 ... and only changes to shared flags are reported in session 3. 532 C: D390 NOOP 533 S: * 7 FETCH (FLAGS (\Deleted) MODSEQ (200012121245160)) 534 S: D390 OK Noop completed 536 4.4. MODSEQ search criterion in SEARCH 538 The MODSEQ criterion for the SEARCH command allows a client to search 539 for the metadata items that were modified since a specified moment. 541 Syntax: MODSEQ [ ] 543 Messages that have modification values which are equal to or 544 greater than . This allows a client, 545 for example, to find out which messages contain metadata items 546 that have changed since the last time it updated its disconnected 547 cache. The client may also specify (name of metadata 548 item) and (type of metadata item) before 549 . can be one of "shared", 550 "private" or "all". The latter means that the server should use 551 the biggest value among "private" and "shared" modseqs for the 552 metadata item. If the server doesn't store internally separate 553 mod-sequences for different flags and annotations, it MUST ignore 554 and . Otherwise the server should 555 use them to narrow down the search. 557 For a flag the corresponding has a form 558 "/message/flags/" as defined in [ANNOTATE]. Note, that 559 the leading "\" character that denotes a system flag has to be 560 escaped as per Section 4.3 of [IMAP4], as the uses 561 syntax for quoted strings. 563 If client specifies a MODSEQ criterion in a SEARCH command and 564 the server returns a non-empty SEARCH result, the server MUST also 565 return a MODSEQ response code in the tagged OK response. The MODSEQ 566 response code covers all messages returned in the untagged SEARCH results. 567 See also section 4.6. 569 Example: 570 C: a SEARCH MODSEQ "/message/flags/draft" all 20010320162338 571 ANNOTATION "/message/comment" "value" "IMAP4" 572 S: * SEARCH 2 5 6 7 11 12 18 19 20 23 (MODSEQ 20010917162500) 573 S: a OK Search complete 575 In the above example, the message numbers of any messages 576 containing the string "IMAP4" in the "value" attribute of the 577 "/message/comment" entry and having a mod-sequence equal to or 578 greater than 20010320162338 for the "\Draft" flag are returned in 579 the search results. 581 Example: 582 C: a SEARCH OR NOT MODSEQ 20010320162338 LARGER 50000 583 S: * SEARCH 584 S: a OK Search complete, nothing found 586 4.5. MODSEQ Sort Criterion 588 If a server implementing CONDSTORE also implements the SORT 589 extension as defined by [SORT], it MUST also support sorting on 590 per-message mod-sequence. 592 Syntax: MODSEQ 594 If client specifies a MODSEQ search (as per section 4.4) or sort 595 criterion in the SORT command and the server returns a non-empty 596 SORT result, the server MUST also return a MODSEQ response 597 code in the tagged OK response which covers all messages returned 598 in untagged SORT responses. See also section 4.6. 600 Example: 601 C: A282 SORT (SUBJECT MODSEQ) UTF-8 SINCE 1-Feb-2001 602 S: * SORT 2 81 83 84 82 882 (MODSEQ 117) 603 S: A282 OK SORT completed 605 Example: 606 C: A283 SORT (SUBJECT REVERSE DATE) UTF-8 MODSEQ 21 607 S: * SORT 6 3 4 5 2 (MODSEQ 125) 608 S: A283 OK SORT completed 610 Example: 611 C: A284 SORT (MODSEQ) KOI8-R OR NOT MODSEQ 20010320162338 612 SUBJECT "Privet" 613 S: * SORT 614 S: A284 OK Sort complete, nothing found 616 4.6. Modified SEARCH and SORT untagged responses 618 Data: zero or more numbers 619 mod-sequence value (omitted if no match) 621 This document extends syntax of the untagged SEARCH and SORT responses 622 to include mod-sequence for all messages being returned. 624 If a client specifies a MODSEQ criterion in a SEARCH (or UID SEARCH) 625 command and the server returns a non-empty SEARCH result, the server 626 MUST also append (to the end of the untagged SEARCH response) the 627 highest mod-sequence for all messages being returned. 629 If client specifies a MODSEQ search or sort criterion in a SORT 630 (or UID SORT) command and the server returns a non-empty SORT result, 631 the server MUST also append (to the end of the untagged SORT response) 632 the highest mod-sequence for all messages being returned. 634 4.7. HIGHESTMODSEQ status data items 636 This document defines a new status data item: 638 HIGHESTMODSEQ 639 The highest mod-sequence value all messages 640 in the mailbox. This is the same value that is returned by the server 641 in the HIGHESTMODSEQ response code in OK untagged response 642 (see section 4.1.1). 644 Example: C: A042 STATUS blurdybloop (UIDNEXT MESSAGES HIGHESTMODSEQ) 645 S: * STATUS blurdybloop (MESSAGES 231 UIDNEXT 44292 646 HIGHESTMODSEQ 200201011231777) 647 S: A042 OK STATUS completed 649 5. Formal Syntax 651 The following syntax specification uses the Augmented Backus-Naur 652 Form (ABNF) notation as specified in [ABNF]. 654 Non-terminals referenced but not defined below are as defined by 655 [IMAP4]. 657 Except as noted otherwise, all alphabetic characters are case- 658 insensitive. The use of upper or lower case characters to define token 659 strings is for editorial clarity only. Implementations MUST accept 660 these strings in a case-insensitive fashion. 662 capability =/ "CONDSTORE" 664 status = "STATUS" SP mailbox SP 665 "(" status-att-req *(SP status-att-req) ")" 666 ;; redefine STATUS command syntax defined in [IMAP4] 668 status-att-req = status-att / "HIGHESTMODSEQ" 670 mailbox-data =/ "STATUS" SP mailbox SP "(" 671 [status-rsp-info *(SP status-rsp-info)] ")" 673 status-rsp-info = status-att SP number / 674 "HIGHESTMODSEQ" SP mod-sequence-value 676 store = "STORE" SP set store-modifiers SP store-att-flags 678 store-modifiers = [ SP "(" store-modifier *(SP store-modifier) ")" ] 680 store-modifier = "UNCHANGEDSINCE" SP mod-sequence-valzer 681 ;; Only single "UNCHANGEDSINCE" may be specified 682 ;; in a STORE operation 684 fetch-att =/ fetch-mod-sequence 685 ;; modifies original IMAP4 fetch-att 687 fetch-mod-sequence = "MODSEQ" 689 fetch-mod-resp = "MODSEQ" SP "(" permsg-modsequence ")" 691 search-key =/ search-modsequence 692 ;; modifies original IMAP4 search-key 694 search-modsequence = "MODSEQ" [search-modseq-ext] SP mod-sequence-valzer 696 search-modseq-ext = SP entry-name SP entry-type-req 698 resp-text-code =/ "HIGHESTMODSEQ" SP mod-sequence-value / 699 "MODIFIED" SP set 701 entry-name = '"' "/message/flags/" attr-flag '"' 702 ;; each system or user defined flag 703 ;; is mapped to "/message/flags/". 704 ;; 705 ;; follows the escape rules used 706 ;; by "quoted" string as described in Section 707 ;; 4.3 of [IMAP4], e.g. for the flag \Seen 708 ;; the corresponding is 709 ;; "/message/flags/\\seen", and for the flag 710 ;; $MDNSent, the corresponding 711 ;; is "/message/flags/$mdnsent". 713 entry-type-resp = "private" | "shared" 714 ;; metadata item type 716 entry-type-req = entry-type-resp | "all" 717 ;; perform SEARCH operation on private 718 ;; metadata item, shared metadata item or both 720 permsg-modsequence = mod-sequence-value 721 ;; per message mod-sequence 723 mod-sequence-value = 1*DIGIT 724 ;; Positive unsigned 64-bit integer (mod-sequence) 725 ;; (1 <= n < 18,446,744,073,709,551,615) 727 mod-sequence-valzer = "0" | mod-sequence-value 729 search_sort_mod_seq = "(" "MODSEQ" SP mod-sequence-value ")" 731 sort-key =/ "MODSEQ" 733 ;;Borrowed from IMAP4rev1 and modified accordingly: 735 mailbox-data =/ "SEARCH" [SP nz-number *(SP nz-number) search_sort_mod_seq] / 736 "SORT" [SP nz-number *(SP nz-number) search_sort_mod_seq] 738 attr-flag = "\\Answered" / "\\Flagged" / "\\Deleted" / 739 "\\Seen" / "\\Draft" / attr-flag-keyword / 740 attr-flag-extension 741 ;; Does not include "\Recent" 743 attr-flag-extension = "\\" atom 744 ;; Future expansion. Client implementations 745 ;; MUST accept flag-extension flags. Server 746 ;; implementations MUST NOT generate 747 ;; flag-extension flags except as defined by 748 ;; future standard or standards-track 749 ;; revisions of this specification. 751 attr-flag-keyword = atom 753 6. Security Considerations 755 As a conditional STORE operation must be atomic for a message set, 756 an implementation may choose to use some kind of message or even 757 mailbox level locking for the duration of the conditional STORE 758 operation. Such implementation may suffer from a Deny of Service 759 Attack when conditional STORE is executed on a large mailbox. 761 Other IMAP4 security issues can be found in Security Considerations 762 section of [IMAP4]. 764 7. References 766 7.1. Normative References 768 [KEYWORDS] Bradner, "Key words for use in RFCs to Indicate 769 Requirement Levels", RFC 2119, Harvard University, March 1997. 771 [ABNF] Crocker, Overell, "Augmented BNF for Syntax Specifications: 772 ABNF", RFC 2234, Internet Mail Consortium, Demon Internet Ltd, 773 November 1997. 775 [IMAP4] Crispin, M., "Internet Message Access Protocol - Version 776 4rev1", RFC 3501, University of Washington, March 2003. 778 [ANNOTATE] Gellens, R., Daboo, C., "IMAP ANNOTATE Extension", 779 work in progress. 780 782 [SORT] Crispin, M., "Internet Message Access Protocol -- SORT 783 Extension", work in progress. 784 786 7.2. Informative References 788 [ACAP] Newman, Myers, "ACAP -- Application Configuration Access 789 Protocol", RFC 2244, Innosoft, Netscape, November 1997. 790 792 [ACL] Myers, "IMAP4 ACL extension", RFC 2086, Carnegie Mellon, 793 January 1997. 794 796 [NTP] Mills, D, "Network Time Protocol (Version 3) Specification, 797 Implementation and Analysis", RFC 1305, March 1992. 798 800 8. Acknowledgments 802 Some text was borrowed from "IMAP ANNOTATE Extension" by Randall Gellens 803 and Cyrus Daboo, and "ACAP -- Application Configuration Access Protocol" 804 by Chris Newman and John Myers. 806 Many thanks to Randall Gellens for his comments on how CONDSTORE should 807 interact with ANNOTATE extension and for thorough review of the document. 809 Authors also acknowledge the feedback provided by Cyrus Daboo, Larry 810 Greenfield, Chris Newman, Harrie Hazewinkel, Arnt Gulbrandsen and Timo 811 Sirainen. 813 9. Author's Addresses 815 Alexey Melnikov 816 mailto: mel@messagingdirect.com 818 ACI WorldWide/MessagingDirect 819 59 Clarendon Road, Watford, Hertfordshire, 820 WD17 1FQ, United Kingdom 822 Steve Hole 823 mailto: Steve.Hole@messagingdirect.com 825 ACI WorldWide/MessagingDirect 826 #900, 10117 Jasper Avenue, 827 Edmonton, Alberta, T5J 1W8, CANADA 829 10. Full Copyright Statement 831 Copyright (C) The Internet Society 2001-2003. All Rights Reserved. 833 This document and translations of it may be copied and furnished to 834 others, and derivative works that comment on or otherwise explain it 835 or assist in its implementation may be prepared, copied, published 836 and distributed, in whole or in part, without restriction of any 837 kind, provided that the above copyright notice and this paragraph 838 are included on all such copies and derivative works. However, this 839 document itself may not be modified in any way, such as by removing 840 the copyright notice or references to the Internet Society or other 841 Internet organizations, except as needed for the purpose of 842 developing Internet standards in which case the procedures for 843 copyrights defined in the Internet Standards process must be 844 followed, or as required to translate it into languages other than 845 English. 847 The limited permissions granted above are perpetual and will not be 848 revoked by the Internet Society or its successors or assigns. 850 This document and the information contained herein is provided on an 851 "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING 852 TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING 853 BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION 854 HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF 855 MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. 857 Acknowledgement 859 Funding for the RFC Editor function is currently provided by the 860 Internet Society.