Re: Make unread the same as new
On Wed, Oct 15, 2003 at 09:47:27AM -0400, Ajai Khattri wrote:
> On Wed, Oct 15, 2003 at 02:57:24PM +0900, Derek Martin wrote:
> > ................................................... For example, to
> > speed up message retrieval in mbox folders, you could cache the file
> > offsets of the start of each message, and maybe the start of each
> > message's body.
> Of course, this assumes that the offsets remain the same always - in the real
> networked multi-user world you cannot make such assumptions.
Still, in many cases it could help quite a bit. All it would need is
some sanity checks. That is, test the assumption by making sure the
data at a certain offset actually is a message-start. Since mbox
format relies on textual patterns to divide messages anyway, a simple
pattern match before reading the whole message should suffice.
Now that I think of it, a dictionary of offsets and message-id's could
serve as quite a fast and reliable way to scan just headers. Seek to
the offset, make sure it's a "From " line, then scan in the header,
making sure the message-id matches. If either of the checks fails,
revert to regular old mbox parsing.
Cheers,
Allister