--
John A. Tamplin
Unix Systems Administrator
--- /src.new/stock/cyrus-imapd-2.1.11/imap/imapd.c Mon Nov 18 10:50:15 2002 +++ imapd.c Mon Dec 23 19:15:46 2002 @@ -2948,8 +2948,8 @@ if (usinguid) { fetchitems |= FETCH_UID; - index_check(imapd_mailbox, 1, 0); } + index_check(imapd_mailbox, usinguid, 1); fetchargs.fetchitems = fetchitems; index_fetch(imapd_mailbox, sequence, usinguid, &fetchargs, @@ -2958,6 +2958,9 @@ if (fetchedsomething || usinguid) { prot_printf(imapd_out, "%s OK %s\r\n", tag, error_message(IMAP_OK_COMPLETED)); + if(fetchargs.fetchitems & FETCH_SETSEEN) { + index_check(imapd_mailbox,usinguid,1); + } } else { /* normal FETCH, nothing came back */ prot_printf(imapd_out, "%s NO %s\r\n", tag, @@ -3065,7 +3068,8 @@ index_fetch(imapd_mailbox, msgno, 0, &fetchargs, &fetchedsomething); - index_check(imapd_mailbox, 0, 0); + index_check(imapd_mailbox, 0, + fetchedsomething && (fetchargs.fetchitems & FETCH_SETSEEN)); if (fetchedsomething) { prot_printf(imapd_out, "%s OK %s\r\n", tag, @@ -3201,7 +3205,9 @@ r = index_store(imapd_mailbox, sequence, usinguid, &storeargs, flag, nflags); - if (usinguid) { + if(storeargs.seen || storeargs.operation==STORE_REPLACE) { + index_check(imapd_mailbox, usinguid, 1); + } else if (usinguid) { index_check(imapd_mailbox, 1, 0); }