disable regexp compilation error
[squirrelmail.git] / doc / Development / tree.txt
36bb3d7c 1So what is this tree stuff?
4In order to get correct folder deletion across the board for all
5different RFC2060 compliant IMAP servers, deleting of folders
6needed to work by deleting subfolders (inferiors) first, working
7up to the top folder that is desired to be deleted.
9The best way to do this was to use a tree, and walk the thing in
10preorder to get subfolders first (leaves), working our way up the
11tree. I chose to use an array for the tree structure.
13The array has the following elements:
14$tree[0]["value"] = <full folder name>
15$tree[0]["doIHaveChildren"] = boolean
16$tree[0]["subNodes"] = indexes of the array that are
17 child nodes of this node
19The trickiest part was finding the correct parent node when creating
20a new node in the tree. Check the documentation in the code for
21more info on this.
1e63b430 23Basically all we had to do was loop through each of the items that
36bb3d7c 24need to be in the tree (folders, subfolders), find their parent,
25let their parent know it has a new child, and insert the values
26into the child.
28Once the tree is generated, a simple preorder or postorder walk
29of the tree can be done doing whatever function you desire (delete,
30create, etc).
32Preorder walking gives you the tree from the leaves up. Postorder
33walks the tree from the root node down to the leaves.