[Spambayes-checkins] spambayes/Outlook2000 msgstore.py,1.53,1.54
Mark Hammond
mhammond at users.sourceforge.net
Tue Jul 22 22:35:37 EDT 2003
Update of /cvsroot/spambayes/spambayes/Outlook2000
In directory sc8-pr-cvs1:/tmp/cvs-serv18004
Modified Files:
msgstore.py
Log Message:
Remove the old code from NormalizeID, and clean up some comments.
Index: msgstore.py
===================================================================
RCS file: /cvsroot/spambayes/spambayes/Outlook2000/msgstore.py,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** msgstore.py 22 Jul 2003 14:01:41 -0000 1.53
--- msgstore.py 23 Jul 2003 04:35:35 -0000 1.54
***************
*** 127,131 ****
def __init__(self, outlook = None):
self.outlook = outlook
! cwd = os.getcwd()
mapi.MAPIInitialize(None)
logonFlags = (mapi.MAPI_NO_MAIL |
--- 127,131 ----
def __init__(self, outlook = None):
self.outlook = outlook
! cwd = os.getcwd() # remember the cwd - mapi changes it under us!
mapi.MAPIInitialize(None)
logonFlags = (mapi.MAPI_NO_MAIL |
***************
*** 221,245 ****
return store.OpenEntry(item_id, iid, flags)
! # Given an ID, normalize it into a (store_id, item_id) binary tuple.
! # item_id may be:
! # - Simple hex EID, in wich case default store ID is assumed.
! # - Tuple of (None, hex_eid), in which case default store assumed.
! # - Tuple of (hex_store_id, hex_id)
def NormalizeID(self, item_id):
! if type(item_id)==type(()):
! store_id, item_id = item_id
! item_id = mapi.BinFromHex(item_id)
! if store_id is None:
! # store_id=None was a "backwards compat" hack no longer
! # need - it can go once we are *sure* we dont need it ;)
! assert False, "We expect fully qualified IDs"
! store_id = self.default_store_bin_eid
! else:
! store_id = mapi.BinFromHex(store_id)
! return store_id, item_id
! # See above - this branch can die (I think ;)
! assert type(item_id) in [type(''), type(u'')], "What kind of ID is '%r'?" % (item_id,)
! assert False, "We expect fully qualified IDs"
! return self.default_store_bin_eid, mapi.BinFromHex(item_id)
def _GetSubFolderIter(self, folder):
--- 221,230 ----
return store.OpenEntry(item_id, iid, flags)
! # Normalize an "external" hex ID to an internal binary ID.
def NormalizeID(self, item_id):
! assert type(item_id)==type(()), \
! "Item IDs must be a tuple (not a %r)" % item_id
! store_id, entry_id = item_id
! return mapi.BinFromHex(store_id), mapi.BinFromHex(entry_id)
def _GetSubFolderIter(self, folder):
***************
*** 286,289 ****
--- 271,275 ----
# Return a single folder given the ID.
try:
+ # See if this is an Outlook folder item
sid = mapi.BinFromHex(folder_id.StoreID)
eid = mapi.BinFromHex(folder_id.EntryID)
***************
*** 493,497 ****
# 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.is_unsent = flags & MSGFLAG_UNSENT
--- 479,483 ----
# Outlook client provides no such (easy/obvious) way
# (ie, someone would need to really want to change it <wink>)
! # Thus, searchkey is our long-lived message key.
self.searchkey = searchkey
self.is_unsent = flags & MSGFLAG_UNSENT
***************
*** 557,561 ****
ret = ""
if got_val == mapi.MAPI_E_NOT_FOUND:
! pass # No body for this message.
elif got_val == mapi.MAPI_E_NOT_ENOUGH_MEMORY:
# Too big for simple properties - get via a stream
--- 543,547 ----
ret = ""
if got_val == mapi.MAPI_E_NOT_FOUND:
! pass # No property for this message.
elif got_val == mapi.MAPI_E_NOT_ENOUGH_MEMORY:
# Too big for simple properties - get via a stream
***************
*** 756,760 ****
# property is the same for two objects, assume that these
# objects use the same name-to-identifier mapping.
! # [MarkH: Note MAPIUUID object are supported and hashable]
# XXX If the SpamProb (Hammie, whatever) property is passed in as an
--- 742,746 ----
# property is the same for two objects, assume that these
# objects use the same name-to-identifier mapping.
! # [MarkH: MAPIUID objects are supported and hashable]
# XXX If the SpamProb (Hammie, whatever) property is passed in as an
***************
*** 819,824 ****
(is_read, self.GetField(PR_MESSAGE_FLAGS))
- # unsent may also be useful - MSGFLAG_UNSENT bit in PR_MESSAGE_FLAGS .
-
def Save(self):
assert self.dirty, "asking me to save a clean message!"
--- 805,808 ----
***************
*** 834,838 ****
def _DoCopyMove(self, folder, isMove):
- ## self.mapi_object = None # release the COM pointer
assert not self.dirty, \
"asking me to move a dirty message - later saves will fail!"
--- 818,821 ----
More information about the Spambayes-checkins
mailing list