[Spambayes] [Outlook addin] Filtering unread messages on startup

Moore, Paul Paul.Moore@atosorigin.com
Fri Nov 15 09:23:44 2002


From: Tim Peters [mailto:tim.one@comcast.net]

> [Moore, Paul]
>> 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.

I got Mark's changes last night (or in the morning, if you're
Australian...) Tried them today, but got some strange results. The
first time I started Outlook, nothing happened, but that's because
I'd lost my filter definitions (probably my fault, I think I know why
this happened). Then, when I fixed that and restarted, I got the trace
output saying that "0 missed messages" had been handled.

Looking at the code for GetNewUnscoredMessageGenerator, it seems to
scan the folder for messages with Unread = True and no "Spam" field.
There were 40 or so unread messages, so I can only assume that they
had a Spam field.

I don't know enough about MAPI to diagnose this much further - I do,
however, have the "Spam" field displayed in my Inbox - could that be
enough to cause the field to be automatically created? On the other
hand, manually filtering with the "unread only" and "only messages not
already filtered" checkboxes set on, *did* filter the messages. But
that uses a different method at the moment, checking message.unread
and message.GetField(mgr.config.field_score_name). So it would filter
a message with a defined, but empty, "Spam" property.

I think that GetNewUnscoredMessageGenerator needs to allow for
messages with an existing but empty "Spam" field. I *think* this means
you want to extend the restriction from

    AND
        PROPERTY = UNREAD (UNREAD, True)
        NOT EXISTS "Spam"

to

    AND
        PROPERTY = UNREAD (UNREAD, True)
        OR
            NOT EXISTS "Spam"
            PROPERTY = "Spam" ("Spam", PT_NULL)

(excuse weird pseudo-code description).

But I know Mark will be better able to make the appropriate fix :-)

Paul.



More information about the Spambayes mailing list