[Spambayes-checkins] spambayes/Outlook2000 msgstore.py,1.61,1.62
Mark Hammond
mhammond at users.sourceforge.net
Thu Aug 7 20:52:03 EDT 2003
Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs1:/tmp/cvs-serv29153
Modified Files:
msgstore.py
Log Message:
Fix [ 782709 ] not match between actual score and what's shown in outlook
We can't trust potentially large properties in the data used to create
the msg object. Thanks Tim, Tony, everyone.
Index: msgstore.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/msgstore.py,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** msgstore.py 31 Jul 2003 12:30:00 -0000 1.61
--- msgstore.py 8 Aug 2003 02:52:01 -0000 1.62
***************
*** 348,352 ****
return "".join(chunks)
except pythoncom.com_error, d:
! print "Error getting property from stream", d
return ""
--- 348,353 ----
return "".join(chunks)
except pythoncom.com_error, d:
! print "Error getting property", mapiutil.GetPropTagName(prop_id), \
! "from stream:", d
return ""
***************
*** 507,510 ****
--- 508,518 ----
# prop_row is a single mapi property row, with fields as above.
+ # NOTE: We can't trust these properties for "large" values
+ # (ie, strings, PT_BINARY, objects etc.), as they sometimes come
+ # from the IMAPITable (which has a 255 limit on property values)
+ # and sometimes from the object itself (which has no restriction).
+ # This limitation is documented by MAPI.
+ # Thus, we don't trust "PR_TRANSPORT_MESSAGE_HEADERS_A" more than
+ # to ask "does the property exist?"
tag, eid = prop_row[0] # ID
tag, store_eid = prop_row[1]
***************
*** 520,533 ****
self.msgclass = msgclass
self.subject = subject
! if PROP_TYPE(headers_tag)==PT_STRING8:
! self.headers = headers
! has_headers = True
! else:
! # headers probably too big for simple property fetch - this is
! # the case if we got back MAPI_E_NOT_ENOUGH_MEMORY
! # (but don't bother fetching the header yet)
! has_headers = PROP_TYPE(headers_tag)==PT_ERROR and \
! headers==mapi.MAPI_E_NOT_ENOUGH_MEMORY
! self.headers = None
# Search key is the only reliable thing after a move/copy operation
# only problem is that it can potentially be changed - however, the
--- 528,532 ----
self.msgclass = msgclass
self.subject = subject
! has_headers = PROP_TYPE(headers_tag)==PT_STRING8
# Search key is the only reliable thing after a move/copy operation
# only problem is that it can potentially be changed - however, the
***************
*** 601,617 ****
self._EnsureObject()
- if self.headers is None: # they were too large when created!
- prop_ids = (PR_TRANSPORT_MESSAGE_HEADERS_A,)
- hr, data = self.mapi_object.GetProps(prop_ids,0)
- self.headers = self._GetPotentiallyLargeStringProp(prop_ids[0], data[0])
- headers = self.headers
-
prop_ids = (PR_BODY_A,
MYPR_BODY_HTML_A,
! PR_HASATTACH)
hr, data = self.mapi_object.GetProps(prop_ids,0)
body = self._GetPotentiallyLargeStringProp(prop_ids[0], data[0])
html = self._GetPotentiallyLargeStringProp(prop_ids[1], data[1])
has_attach = data[2][1]
# Some Outlooks deliver a strange notion of headers, including
--- 600,612 ----
self._EnsureObject()
prop_ids = (PR_BODY_A,
MYPR_BODY_HTML_A,
! PR_HASATTACH,
! PR_TRANSPORT_MESSAGE_HEADERS_A)
hr, data = self.mapi_object.GetProps(prop_ids,0)
body = self._GetPotentiallyLargeStringProp(prop_ids[0], data[0])
html = self._GetPotentiallyLargeStringProp(prop_ids[1], data[1])
has_attach = data[2][1]
+ headers = self._GetPotentiallyLargeStringProp(prop_ids[3], data[3])
# Some Outlooks deliver a strange notion of headers, including
More information about the Spambayes-checkins
mailing list