From 36bb3d7c3fb52b505ec253589009a59d5995af5e Mon Sep 17 00:00:00 2001 From: nehresma Date: Mon, 6 Mar 2000 16:06:40 +0000 Subject: [PATCH] added tree documenation git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@276 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- doc/tree.txt | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 doc/tree.txt diff --git a/doc/tree.txt b/doc/tree.txt new file mode 100644 index 00000000..15b174c8 --- /dev/null +++ b/doc/tree.txt @@ -0,0 +1,33 @@ +So what is this tree stuff? +=========================== + +In order to get correct folder deletion across the board for all +different RFC2060 compliant IMAP servers, deleting of folders +needed to work by deleting subfolders (inferiors) first, working +up to the top folder that is desired to be deleted. + +The best way to do this was to use a tree, and walk the thing in +preorder to get subfolders first (leaves), working our way up the +tree. I chose to use an array for the tree structure. + +The array has the following elements: +$tree[0]["value"] = +$tree[0]["doIHaveChildren"] = boolean +$tree[0]["subNodes"] = indexes of the array that are + child nodes of this node + +The trickiest part was finding the correct parent node when creating +a new node in the tree. Check the documentation in the code for +more info on this. + +Basically all we had to do as loop through each of the items that +need to be in the tree (folders, subfolders), find their parent, +let their parent know it has a new child, and insert the values +into the child. + +Once the tree is generated, a simple preorder or postorder walk +of the tree can be done doing whatever function you desire (delete, +create, etc). + +Preorder walking gives you the tree from the leaves up. Postorder +walks the tree from the root node down to the leaves. -- 2.25.1