/offlineimap/head: changeset 286

Added ability to disable expunging on the server.
This commit is contained in:
jgoerzen 2002-11-12 22:36:34 +01:00
parent f7c4889918
commit 61b6c32d0f
3 changed files with 24 additions and 2 deletions

View File

@ -1,3 +1,9 @@
offlineimap (3.99.5) unstable; urgency=low
* Added ability to disable expunging on the server.
-- John Goerzen <jgoerzen@complete.org> Tue, 12 Nov 2002 09:29:31 -0600
offlineimap (3.99.4) unstable; urgency=low
* Fixed setup.py installation instructions.

View File

@ -317,3 +317,12 @@ holdconnectionopen = no
# set it to "/".
sep = .
# Normally, OfflineIMAP will expunge deleted messages from the server.
# You can disable that if you wish. This means that OfflineIMAP will
# mark them deleted on the server, but not actually delete them.
# You must use some other IMAP client to delete them if you use this
# setting; otherwise, the messgaes will just pile up there forever.
# Therefore, this setting is definately NOT recommended.
#
# expunge = no

View File

@ -26,6 +26,10 @@ from copy import copy
class IMAPFolder(BaseFolder):
def __init__(self, imapserver, name, visiblename, accountname, repository):
self.config = imapserver.config
self.expunge = 1
if self.config.has_option(accountname, 'expunge'):
self.expunge = self.config.getboolean(accountname, 'expunge')
self.name = imaputil.dequote(name)
self.root = None # imapserver.root
self.sep = imapserver.delim
@ -85,6 +89,8 @@ class IMAPFolder(BaseFolder):
else:
uid = long(options['UID'])
flags = imaputil.flagsimap2maildir(options['FLAGS'])
# Skip messages already flagged for deletion on the server.
if not 'T' in flags:
self.messagelist[uid] = {'uid': uid, 'flags': flags}
def getmessagelist(self):
@ -249,6 +255,7 @@ class IMAPFolder(BaseFolder):
except imapobj.readonly:
UIBase.getglobalui().deletereadonly(self, uidlist)
return
if self.expunge:
assert(imapobj.expunge()[0] == 'OK')
finally:
self.imapserver.releaseconnection(imapobj)