From: Michael L. <le...@le...> - 2006-04-25 10:14:09
|
I just had a look at how libetpan handles data returned by the server we did not ask for, referring to IMAP4 spec [rfc3501], 5.2: At any time, a server can send data that the client did not request. Sometimes, such behavior is REQUIRED. Additional data may also be returned by NOOP (eg. if in selected state). The way I understand how data is handled is the following: After sending the commands to the server, parse_response is invoked, which parses all of the data, then stores it into session. Each command then grabs the data it needs (eg. mailimap_list takes session->imap_response_info->rsp_mailbox_list), copies it to its own response, then removes it from the session. Am I right assuming that data not expected by the command we sent is still left in the session so it remains accessible? This would actually be a really good thing, as when coding a client using the low-level api you could adhere to the IMAP specs tightly. One more thing popped to my mind: After parsing the data, the low-level function (eg. mailimap_list) copies the pointer to the data it needs to its own result, then removes the reference to the data from session: * result = session->imap_response_info->rsp_mailbox_list; session->imap_response_info->rsp_mailbox_list = NULL; While having the results you really wanted available in result is a good thing in my opionion, wouldn't it be good to not to remove the reference in session? Leaving it available would enable the client to uniformly query all data returned using session and it would be freed automatically (either by the subsequent call to mailimap_store or by exiting via mailimap_logout). Please correct me if I'm getting something wrong. My view on some parts of libetpan is still somewhat blurry. :) Regards, Michael |