[Spambayes-checkins] spambayes/Outlook2000 msgstore.py,1.32,1.33
Mark Hammond
mhammond@users.sourceforge.net
Sat Nov 23 04:58:59 2002
Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs1:/tmp/cvs-serv6187
Modified Files:
msgstore.py
Log Message:
Change the way we detect unread messages (this seems to work with
Exchange), skip all non "IPM.Note*" message classes, and remove debug
print that doesn't seem necessary any more.
Index: msgstore.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/msgstore.py,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** msgstore.py 21 Nov 2002 02:57:05 -0000 1.32
--- msgstore.py 23 Nov 2002 04:58:56 -0000 1.33
***************
*** 86,89 ****
--- 86,90 ----
MESSAGE_MOVE = 0x1 # from MAPIdefs.h
+ MSGFLAG_READ = 0x1 # from MAPIdefs.h
MYPR_BODY_HTML_A = 0x1013001e # magic <wink>
MYPR_BODY_HTML_W = 0x1013001f # ditto
***************
*** 282,285 ****
--- 283,292 ----
folder = self.msgstore._OpenEntry(self.id)
table = folder.GetContentsTable(0)
+ # Limit ourselves to IPM.Note objects - ie, messages.
+ restriction = (mapi.RES_PROPERTY, # a property restriction
+ (mapi.RELOP_GE, # >=
+ PR_MESSAGE_CLASS_A, # of the this prop
+ (PR_MESSAGE_CLASS_A, "IPM.Note"))) # with this value
+ table.Restrict(restriction, 0)
prop_ids = PR_ENTRYID, PR_SEARCH_KEY, PR_CONTENT_UNREAD
table.SetColumns(prop_ids, 0)
***************
*** 306,317 ****
table.SetColumns(prop_ids, 0)
# Set up the restriction
! prop_restriction = (mapi.RES_PROPERTY, # a property restriction
! (mapi.RELOP_EQ, # check for equality
! PR_CONTENT_UNREAD, # of the unread flag
! (PR_CONTENT_UNREAD, True))
! )
exist_restriction = mapi.RES_EXIST, (field_id,)
not_exist_restriction = mapi.RES_NOT, (exist_restriction,)
! restriction = (mapi.RES_AND, (prop_restriction, not_exist_restriction))
table.Restrict(restriction, 0)
while 1:
--- 313,332 ----
table.SetColumns(prop_ids, 0)
# Set up the restriction
! # Need to check message-flags - PR_CONTENT_UNREAD "optional"
! prop_restriction = (mapi.RES_BITMASK, # a bitmask restriction
! (mapi.BMR_EQZ, # when bit is clear
! PR_MESSAGE_FLAGS,
! MSGFLAG_READ))
exist_restriction = mapi.RES_EXIST, (field_id,)
not_exist_restriction = mapi.RES_NOT, (exist_restriction,)
! # A restriction for the message class
! class_restriction = (mapi.RES_PROPERTY, # a property restriction
! (mapi.RELOP_GE, # >=
! PR_MESSAGE_CLASS_A, # of the this prop
! (PR_MESSAGE_CLASS_A, "IPM.Note"))) # with this value
! # Put the final restriction together
! restriction = (mapi.RES_AND, (prop_restriction,
! not_exist_restriction,
! class_restriction))
table.Restrict(restriction, 0)
while 1:
***************
*** 485,494 ****
sub = msg.get_payload(0)
body = sub.get_payload()
-
- if not html and not body:
- # MarkH has only ever seen this when it is indeed true!
- # (generally as the message has an attachment and nothing else)
- print "Couldn't find any useful body for message '%s'" \
- % (self.GetField(PR_SUBJECT_A),)
return "%s\n%s\n%s" % (headers, html, body)
--- 500,503 ----
More information about the Spambayes-checkins
mailing list