+ } else if ( preg_match('/^\* OK \[PARSE.*/', $read, $regs ) ) {
+ /*
+ * 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.
+ */
+ while ( preg_match('/^\* OK \[PARSE.*/', $read, $regs ) ) {
+ $read = fgets($imap_stream, $bufsize);
+ }
+ $data[] = $read;
+ $read = fgets ($imap_stream, $bufsize);
+ } else if (preg_match('/^\* BYE \[ALERT\](.*)/', $read, $regs)) {
+ /*
+ * It seems that the IMAP server has coughed up a lung
+ * 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;