- $folderlist = $IMAP->list_unsubscribed();
- $delimiter = $IMAP->get_hierarchy_delimiter();
-
- $regexp = '/^' . preg_quote($name . $delimiter, '/') . '/';
-
- // subfolders
- for ($x=sizeof($folderlist)-1; $x>=0; $x--) {
- if (preg_match($regexp, $folderlist[$x])) {
- $oldfolder = $oldname . $delimiter . preg_replace($regexp, '', $folderlist[$x]);
- $foldersplit = explode($delimiter, $folderlist[$x]);
- $level = count($foldersplit) - 1;
- $display_rename = str_repeat(' ', $level)
- . rcube_charset_convert($foldersplit[$level], 'UTF7-IMAP');
-
- $before = isset($folderlist[$x+1]) ? rcube_charset_convert($folderlist[$x+1], 'UTF7-IMAP') : false;
-
- $OUTPUT->command('replace_folder_row', rcube_charset_convert($oldfolder, 'UTF7-IMAP'),
- rcube_charset_convert($folderlist[$x], 'UTF7-IMAP'), $display_rename, $before);
- }
- }
-
- $foldersplit = explode($delimiter, $name);
- $level = count($foldersplit) - 1;
- $display_rename = str_repeat(' ', $level) . rcube_charset_convert($foldersplit[$level], 'UTF7-IMAP');
- $index = array_search($name, $folderlist);
- $before = $index !== false && isset($folderlist[$index+1]) ? rcube_charset_convert($folderlist[$index+1], 'UTF7-IMAP') : false;
-
- $OUTPUT->command('replace_folder_row', $oldname_utf8,
- rcube_charset_convert($name, 'UTF7-IMAP'), $display_rename, $before);