+ // Now create the nodes for subfolders of the parent folder
+ // You can tell that it is a subfolder by tacking the mailbox delimiter
+ // on the end of the $mailbox string, and compare to that.
+ $j = 0;
+ for ($i = 0;$i < count($boxes);$i++) {
+ if (substr($boxes[$i]["unformatted"], 0, strlen($mailbox . $dm)) == ($mailbox . $dm)) {
+ addChildNodeToTree($boxes[$i]["unformatted"], $boxes[$i]["unformatted-dm"], $foldersTree);
+ }
+ }
+
+ // now lets go through the tree and delete the folders
+ walkTreeInPreOrderDeleteFolders(0, $imap_stream, $foldersTree);
+ // now lets create a new, fresh trash folder
+ sqimap_mailbox_create($imap_stream, "$trash_folder", "");