From 61b6c32d0fd509a9cab539b74f650ee9b31e2690 Mon Sep 17 00:00:00 2001 From: jgoerzen Date: Tue, 12 Nov 2002 22:36:34 +0100 Subject: [PATCH] /offlineimap/head: changeset 286 Added ability to disable expunging on the server. --- offlineimap/head/debian/changelog | 6 ++++++ offlineimap/head/offlineimap.conf | 9 +++++++++ offlineimap/head/offlineimap/folder/IMAP.py | 11 +++++++++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/offlineimap/head/debian/changelog b/offlineimap/head/debian/changelog index 2b7303f..7f8ded6 100644 --- a/offlineimap/head/debian/changelog +++ b/offlineimap/head/debian/changelog @@ -1,3 +1,9 @@ +offlineimap (3.99.5) unstable; urgency=low + + * Added ability to disable expunging on the server. + + -- John Goerzen Tue, 12 Nov 2002 09:29:31 -0600 + offlineimap (3.99.4) unstable; urgency=low * Fixed setup.py installation instructions. diff --git a/offlineimap/head/offlineimap.conf b/offlineimap/head/offlineimap.conf index 248d61f..af9fbd6 100644 --- a/offlineimap/head/offlineimap.conf +++ b/offlineimap/head/offlineimap.conf @@ -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 diff --git a/offlineimap/head/offlineimap/folder/IMAP.py b/offlineimap/head/offlineimap/folder/IMAP.py index 6a4ac0c..e9451b4 100644 --- a/offlineimap/head/offlineimap/folder/IMAP.py +++ b/offlineimap/head/offlineimap/folder/IMAP.py @@ -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,7 +89,9 @@ class IMAPFolder(BaseFolder): else: uid = long(options['UID']) 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): return self.messagelist @@ -249,7 +255,8 @@ class IMAPFolder(BaseFolder): except imapobj.readonly: UIBase.getglobalui().deletereadonly(self, uidlist) return - assert(imapobj.expunge()[0] == 'OK') + if self.expunge: + assert(imapobj.expunge()[0] == 'OK') finally: self.imapserver.releaseconnection(imapobj) for uid in uidlist: