+ } else if ( preg_match('/^\* OK \[PARSE.*/', $read, $regs ) ) {
+ while ( preg_match('/^\* OK \[PARSE.*/', $read, $regs ) ) {
+ $read = fgets($imap_stream, $bufsize);
+ }
+ /*
+ This block has been added in order to avoid the problem
+ caused by the * OK [PARSE] Missing parameter answer
+ Please, replace it with a better parsing if you know how.
+ This block has been updated by
+ Seth E. Randall <sethr@missoulafcu.org>. Once we see
+ one OK [PARSE line, we just go through and keep
+ tossing them out until we get something different.
+ */
+ $data[] = $read;
+ $read = fgets ($imap_stream, $bufsize);
+ } else if (preg_match('/^\* BYE \[ALERT\](.*)/', $read, $regs)) {
+ /*
+ It seems that the IMAP server has coughed a lung up
+ and hung up the connection. Print any info we have
+ and abort.
+ */
+ echo _("Please contact your system administrator and report the following error:") . "<br>\n";
+ echo "$regs[1]";
+ exit(0);