[spambayes-dev] [ spambayes-Bugs-716684 ] Filtering marks message as unread

SourceForge.net noreply at sourceforge.net
Thu Jul 3 23:23:37 EDT 2003


Bugs item #716684, was opened at 2003-04-07 23:28
Message generated for change (Comment added) made by anadelonbrin
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=716684&group_id=61702

Category: Outlook
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Mark Hammond (mhammond)
Assigned to: Mark Hammond (mhammond)
Summary: Filtering marks message as unread

Initial Comment:
Reported too many times :)  Exchange server users only.

As spambayes startsit starts processing missed
messages.  In the meantime, the user reads some
messages, thereby marking them as read.  As smapbayes
writes the spam field, these messages spring back to a
read status.

----------------------------------------------------------------------

>Comment By: Tony Meyer (anadelonbrin)
Date: 2003-07-04 17:23

Message:
Logged In: YES 
user_id=552329

>From the list:  a user had the same problem, but also noted 
this:

> If an attachment is included, the first time I open the 
> message, I cannot open the attachement, or save it. If I 
> close the message, and reopen it, I can both open and 
save 
> the attachment.

Odd!  I don't get this problem very often at all anymore; I 
don't know why.  If I did, I'd test the attachment theory, but 
as it is, I can't, so I leave it for others ;)

----------------------------------------------------------------------

Comment By: Paul Moore (pmoore)
Date: 2003-04-11 00:01

Message:
Logged In: YES 
user_id=113328

I just had this happen to me again. I'm using the CVS version 
from a day or two ago.

So the version in current CVS isn't (completely) fixed.

Anythong else I could try? I see part of a thread about 
USE_DEFERRED_ERRORS here, but I can't find the original. 
My code has USE_DEFERRED_ERRORS in it. If you can tell 
me what (if anything) else needs changing, I can try taking it 
out.

----------------------------------------------------------------------

Comment By: David Bolen (db3l)
Date: 2003-04-09 03:07

Message:
Logged In: YES 
user_id=53196

Just as an FYI, I agree with tobermory's comments in that 
spambayes is in fact classifying the message immediately, 
but it's the update to the server and/or client that appears to 
be delayed until the next Outlook event.  See the first of my 
two spambayes list mail messages referenced in my note 
Mark included in this bug.

----------------------------------------------------------------------

Comment By: David Bolen (db3l)
Date: 2003-04-09 03:03

Message:
Logged In: YES 
user_id=53196

> Would it be possible to try another change for me instead?  
Revert
> filter.py, and in msgstore.py's Save method, find the line:
> 
>             self.mapi_object.SaveChanges
(mapi.KEEP_OPEN_READWRITE |
> USE_DEFERRED_ERRORS)

I'm pretty sure I had tried that first, while experimenting, 
before I
ended up with the extra Save as a final "flush all" attempt.  
There
was no change, nor did the function return an error.  I think I 
also
tried setting it to 0 (after reading the internal comment) to no
apparent effect, although I may be misremembering since the 
same
comment may have caused me to hesitate to make that 
change :-)

But I'll double check this when I get a chance today.  If I recall
when testing, my review of the code seemed to indicate that 
everything
should work fine, and that the spambayes code was 
managing the read
flag reasonably well, and in fact, was issuing a Save() back in
filter.py.  I ended up inserting test Save()s at the lowermost 
level
(which worked) and then bubbling them up to see how high I 
could leave
the extra call so it was called as infrequently as possible.

In the end, the issue seemed related to the processing that 
goes on
when all_actions is enabled.  If the Save() occurred after the 
field
status was updated, but before 
RememberMessageCurrentFolder() was
called, all was fine.  But if the 
RememberMessageCurrentFolder() got
called first, then the following Save() - as already in filter.py -
didn't seem to "take."

> I'm a little unsure why one of the Save calls is indented too.

Ah, that was just to minimize change from the existing code 
path.

I wanted to move the Save() to happen before
RememberMessageCurrentFolder(), but then the second Save
() became
completely superfluous in the main branch case - but I didn't 
want to
lose the Save() following RememberMessageCurrentFolder() if 
it was
called just in case that was critical to existing behavior, so I 
moved
it to only occur in that same block.

-- David

----------------------------------------------------------------------

Comment By: David Leftley (tobermory)
Date: 2003-04-08 21:08

Message:
Logged In: YES 
user_id=626601

Just to try and clarify one point: earlier msgs in this thread 
suggest that spambayes doesn't attempt to classify a 
message until certain events (reading a msg, etc.) occur.

In fact from watching the trace output, the message is 
classified as soon as it arrives (the trace 
shows "Message 'xxx' had a Spam classification of 'yyy'") but 
Outlook doesn't reflect this change until the next event occurs.

----------------------------------------------------------------------

Comment By: Paul Moore (pmoore)
Date: 2003-04-08 20:21

Message:
Logged In: YES 
user_id=113328

My version of filter.py looks different. I haven't updated from 
CVS in a while, maybe that's why. But my version looks like 
it has msg.Save() called unconditionally.

    try:
        # Save the score
        msg.SetField(mgr.config.field_score_name, prob)
        # and the ID of the folder we were in when scored.
        msg.RememberMessageCurrentFolder()
        msg.Save()

I've tried moving msg.Save() to before msg.Remember...(), but 
I'll have to wait to see results. Will report back.

(Better might be to cvs update and apply your change, but I 
may not get a chance to do that for a couple of days...)

----------------------------------------------------------------------

Comment By: Mark Hammond (mhammond)
Date: 2003-04-08 14:21

Message:
Logged In: YES 
user_id=14198

>From David Bolen:
"Moore, Paul" <Paul.Moore at atosorigin.com> writes:

> As far as I know, no-one has been able to track down the 
> problem to fix it yet.

I have, however, implemented a local workaround that's
working really well for me.  This was based on my prior
messages in:

   
http://mail.python.org/pipermail/spambayes/2003-March/004086.html
   
http://mail.python.org/pipermail/spambayes/2003-March/004088.html

Since I can't quantify what if any penalty it imposes in the
general
case by syncing changes back to the server an additional
time, and
since the problem may be limited to Exchange servers, I haven't
proposed it be made to the main source yet - although I
certainly
haven't noticed much of a penalty in my local testing.

But if anyone else wants to try a local change, it's fairly
trivial,
adding an additional call to msg.Save() in filter.py:

    *** filter.py   18 Mar 2003 03:09:03 -0000      1.20
    --- filter.py   7 Apr 2003 22:18:58 -0000
    ***************
    *** 27,39 ****
          try:
              # Save the score
              msg.SetField(mgr.config.field_score_name, prob)
              # and the ID of the folder we were in when scored.
              # (but only if we want to perform all actions)
              # Note we must do this, and the Save, before the
              # filter, else the save will fail.
              if all_actions:
                  msg.RememberMessageCurrentFolder()
    !         msg.Save()

              if all_actions and attr_prefix is not None:
                  folder_id = getattr(config, attr_prefix +
"_folder_id")
    --- 26,39 ----
          try:
              # Save the score
              msg.SetField(mgr.config.field_score_name, prob)
    +         msg.Save()
              # and the ID of the folder we were in when scored.
              # (but only if we want to perform all actions)
              # Note we must do this, and the Save, before the
              # filter, else the save will fail.
              if all_actions:
                  msg.RememberMessageCurrentFolder()
    !             msg.Save()

              if all_actions and attr_prefix is not None:
                  folder_id = getattr(config, attr_prefix +
"_folder_id")


After making this change, what went from virtually _every_
message staying unread, became the extreme rare case, such
that I'm no longer certain any remaining case may even be
spambayes related.


----------------------------------------------------------------------

Comment By: Martin Worger (worger)
Date: 2003-04-07 23:58

Message:
Logged In: YES 
user_id=751487

A bit of investigation (I am using Outlook 2002 & Exchange 
2000).

A new message arriving in my Inbox does not get analysed by 
SpamBayes until:
- You switch to another folder and back again.
- You read the message (then analysed, but remains 'unread')
- Another email arrives, when the first message is then rated 
(second one not rated though)
- Another email in Inbox is saved after editing
In other words, it seems some other action eventually triggers 
the analysis - not the arrival event itself.

An email that is read before it has been analysed by 
SpamBayes will always be 'unread' afterwards. This is 
independent of type (plain, rich text or HTML)

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=498103&aid=716684&group_id=61702



More information about the spambayes-dev mailing list