$read = sqimap_read_data ($imap_stream, $tag, $handle_errors, $response,
$message, $query,$filter,$outputstream,$no_return);
+ if (empty($read)) { //Imap server dropped its connection
+ $response = '';
+ $message = '';
+ return false;
+ }
/* retrieve the response and the message */
$response = $response[$tag];
$message = $message[$tag];
-
+
if (!empty($read[$tag])) {
return $read[$tag][0];
} else {
* Function to display an error related to an IMAP-query.
* @param string title the caption of the error box
* @param string query the query that went wrong
- * @param string message_title
- * @param string message the error message
+ * @param string message_title optional message title
+ * @param string message optional error message
+ * @param string $link an optional link to try again
* @return void
*/
-function sqimap_error_box($title, $query = '', $message_title = '', $message = '')
+function sqimap_error_box($title, $query = '', $message_title = '', $message = '', $link = '')
{
global $color, $squirrelmail_language;
if ($message != '')
$string .= htmlspecialchars($message);
$string .= "</font><br>\n";
+ if ($link != '')
+ $string .= $link;
error_box($string,$color);
}
$read = '';
if (!is_array($message)) $message = array();
if (!is_array($response)) $response = array();
+ $aResponse = '';
$resultlist = array();
$data = array();
$read = sqimap_fgets($imap_stream);
/* error processing in case $read is false */
if ($read === false) {
unset($data);
- sqimap_error_box(_("ERROR : Connection dropped by imap-server."), $query);
- exit;
+ if ($handle_errors) {
+ sqimap_error_box(_("ERROR : Connection dropped by imap-server."), $query);
+ exit;
+ }
}
/* Set $resultlist array */
/* Return result or handle errors */
if ($handle_errors == false) {
return $aResponse;
- return( $resultlist ); //?? Why this?
}
switch ($response[$tag]) {
case 'OK':