the recent response is a PITA when using a database backend. the
specification is (as is expected with IMAP) not  unequivocal:

<blockquote cite='http://www.faqs.org/rfcs/rfc3501.html'>
7.3.2. RECENT Response

 Contents: none

 The RECENT response reports the number of messages with the
 \Recent flag set. This response occurs as a result of a SELECT or
 EXAMINE command, and if the size of the mailbox changes (e.g., new
 messages).

 Note: It is not guaranteed that the message sequence
 numbers of recent messages will be a contiguous range of
 the highest n messages in the mailbox (where n is the
 value reported by the RECENT response). Examples of
 situations in which this is not the case are: multiple
 clients having the same mailbox open (the first session
 to be notified will see it as recent, others will
 probably see it as non-recent), and when the mailbox is
 re-ordered by a non-IMAP agent.

 The only reliable way to identify recent messages is to
 look at message flags to see which have the \Recent flag
 set, or to do a SEARCH RECENT.
</blockquote>

ATM response are cleared when a new count is called for. this means that:

* SEARCH will not usually return recent messages correct since the
flag will be cleared upon next append or select.
* RECENT almost always returns just one

probably the best approach would be to clear recent flags not when
they are first viewed by a session but when a session unselects a
mailbox. this approach will ensure that SEARCH and RECENT report
correct values when a single session is logged in.

it may cause some unusual behaviour when more than one session has the
same mailbox selected: when another session unselects that mailbox,
all the recent flags for that mailbox will be cleared. so, a client
may see * 5 RECENT reported but when SEARCH RECENT is called, no
responses wil be returned.

an alternative would be to remove RECENT from the database and store
it just in memory

opinions?

- robert

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to