From c685105ef21a3c06b2dc91c778c4fc4223494da8 Mon Sep 17 00:00:00 2001 From: svncommit Date: Mon, 15 Oct 2007 10:05:45 +0000 Subject: [PATCH] After renaming/moving a folder, rename/move the children as well. --- program/steps/settings/manage_folders.inc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/program/steps/settings/manage_folders.inc b/program/steps/settings/manage_folders.inc index 4d5882f6e..84e992801 100644 --- a/program/steps/settings/manage_folders.inc +++ b/program/steps/settings/manage_folders.inc @@ -71,6 +71,9 @@ else if ($_action=='create-folder') // rename a mailbox else if ($_action=='rename-folder') { + $a_mboxes = array_merge($IMAP->list_mailboxes(), $IMAP->list_unsubscribed()); + $delimiter = $IMAP->get_hierarchy_delimiter(); + if (!empty($_POST['_folder_oldname']) && !empty($_POST['_folder_newname'])) $rename = $IMAP->rename_mailbox(($oldname = get_input_value('_folder_oldname', RCUBE_INPUT_POST)), trim(get_input_value('_folder_newname', RCUBE_INPUT_POST, FALSE, 'UTF-7'))); @@ -81,6 +84,15 @@ else if ($_action=='rename-folder') $level = count($foldersplit) - 1; $display_rename = str_repeat('    ', $level) . rcube_charset_convert($foldersplit[$level], 'UTF-7'); $OUTPUT->command('replace_folder_row', $oldname, $rename, $display_rename); + foreach ($a_mboxes as $mbox) + if (preg_match('/^'.preg_quote($oldname.$delimiter).'/', $mbox)) + { + $c_rename = preg_replace('/^'.preg_quote($oldname).'/', $rename, $mbox); + $foldersplit = explode($delimiter, $c_rename); + $level = count($foldersplit) - 1; + $display_rename = str_repeat('    ', $level) . rcube_charset_convert($foldersplit[$level], 'UTF-7'); + $OUTPUT->command('replace_folder_row', $mbox, $c_rename, $display_rename); + } $OUTPUT->command('reset_folder_rename'); $OUTPUT->send(); }