Explorar o código

added tree documenation

nehresma %!s(int64=25) %!d(string=hai) anos
pai
achega
a6d9adb49f
Modificáronse 1 ficheiros con 33 adicións e 0 borrados
  1. 33 0
      trunk/squirrelmail/doc/tree.txt

+ 33 - 0
trunk/squirrelmail/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"]             = <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.