Do you have the line numbers for these changes? It'd be slick if you were able to submit them. The problem still exists in 20051021, and your patch fixed it for me earlier. But, I can't use your complete imap.inc as now I have it patched for sorting.
Oddly enough, I only have the "unread mail bug" if I am opening the first message in my inbox and it happens to be unread. I am able to open every other unread message in by box... just not if the message I am opening is the first in the list. Strange, eh?
Dave
On Wed, 12 Oct 2005 02:38:09 -0400, "Maksim Rubis" siburny@hotmail.com wrote:
Hello everyone. I fixed this problem after 3 hours of diging the code :). Basically, the problem is in "fetchheaders" function. At some point script queries IMAP and looks for result like "* blah FETCH blah blah". And after it automatically assumes that server will send headers back. It's true. BUT for unseen message server sends back ONE more reposnse "* blah FETCH (FLAGS (\Seen))" which is NOT followed by any other data related to this FETCH. if everything's ok, server sends "blah OK FETCH completed".
Quick trace: C -> S "blah FETCH blah (BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID)]) S -> C "* blah FETCH blah blah" // first message S -> C "date: blah" -- " -- " -- S -> C "from: blah" S -> C ")" //<- end of headers
C -> S "blah FETCH blah (BODY.PEEK[HEADER.FIELDS (DATE FROM TO SUBJECT REPLY-TO IN-REPLY-TO CC CONTENT-TRANSFER-ENCODING CONTENT-TYPE MESSAGE-ID)]) S -> C "* blah FETCH blah blah" // second message (unseen) S -> C "date: blah" -- " -- " -- S -> C "from: blah" S -> C ")" //<- end of headers S -> C "* blah FETCH (FLAGS (\Seen))"
// At this point if($a[0] == "*" && $a[2] == "FETCH") IS true. Script goes inside the ifbody and attempes to read headers with are supposed to end with ")", HOWEVER it gets "fh0 OK FETCH completed" which means FETCH was successful, MOVE ON :). BUT no this time, we are waiting and waiting and ... waiting for ")", which never comes :).
Did anyone understand what I wrote here ?
And here quick fix (I think in the release it should be done a little different):
do{ $line=chop(iil_ReadLine($fp, 200)); $a=explode(" ", $line); if (($line[0]=="*") && ($a[2]=="FETCH")){
<<<!!! SKIP !!!>>>
do{ $line = chop(iil_ReadLine($fp, 300),"\r\n"); if (ord($line[0])<=32)
$lines[$i].=(empty($lines[$i])?"":"\n").trim(chop($line)); else{ $i++; $lines[$i] = trim(chop($line)); } ! }while($line[0]!=")" && strncmp($line, $key, strlen($key)));
if(strncmp($line, $key, strlen($key)))
//process header, fill iilBasicHeader obj. // initialize if (is_array($headers)){ reset($headers); while ( list($k, $bar) = each($headers) ) $headers[$k] = ""; }{
<<<!!! SKIP !!!>>>
$result[$id]->messageID = $messageID;
}
else
{
$a=explode(" ", $line);
} }while(strcmp($a[0], $key)!=0);}
Right now, everything works fine. Good luck.
P.S. is there an archive of this mailing list ? Thanks !
Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/