summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-07-05 18:50:38 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-07-05 19:25:16 (GMT)
commita8d64317834c4efc56d41b314d0a219e5de7ecfd (patch)
tree27317fcc06bf4b60137297715478ddb31819c3f3
parent4e63299089254bbe6be5fa6e58458475276825cb (diff)
downloadpykolab-a8d64317834c4efc56d41b314d0a219e5de7ecfd.tar.gz
Make sure the pattern for deleting mailboxes is passed on right between various function calls
-rw-r--r--pykolab/cli/cmd_delete_mailbox.py6
-rw-r--r--pykolab/imap/__init__.py13
2 files changed, 14 insertions, 5 deletions
diff --git a/pykolab/cli/cmd_delete_mailbox.py b/pykolab/cli/cmd_delete_mailbox.py
index 99404ff..68e1735 100644
--- a/pykolab/cli/cmd_delete_mailbox.py
+++ b/pykolab/cli/cmd_delete_mailbox.py
@@ -49,7 +49,9 @@ def execute(*args, **kw):
imap = IMAP()
imap.connect()
- delete_folders = imap.lm(delete_folder)
+
+ delete_folders = imap.list_folders(delete_folder)
+
for delete_folder in delete_folders:
- imap.delete_mailfolder(delete_folder)
+ imap.delete_mailfolder(imap.folder_utf8(delete_folder))
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index 63245d6..8b7b899 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -249,6 +249,10 @@ class IMAP(object):
from pykolab import imap_utf7
return imap_utf7.encode(folder)
+ def folder_utf8(self, folder):
+ from pykolab import imap_utf7
+ return imap_utf7.decode(folder)
+
def get_metadata(self, folder):
"""
Obtain all metadata entries on a folder
@@ -898,16 +902,16 @@ class IMAP(object):
log.info(_("Deleting folder %s") % (mailfolder_path))
- self.imap.dm(mailfolder_path)
+ self.imap.dm(self.folder_utf7(mailfolder_path))
def get_quota(self, mailfolder_path):
try:
- return self.lq(mailfolder_path)
+ return self.lq(self.folder_utf7(mailfolder_path))
except:
return
def get_quota_root(self, mailfolder_path):
- return self.lqr(mailfolder_path)
+ return self.lqr(self.folder_utf7(mailfolder_path))
def list_acls(self, folder):
"""
@@ -915,6 +919,9 @@ class IMAP(object):
"""
return self.imap.lam(folder)
+ def list_folders(self, pattern):
+ return self.lm(self.folder_utf7(pattern))
+
def list_user_folders(self, primary_domain=None, secondary_domains=[]):
"""
List the INBOX folders in the IMAP backend. Returns a list of unique