/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 offlineimap (3.99.4) unstable; urgency=low
* Fixed setup.py installation instructions. * Fixed setup.py installation instructions.

View File

@ -317,3 +317,12 @@ holdconnectionopen = no
# set it to "/". # set it to "/".
sep = . 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): class IMAPFolder(BaseFolder):
def __init__(self, imapserver, name, visiblename, accountname, repository): 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.name = imaputil.dequote(name)
self.root = None # imapserver.root self.root = None # imapserver.root
self.sep = imapserver.delim self.sep = imapserver.delim
@ -85,7 +89,9 @@ class IMAPFolder(BaseFolder):
else: else:
uid = long(options['UID']) uid = long(options['UID'])
flags = imaputil.flagsimap2maildir(options['FLAGS']) flags = imaputil.flagsimap2maildir(options['FLAGS'])
self.messagelist[uid] = {'uid': uid, 'flags': 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): def getmessagelist(self):
return self.messagelist return self.messagelist
@ -249,7 +255,8 @@ class IMAPFolder(BaseFolder):
except imapobj.readonly: except imapobj.readonly:
UIBase.getglobalui().deletereadonly(self, uidlist) UIBase.getglobalui().deletereadonly(self, uidlist)
return return
assert(imapobj.expunge()[0] == 'OK') if self.expunge:
assert(imapobj.expunge()[0] == 'OK')
finally: finally:
self.imapserver.releaseconnection(imapobj) self.imapserver.releaseconnection(imapobj)
for uid in uidlist: for uid in uidlist: