Skip to content

Commit

Permalink
Fix moving mailbox to base level
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed May 13, 2014
1 parent 853ff0f commit b4b3dc0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions imp/lib/Ajax/Application/Handler/Dynamic.php
Expand Up @@ -150,7 +150,7 @@ public function deleteMailbox()
* Variables used:
* - new_name: (string) New mailbox name (child node) (UTF-8).
* - new_parent: (string) New parent name (UTF-8; base64url encoded).
* If not set, uses old parent.
* If not present, uses old parent.
* - old_name: (string) Full name of old mailbox (base64url encoded).
*
* @return boolean True on success, false on failure.
Expand All @@ -162,9 +162,13 @@ public function renameMailbox()
}

$old_name = IMP_Mailbox::formFrom($this->vars->old_name);
$parent = isset($this->vars->new_parent)
? IMP_Mailbox::formFrom($this->vars->new_parent)
: IMP_Mailbox::get($old_name->parent);
if (isset($this->vars->new_parent)) {
$parent = strlen($this->vars->new_parent)
? IMP_Mailbox::formFrom($this->vars->new_parent)
: IMP_Mailbox::get(IMP_Ftree::BASE_ELT);
} else {
$parent = IMP_Mailbox::get($old_name->parent);
}

if ($parent) {
$new_name = $parent->createMailboxName($this->vars->new_name);
Expand Down

0 comments on commit b4b3dc0

Please sign in to comment.