summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pykolab/cli/cmd_rename_mailbox.py6
-rw-r--r--pykolab/imap/__init__.py8
2 files changed, 9 insertions, 5 deletions
diff --git a/pykolab/cli/cmd_rename_mailbox.py b/pykolab/cli/cmd_rename_mailbox.py
index e596401..43fae96 100644
--- a/pykolab/cli/cmd_rename_mailbox.py
+++ b/pykolab/cli/cmd_rename_mailbox.py
@@ -44,6 +44,10 @@ def execute(*args, **kw):
source_folder = conf.cli_args.pop(0)
try:
target_folder = conf.cli_args.pop(0)
+ try:
+ partition = conf.cli_args.pop(0)
+ except IndexError, errmsg:
+ partition = None
except IndexError, errmsg:
print >> sys.stderr, _("No target mailbox name specified")
except IndexError, errmsg:
@@ -66,5 +70,5 @@ def execute(*args, **kw):
print >> sys.stderr, _("Target folder %r already exists") % (target_folder)
sys.exit(1)
- imap.user_mailbox_rename(source_folder.replace('user/',''), target_folder.replace('user/',''))
+ imap.user_mailbox_rename(source_folder.replace('user/',''), target_folder.replace('user/',''), partition=partition)
diff --git a/pykolab/imap/__init__.py b/pykolab/imap/__init__.py
index fbaaf28..f9c95f1 100644
--- a/pykolab/imap/__init__.py
+++ b/pykolab/imap/__init__.py
@@ -628,17 +628,17 @@ class IMAP(object):
def user_mailbox_quota(self, mailbox_quota):
pass
- def user_mailbox_rename(self, old_name, new_name):
+ def user_mailbox_rename(self, old_name, new_name, partition=None):
old_name = "user%s%s" % (self.get_separator(),old_name)
new_name = "user%s%s" % (self.get_separator(),new_name)
- if old_name == new_name:
+ if old_name == new_name and partition == None:
return
- if not self.has_folder(new_name):
+ if not self.has_folder(new_name) or not partition == None:
log.info(_("Renaming INBOX from %s to %s") % (old_name,new_name))
try:
- self.imap.rename(old_name,new_name)
+ self.imap.rename(old_name,new_name,partition)
except:
log.error(_("Could not rename INBOX folder %s to %s") % (old_name,new_name))
else: