From 1c9425d1d5b55200a28d55455a0652a383bcf891 Mon Sep 17 00:00:00 2001 From: pdontthink Date: Sat, 11 Nov 2006 10:34:22 +0000 Subject: [PATCH] Allow silent failure for sqimap_get_message() git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11954 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/imap_messages.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/functions/imap_messages.php b/functions/imap_messages.php index d99bcebd..42ecaa1e 100755 --- a/functions/imap_messages.php +++ b/functions/imap_messages.php @@ -912,9 +912,10 @@ function sqimap_parse_address($read, &$i) { * @param resource $imap_stream imap connection * @param integer $id uid of the message * @param string $mailbox used for error handling, can be removed because we should return an error code and generate the message elsewhere - * @return Message Message object + * @param int $hide Indicates whether or not to hide any errors: 0 = don't hide, 1 = hide (just exit), 2 = hide (return FALSE) (OPTIONAL; default don't hide) + * @return mixed Message object or FALSE if error occurred and $hide is set to 2 */ -function sqimap_get_message($imap_stream, $id, $mailbox) { +function sqimap_get_message($imap_stream, $id, $mailbox, $hide=0) { // typecast to int to prohibit 1:* msgs sets $id = (int) $id; $flags = array(); @@ -926,6 +927,10 @@ function sqimap_get_message($imap_stream, $id, $mailbox) { } } } else { + + if ($hide == 1) exit; + if ($hide == 2) return FALSE; + /* the message was not found, maybe the mailbox was modified? */ global $sort, $startMessage, $color; -- 2.25.1