[Spambayes-checkins] spambayes imapfilter.py,1.47,1.48

Tony Meyer anadelonbrin at users.sourceforge.net
Sun Jun 22 21:13:14 EDT 2003


Update of /cvsroot/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv12678

Modified Files:
	imapfilter.py 
Log Message:
If appending fails, try without including the flags, letting the user know
that flag information will be lost.

This is a band-aid fix - it would be much better to try and establish
which flags cannot be appended.

Index: imapfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/imapfilter.py,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** imapfilter.py	23 Jun 2003 02:54:07 -0000	1.47
--- imapfilter.py	23 Jun 2003 03:13:12 -0000	1.48
***************
*** 39,49 ****
  
  Warnings:
!     o This is very alpha.  The filter is currently being developed and
        tested.  We do *not* recommend using it on a production system unless
        you are confident that you can get your mail back if you lose it.  On
        the other hand, we do recommend that you test it for us and let us
!       know if anything does go wrong.  Once this appears in a release,
!       rather than just cvs, you can feel a *little* <wink> more confident
!       about using it.
      o By default, the filter does *not* delete, modify or move any of your
        mail.  Due to quirks in how imap works, new versions of your mail are
--- 39,47 ----
  
  Warnings:
!     o This is alpha software!  The filter is currently being developed and
        tested.  We do *not* recommend using it on a production system unless
        you are confident that you can get your mail back if you lose it.  On
        the other hand, we do recommend that you test it for us and let us
!       know if anything does go wrong.
      o By default, the filter does *not* delete, modify or move any of your
        mail.  Due to quirks in how imap works, new versions of your mail are
***************
*** 367,371 ****
          response = imap.uid("FETCH", self.uid, "(FLAGS INTERNALDATE)")
          self._check(response, 'fetch (flags internaldate)')
-         #print response
          data = _extract_fetch_data(response[1][0])
          if data.has_key("INTERNALDATE"):
--- 365,368 ----
***************
*** 383,386 ****
--- 380,391 ----
          response = imap.append(self.folder.name, flags,
                                 msg_time, self.as_string())
+         if response[0] == "NO":
+             # This may be because we have tried to set an invalid flag.
+             # Try again, losing all the flag information, but warn the
+             # user that this has happened.
+             response = imap.append(self.folder.name, None, msg_time,
+                                    self.as_string())
+             if response[0] == "OK":
+                 print "WARNING: Could not append flags: %s" % (flags,)
          self._check(response, 'append')
  





More information about the Spambayes-checkins mailing list