[imp] Virtual INBOX and Trash weirdness
Michael M Slusarz
slusarz at mail.curecanti.org
Tue Jul 19 13:59:47 PDT 2005
Quoting Darragh Bailey <felix at compsoc.nuigalway.ie>:
> Quoting Michael M Slusarz <slusarz at mail.curecanti.org>:
>
>> It's a limit of imap_status() - it only returns the unseen deleted
>> messages without regard to whether they are flagged deleted or not.
>> THe only way around this is to list the flags of every message in every
>> mailbox to get an accurate count - a bad solution.
>>
>> Maybe a better solution is, if using Virtual Trash, then when the
>> messages are deleted they are marked as seen.
>>
>> michael
>
>
> Spotted this sometime ago on a website I help maintain and keep
> meaning to look
> at adding some code to solve it. One of the suggestions that I came
> up with was
> to use a combination of 2 functions and the session
>
> use function
> object imap_status ( resource imap_stream, string mailbox, int options)
>
> to retreive the unread messages, but will also return unread deleted
> messages.
>
> Store this number in the session as the total unread messages.
>
> use function
> array imap_search ( resource imap_stream, string criteria [, int options [,
> string charset]])
> In which you can specify "UNREAD UNDELETED"
>
> store the size of the array as the unread messages.
>
> Then you need only call the imap_search function in the future if the total
> unread messages stored in the session and the number returned by imap_status
> differ.
>
>
> No idea though just how expensive it is to call imap_search, nor in
> general how
> often it would get called.
imap_search() have to be called for *every* polled folder *every* time
either the folder screen is displayed or the sidebar is refreshed. and
imap_search() is a much more intense resource hog than imap_status().
michael
_______________________________________
Michael Slusarz [slusarz at curecanti.org]
More information about the imp
mailing list