[PATCH] Make -f option with with folder names with spaces.

Sebastian Spaeth Sebastian at SSpaeth.de
Tue Apr 5 11:16:43 BST 2011


Previously ALL spaces had been stripped off. Now, only strip spaces
around the comma, so -f "INBOX, Deleted Mails" will work. You will still
need to quote or escape spaces so the shell hand the list as one command
line argument to offlineimap.

Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
In case people agree that supported folder names with spaces should be
supported, here is a patch on top of master.

 Changelog.draft.rst |    3 +++
 offlineimap/init.py |    6 ++++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/Changelog.draft.rst b/Changelog.draft.rst
index 79006fd..5771b1f 100644
--- a/Changelog.draft.rst
+++ b/Changelog.draft.rst
@@ -19,6 +19,9 @@ Changes
 * Increase compatability with Gmail servers which claim to not support
   the UIDPLUS extension but in reality do.
 
+* the -f option did not work with Folder names with spaces. It works
+  now, use with quoting e.g. -f "INBOX, Deleted Mails".
+
 Bug Fixes
 ---------
 
diff --git a/offlineimap/init.py b/offlineimap/init.py
index 96d4e50..3254e42 100644
--- a/offlineimap/init.py
+++ b/offlineimap/init.py
@@ -238,8 +238,10 @@ class OfflineImap:
             for section in accounts.getaccountlist(config):
                 config.set('Account ' + section, "quick", '-1')
 
-        if options.folders:
-            foldernames = options.folders.replace(" ", "").split(",")
+        #custom folder list specified?
+        if options.folders:            
+            foldernames = map(lambda s: s.strip(),
+                              options.folders.split(","))
             folderfilter = "lambda f: f in %s" % foldernames
             folderincludes = "[]"
             for accountname in accounts.getaccountlist(config):
-- 
1.7.1





More information about the OfflineIMAP-project mailing list