owncloud/mail — pull request #245 by zinks- (2014-08-29 20:32:41+00:00)
Title: Sort mailboxes, including special use folders

Still on my quest to fix #177, using @DeepDiver1975 's #202

Mailboxes are sorted alphabetically, with special folders at the top in the order proposed by @jancborchardt

Because some clients don't follow the server's special use flags (and some servers don't provide the flags), the special use role is also guessed based on the folder's name.

For situations where we want to get only one folder (for example, "which is the 'Sent' folder?"), the folder with the most messages in it is considered the best candidate.

In this code, the special use roles are also sent back to the client in the json array, but it's not used there yet.