On Tue, Oct 22, 2002 at 04:01:46PM +0300, Timo Sirainen wrote:
Only bigger thing to do is to parse the headers and convert the =?xxx?yyy?= things. I think everything should go either through UTF8 or without any conversion if both header and search charsets are same.
I assume you only want to convert to UTF-8 or the other character sets when it's really necessary, not store all data internally as UTF-8 or wchar_t ?
I can think of two ways to do it:
- save search results to array, sort the array, send it to clients, delete the array.
- sort all mails writing results into btree file, keep the file updated whenever new mails are added or deleted. then do the search in that order so we can just write out the results without any sorting.
I like the 2) more, but that works only if the sort condition isn't changed. Or if it is changed, then we'd need to have multiple btree files.. And in general it slows down things if sorting isn't done often.
I think 2) might be an option if you're dealing with very specific SORTs. SquirrelMail, for instance, allows sorting on date, from, subject, arrival and to (but the last one only in 'sent-mail' mailbox, oddly enough) and all reverses, and in various order as well, by little buttony things on the mailbox-index page... easy to play with. (Don't forget, you can
. SORT (SUBJECT REVERSE FROM REVERSE TO REVERSE DATE ARRIVAL) UTF-8 ALL
and which btrees would you use how, in that case ? :) Anyway, in SquirrelMail at least, I don't think there is a system-wide 'default' for the criterium that's most often SORTed on. Simply storing the last SORT might be the optimal solution, as I think (after the initial toying with the mailbox sort order, and the occasional switch to search faster) most people won't touch their sort order once they like or are used with what they have.
-- Thomas Wouters thomas@xs4all.net
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!