Hi Timo - hope things are well :) Playing around with the CONDSTORE (RFC 4551) stuff while testing the IMAP lib I am writing and I think I have found a bug in Dovecot 1.2.

RFC 4551 [4] identifies the FETCH response to a MODSEQ request as follows:
   fetch-mod-resp      = "MODSEQ" SP "(" permsg-modsequence ")"

with 'permsg-modsequence' defined as:
   permsg-modsequence  = mod-sequence-value
                          ;; per message mod-sequence

Unfortunately, Dovecot 1.2 is returning as follows:
S: * 1 FETCH (UID 1 MODSEQ 3 FLAGS (\Flagged \Deleted \Recent))

Where, under the RFC, I believe it should be:
S: * 1 FETCH (UID 1 MODSEQ (3) FLAGS (\Flagged \Deleted \Recent))

Here is a proposed patch (WARNING: my C skills = zero):

# HG changeset patch
# User [EMAIL PROTECTED]
# Date 1224040830 21600
# Branch HEAD
# Node ID 0c0615bc6bf74ccf109049e251a30b8ab5f8ea67
# Parent  40df4d4cced09fa72d37581d0c526416d2c6e3de
per RFC 4551, MODSEQ FETCH responses need to be wrapped in ().

diff -r 40df4d4cced0 -r 0c0615bc6bf7 src/imap/imap-fetch.c
--- a/src/imap/imap-fetch.c     Tue Oct 14 14:52:44 2008 +0300
+++ b/src/imap/imap-fetch.c     Tue Oct 14 21:20:30 2008 -0600
@@ -749,7 +749,7 @@
        modseq = mail_get_modseq(mail);
        if (ctx->client->highest_fetch_modseq < modseq)
                ctx->client->highest_fetch_modseq = modseq;
-       str_printfa(ctx->cur_str, "MODSEQ %llu ",
+       str_printfa(ctx->cur_str, "MODSEQ (%llu) ",
                    (unsigned long long)modseq);
        return 1;
 }


Hope this helps/is correct.

michael

Reply via email to