diff -urN functions.orig/tree.php functions/tree.php --- functions.orig/tree.php Sat Feb 4 00:27:47 2006 +++ functions/tree.php Sat May 13 23:58:09 2006 @@ -121,7 +121,12 @@ function walkTreeInPreOrderDeleteFolders($index, $imap_stream, $tree) { if ($tree[$index]['doIHaveChildren']) { for ($j = 0; $j < count($tree[$index]['subNodes']); $j++) { + if (($index != 0) or ($tree[$index]['value'] != $tree[$tree[$index]['subNodes'][$j]]['value'])) { walkTreeInPreOrderDeleteFolders($tree[$index]['subNodes'][$j], $imap_stream, $tree); + } else { + $new_index = $tree[$index]['subNodes'][$j]; + walkTreeInPreOrderDeleteFolders($tree[$new_index]['subNodes'][$j], $imap_stream, $tree); + } } sqimap_mailbox_delete($imap_stream, $tree[$index]['value']); } else { @@ -151,7 +156,12 @@ // after copy close the mailbox to get in unselected state sqimap_run_command($imap_stream,'CLOSE',false,$response,$message); for ($j = 0;$j < count($tree[$index]['subNodes']); $j++) + if (($index != 0) or ($tree[$index]['value'] != $tree[$tree[$index]['subNodes'][$j]]['value'])) { walkTreeInPostOrderCreatingFoldersUnderTrash($tree[$index]['subNodes'][$j], $imap_stream, $tree, $topFolderName); + } else { + $new_index = $tree[$index]['subNodes'][$j]; + walkTreeInPostOrderCreatingFoldersUnderTrash($tree[$new_index]['subNodes'][$j], $imap_stream, $tree, $topFolderName); + } } else { sqimap_mailbox_create($imap_stream, $trash_folder . $delimiter . $subFolderName, ''); $mbx_response = sqimap_mailbox_select($imap_stream, $tree[$index]['value']); @@ -180,4 +190,4 @@ echo $tree[$index]['value'] . '
'; } } -?> \ No newline at end of file +?>