I made a quick change to line 1897 of my "program/include/rcube_imap.inc" which works well for my needs. You might have a very good reason for using sort() there, and if you do great, but if you just used it out of habit, you might consider this which will sort more like a human would and is case in-sensative:
natcasesort($a_out);
Great job on this application so far. I look forward to future releases.