summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksander Machniak <machniak@kolabsys.com>2016-05-06 14:23:32 +0200
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2016-05-06 14:26:33 +0200
commitecaeb83ca93545ee1c4caa3858eb2319cbe60db6 (patch)
treee046c3183a20130a90c14c4602bede5359ee6951
parent08d096f873f8e1f90de2a9b7f046fd6cd8639441 (diff)
downloadpykolab-ecaeb83ca93545ee1c4caa3858eb2319cbe60db6.tar.gz
Fix folder name encodin issues in undelete-mailbox (#5299) Additionally, try to properly detect when XFER command should be issued
Summary: Fixes #5299 Reviewers: #pykolab_developers, vanmeeuwen Reviewed By: #pykolab_developers, vanmeeuwen Subscribers: vanmeeuwen Differential Revision: https://git.kolab.org/D152
-rw-r--r--pykolab/imap/cyrus.py31
1 files changed, 22 insertions, 9 deletions
diff --git a/pykolab/imap/cyrus.py b/pykolab/imap/cyrus.py
index 8dab02e..8c3ebe4 100644
--- a/pykolab/imap/cyrus.py
+++ b/pykolab/imap/cyrus.py
@@ -340,17 +340,30 @@ class Cyrus(cyruslib.CYRUS):
log.info(_("Undeleting %s to %s") % (undelete_folder,target_folder))
target_server = self.find_mailfolder_server(target_folder)
+ source_server = self.find_mailfolder_server(undelete_folder)
- if hasattr(conf,'dry_run') and not conf.dry_run:
- if not target_server == self.server:
- self.xfer(undelete_folder,target_server)
+ if hasattr(conf, 'dry_run') and not conf.dry_run:
+ undelete_folder = self.folder_utf7(undelete_folder)
+ target_folder = self.folder_utf7(target_folder)
+
+ if not target_server == source_server:
+ self.xfer(undelete_folder, target_server)
self.rename(undelete_folder,target_folder)
else:
- if not target_server == self.server:
- print >> sys.stdout, _("Would have transferred %s from %s to %s") % (undelete_folder, self.server, target_server)
-
- print >> sys.stdout, _("Would have renamed %s to %s") % (undelete_folder, target_folder)
+ if not target_server == source_server:
+ print >> sys.stdout, \
+ _("Would have transferred %s from %s to %s") % (
+ undelete_folder,
+ source_server,
+ target_server
+ )
+
+ print >> sys.stdout, \
+ _("Would have renamed %s to %s") % (
+ undelete_folder,
+ target_folder
+ )
def parse_mailfolder(self, mailfolder):
"""
@@ -441,7 +454,7 @@ class Cyrus(cyruslib.CYRUS):
if not mbox['domain'] == None:
deleted_folder_search = "%s@%s" % (deleted_folder_search,mbox['domain'])
- folders = self.lm(deleted_folder_search)
+ folders = self.lm(self.folder_utf7(deleted_folder_search))
# The folders we have found at this stage include virtdomain folders.
#
@@ -458,4 +471,4 @@ class Cyrus(cyruslib.CYRUS):
folders = _folders
- return folders
+ return [self.folder_utf8(x) for x in folders]