[Spambayes-checkins] spambayes imapfilter.py,1.13,1.14
Tony Meyer
anadelonbrin at users.sourceforge.net
Wed Apr 16 18:08:20 EDT 2003
Update of /cvsroot/spambayes/spambayes
In directory sc8-pr-cvs1:/tmp/cvs-serv32173
Modified Files:
imapfilter.py
Log Message:
Fix the invalid date problem reported by Oliver Maunder.
Index: imapfilter.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/imapfilter.py,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** imapfilter.py 15 Apr 2003 02:22:42 -0000 1.13
--- imapfilter.py 17 Apr 2003 00:08:17 -0000 1.14
***************
*** 20,24 ****
-h : help
-v : verbose mode
! -e y/n : sets expunge to the *opposite* of options.imap_expunge
-i debuglvl : a somewhat mysterious imaplib debugging level
-l minutes : period of time between filtering operations
--- 20,24 ----
-h : help
-v : verbose mode
! -e y/n : expunge/purge messages on exit (y) or not (n)
-i debuglvl : a somewhat mysterious imaplib debugging level
-l minutes : period of time between filtering operations
***************
*** 79,82 ****
--- 79,83 ----
import getopt
import email.Parser
+ from email.Utils import parsedate
from spambayes.Options import options
***************
*** 131,135 ****
# just use the current time.
try:
! return self["Date"]
except KeyError:
return imaplib.Time2Internaldate(time.time())
--- 132,136 ----
# just use the current time.
try:
! return imaplib.Time2Internaldate(time.mktime(parsedate(self["Date"])))
except KeyError:
return imaplib.Time2Internaldate(time.time())
***************
*** 150,167 ****
time_stamp, self.as_string())
self._check(response, 'append')
- # we need to update the uid, as it will have changed
- # XXX there will be problems here if the message *has not*
- # XXX changed, as the message to be deleted will be found first
- # XXX (if they are in the same folder)
- # response = imap.uid("SEARCH", "(TEXT)", self.as_string())
- # self._check(response, 'search')
- # new_id = response[1][0]
- # XXX This fails at the moment and needs to be resolved,
- # XXX but it can't be properly checked until the header
- # XXX adding part of the message class works.
- # XXX For the moment, having a new empty-string id just
- # XXX mucks up our message database, not the training or
- # XXX filtering itself
- new_id = ""
old_id = self.id
--- 151,154 ----
***************
*** 174,177 ****
--- 161,174 ----
self._check(response, 'store')
+ # We need to update the uid, as it will have changed
+ # XXX There will be problems here if the message *has not*
+ # XXX changed, as the message to be deleted will be found first
+ # XXX (if they are in the same folder)
+ self.folder.Select(True)
+ #response = imap.uid("SEARCH", "TEXT", self.as_string())
+ #self._check(response, 'search')
+ #new_id = response[1][0]
+ new_id = ""
+
#XXX This code to delete the old message id from the message
#XXX info db and manipulate the message id, is a *serious* hack.
***************
*** 179,183 ****
message.msginfoDB._delState(self)
-
self.id = new_id
self.modified()
--- 176,179 ----
***************
*** 404,408 ****
imap_filter = IMAPFilter(classifier, imapDebug)
! while 1:
if doTrain:
if options.verbose:
--- 400,404 ----
imap_filter = IMAPFilter(classifier, imapDebug)
! while True:
if doTrain:
if options.verbose:
More information about the Spambayes-checkins
mailing list