I've been working my way through the hastymail source code, trying to learn what I can. I'm new to things such as fsockopen(), and figured a good way to get into it would be to see some real, working examples.
But I have a problem: I can't seem to find out how to retrieve the message uids from a mailbox. From all of the source I can see, they are stored within $_SESSION[uid_cache][...]. But I'm curious as how they were retrieved from the IMAP server and subsequently stored into the session variable.
Can anyone assist? I'm not looking for a detailed explanation; just a reference like "see function X() in file Y.php " would make me more than happy....
Thanks in advance...
UIDS are fetched using one of three methods in the hastymail2/lib/imap_class.php file, which one is used is determined by the IMAP server's support for the IMAP SORT and THREAD commands.
server_side_sort
This is the preferred method and is used when the server supports the IMAP SORT command. We issue a SORT command on a selected mailbox and the server returns a space delimited set of message UIDS that we assign to the uid cache in the session.
client_side_sort
This method is used when the IMAP server does not support the SORT command. We issue an IMAP FETCH command and the server returns a FETCH response from which we can grab the message UIDS
thread_sort
This method is used when the IMAP server supports the THREAD command and the user has selected to thread sort the mailbox. It is similar to the SORT command however the returned message UIDS are nested in parenthesis to indicate the thread association.
Hope that helps,
Jason