rev 286 - in offlineimap/head: . debian offlineimap/folder

[email protected] Tue, 12 Nov 2002 09:36:35 -0600 (CST)
Newsgroups gmane.mail.imap.offlineimap.subversion
Message-ID <[email protected]>
Author: jgoerzen
Date: 2002-11-12 09:36:34 -0600 (Tue, 12 Nov 2002)
New Revision: 286

Modified:
   offlineimap/head/debian/changelog
   offlineimap/head/offlineimap.conf
   offlineimap/head/offlineimap/folder/IMAP.py
Log:
  * Added ability to disable expunging on the server.



Modified: offlineimap/head/debian/changelog
==============================================================================
--- offlineimap/head/debian/changelog	(original)
+++ offlineimap/head/debian/changelog	Tue Nov 12 09:36:35 2002
@@ -1,3 +1,9 @@
+offlineimap (3.99.5) unstable; urgency=low
+
+  * Added ability to disable expunging on the server.
+
+ -- John Goerzen <[email protected]>  Tue, 12 Nov 2002 09:29:31 -0600
+
 offlineimap (3.99.4) unstable; urgency=low
 
   * Fixed setup.py installation instructions.

Modified: offlineimap/head/offlineimap/folder/IMAP.py
==============================================================================
--- offlineimap/head/offlineimap/folder/IMAP.py	(original)
+++ offlineimap/head/offlineimap/folder/IMAP.py	Tue Nov 12 09:36:35 2002
@@ -26,6 +26,10 @@
 
 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 @@
             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 @@
             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:

Modified: offlineimap/head/offlineimap.conf
==============================================================================
--- offlineimap/head/offlineimap.conf	(original)
+++ offlineimap/head/offlineimap.conf	Tue Nov 12 09:36:35 2002
@@ -317,3 +317,12 @@
 # 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