When scanning the folder tree, CM will recursively search for subscribed folders using multiple LSUB commands using the "%" wildcard, like so: 1 LSUB "" "%" * LSUB () "/" "Foo" * LSUB () "/" "Bar" 1 OK LSUB completed 2 LSUB "" "Foo/%" * [...] 3 LSUB "" "Bar/%" * [...] ...and so on for every level of every branch of the hierarchy. With large hierarchies, this means a lot of LSUB commands will be issued, which makes the folder tree scanning slow - especially if the IMAP server takes a few seconds to respond to each LSUB command. (My employer's Zimbra server uses 2-3 seconds.) I suggest that this multi-command recursive method be replaced by a single command: LSUB "" "*" This makes the server return the entire list of subscribed folders in one go. If CM had used this approach, the entire folder scanning procedure would have taken 2-3 seconds, rather than the current 2-3 seconds multiplied by the number of nodes in the folder hierarchy. With a large folder hierarchy, that's a huge speedup. Note: It might well be that the folder scanning procedure when in the show all folders mode (i.e., including non-subscribed ones) would also benefit from a similar change, only that it would apply to the LIST command rather than LSUB. I haven't checked that, though.
Actually, I think the whole folder scanning and subscription logic could be greatly improved. I suggest you consider an approach that does something like the following: 1) Get the entire list of folders, using 'LIST "" "*"' 2) Get the entire list of subscribed folders, using 'LSUB "" "*"' 3) Walk through every folder in set #1, checking if each folder exists in set #2 At this point you know the full folder list, as well as the subscribed/unsubscribed state of each folder. These steps could be performed at startup, and whenever the user requests to look for new folders. Second, the interface for managing subscriptions could show a pop-up with the merged set from #3 in a standard tree-like structure, and with a checkbox beside each folder indicating its subscribed/unsubscrubed state as well as allowing the user to easily toggle it. This seems to be how most other MUAs does it, for what it's worth.