On Thu, 26 Sep 2002 17:40:24 +0100 (BST), Mark Elvers wrote:
> I could search the mailbox
> for unseen messages but that seems a lot of work to get the unseen count!
The simple answer is:
It seems like a lot work to search the mailbox for unseen messages to get the
unseen count, but that is *much* less work than mail_status().
As long as you make sure that the elts have valid (elt->valid) status, you can
look at the flags directly with something like:
for (unseen = 0, msgno = 1; msgno <= stream->msgno; ++msgno)
if (!mail_elt (stream,msgno)->seen) ++unseen;
You can make sure that the elts have valid status with mail_fetch_flags() or
mail_fetch_fast(), which only need to be called once in a session for any
message. You don't have to worry about valid status issues at all unless you
are using IMAP.