From a79263bb31b79c49226f9c509df20bd3edc4e862 Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Sat, 28 Oct 2017 19:56:13 +0200 Subject: [PATCH] utf8foldernames: support --delete-folder with UTF-8 folder name Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/505 Signed-off-by: Nicolas Sebrecht --- docs/offlineimap.txt | 7 ++++--- offlineimap/repository/IMAP.py | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/offlineimap.txt b/docs/offlineimap.txt index 9ed449f..687e804 100644 --- a/docs/offlineimap.txt +++ b/docs/offlineimap.txt @@ -160,9 +160,10 @@ blinkenlights, machineui. --delete-folder:: Delete a folder on the remote repository. + -Only one account must be specified/configured for this feature to work. The -folder name must be provided in IMAP encoding with the remote separators (likely -'/'). E.g.: "Remote/folder/name". +Only one account must be specified/configured for this feature to work or you +must provide one account with -a. The folder name must be provided with the +remote separators (likely '/') in UTF-8 if utf8foldernames is enabled or in IMAP +otherwise. E.g.: "Remote/folder/name". --migrate-fmd5-using-nametrans:: diff --git a/offlineimap/repository/IMAP.py b/offlineimap/repository/IMAP.py index 02c8368..e10cd57 100644 --- a/offlineimap/repository/IMAP.py +++ b/offlineimap/repository/IMAP.py @@ -524,6 +524,8 @@ class IMAPRepository(BaseRepository): def deletefolder(self, foldername): """Delete a folder on the IMAP server.""" + if self.account.utf_8_support: + foldername = imaputil.utf8_IMAP(foldername) imapobj = self.imapserver.acquireconnection() try: result = imapobj.delete(foldername)