[Spambayes] [Outlook addin] Filtering unread messages on startup
Thu Nov 14 16:12:23 2002
> Here's a first cut at filtering any new unread messages when Outlook
> starts up (important for Exchange or IMAP users).
Note that Mark Hammond already checked in something toward the same end.
> First, the msg.unread property doesn't seem to be set right - the
> diagnostic output shows my code having filtered all of my inbox, not
> just the unread messages. This, if true, is obviously a bug. (On the
> other hand, it may be a bug in my code - I don't understand that stuff
> too well...) I can't see a simple way of checking this.
> Maybe I should only filter unread, unscored messages - the attached
> code doesn't do this, as I would have to wait for new mail to arrive
> if I were skipping scored messages. I'll add that once the basic thing
> is working.
> Second, an efficiency point - I'm going through the whole inbox via
> GetMessageGenerator(). In my case, my inbox has 365 messages, with
> only 4 unread.
Mark added code to display time consumed by the startup scan. On my lean
Work mailbox, it's like so:
rocessing 0 missed spam in folder 'Inbox' took 1.86141ms
Processing 0 missed spam in folder 'Zope' took 6.21308ms
Processing 0 missed spam in folder 'Bayes' took 1.91225ms
Processing 0 missed spam in folder 'Checkins' took 0.590019ms
The Zope folder there had over 400 pending msgs, and 6ms to note >400
previously scored msgs is nothing.
> I was going to use the MAPI Find/FindNext methods, but the msgstore code
> doesn't expose them. Would it be worth having a method for just scanning
> unread messages (it could be used in the filter dialog, too)?
See the new GetNewUnscoredMessageGenerator() (in msgstore.py). Mark uses a
method now that sucks out 70 unread and unscored msgs per MAPI call.
More information about the Spambayes