[Spambayes-checkins] spambayes/Outlook2000 msgstore.py,1.21,1.22

Mark Hammond mhammond@users.sourceforge.net
Tue Nov 5 11:44:30 2002


Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory usw-pr-cvs1:/tmp/cvs-serv14881

Modified Files:
	msgstore.py 
Log Message:
Fix a few typos in comments, and code!

Also adding a check if the message has attachments - currently not used, 
but will be soon (to handle multipart/signed messages) - was in the code
then found the typos, so decided I should get 'em in.

[DoCopyMode -> DoCopyMove does get me wondering about the utility of
auto-complete in editors tho' <0.1 wink>]


Index: msgstore.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/msgstore.py,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** msgstore.py	4 Nov 2002 00:41:08 -0000	1.21
--- msgstore.py	5 Nov 2002 11:44:27 -0000	1.22
***************
*** 296,301 ****
          # only problem is that it can potentially be changed - however, the
          # Outlook client provides no such (easy/obvious) way
!         # (ie, someone would need to really want to change it <wink>
!         # This, searchkey is the only reliable long-lived message key.
          self.searchkey = searchkey
          self.unread = unread
--- 296,301 ----
          # only problem is that it can potentially be changed - however, the
          # Outlook client provides no such (easy/obvious) way
!         # (ie, someone would need to really want to change it <wink>)
!         # Thus, searchkey is the only reliable long-lived message key.
          self.searchkey = searchkey
          self.unread = unread
***************
*** 369,377 ****
          # Oh - and for multipart/signed messages <frown>
          self._EnsureObject()
!         prop_ids = PR_TRANSPORT_MESSAGE_HEADERS_A, PR_BODY_A, MYPR_BODY_HTML_A
          hr, data = self.mapi_object.GetProps(prop_ids,0)
          headers = self._GetPotentiallyLargeStringProp(prop_ids[0], data[0])
          body = self._GetPotentiallyLargeStringProp(prop_ids[1], data[1])
          html = self._GetPotentiallyLargeStringProp(prop_ids[2], data[2])
          # Mail delivered internally via Exchange Server etc may not have
          # headers - fake some up.
--- 369,381 ----
          # Oh - and for multipart/signed messages <frown>
          self._EnsureObject()
!         prop_ids = (PR_TRANSPORT_MESSAGE_HEADERS_A,
!                     PR_BODY_A,
!                     MYPR_BODY_HTML_A,
!                     PR_HASATTACH)
          hr, data = self.mapi_object.GetProps(prop_ids,0)
          headers = self._GetPotentiallyLargeStringProp(prop_ids[0], data[0])
          body = self._GetPotentiallyLargeStringProp(prop_ids[1], data[1])
          html = self._GetPotentiallyLargeStringProp(prop_ids[2], data[2])
+         has_attach = data[3][1]
          # Mail delivered internally via Exchange Server etc may not have
          # headers - fake some up.
***************
*** 382,385 ****
--- 386,395 ----
          elif headers.startswith("Microsoft Mail"):
              headers = "X-MS-Mail-Gibberish: " + headers
+         if not html and not body:
+             # Only ever seen this for "multipart/signed" messages, so
+             # without any better clues, just handle this.
+             # Find all attachments with PR_ATTACH_MIME_TAG_A=multipart/signed
+             pass
+             
          return "%s\n%s\n%s" % (headers, html, body)
  
***************
*** 476,480 ****
              props = ( (mapi.PS_PUBLIC_STRINGS, prop), )
              prop = self.mapi_object.GetIDsFromNames(props, 0)[0]
-             # Docs say PT_ERROR, reality shows PT_UNSPECIFIED
              if PROP_TYPE(prop) == PT_ERROR: # No such property
                  return None
--- 486,489 ----
***************
*** 494,498 ****
          self.dirty = False
  
!     def _DoCopyMode(self, folder, isMove):
  ##        self.mapi_object = None # release the COM pointer
          assert not self.dirty, \
--- 503,507 ----
          self.dirty = False
  
!     def _DoCopyMove(self, folder, isMove):
  ##        self.mapi_object = None # release the COM pointer
          assert not self.dirty, \
***************
*** 517,524 ****
  
      def MoveTo(self, folder):
!         self._DoCopyMode(folder, True)
  
      def CopyTo(self, folder):
!         self._DoCopyMode(folder, True)
  
  def test():
--- 526,533 ----
  
      def MoveTo(self, folder):
!         self._DoCopyMove(folder, True)
  
      def CopyTo(self, folder):
!         self._DoCopyMove(folder, False)
  
  def test():