added tree documenation
authornehresma <nehresma@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 6 Mar 2000 16:06:40 +0000 (16:06 +0000)
committernehresma <nehresma@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Mon, 6 Mar 2000 16:06:40 +0000 (16:06 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@276 7612ce4b-ef26-0410-bec9-ea0150e637f0

doc/tree.txt [new file with mode: 0644]

diff --git a/doc/tree.txt b/doc/tree.txt
new file mode 100644 (file)
index 0000000..15b174c
--- /dev/null
@@ -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"]             = <full folder name>
+$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.