* This implements functions that manipulate messages
* NOTE: Quite a few functions in this file are obsolete
*
- * @copyright © 1999-2006 The SquirrelMail Project Team
+ * @copyright © 1999-2007 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
// FIX ME, remove globals by introducing an associative array with properties
// as 4th argument as replacement for the bypass_trash var
global $move_to_trash, $trash_folder;
- $bRes = true;
if (($move_to_trash == true) && ($bypass_trash != true) &&
(sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder)) ) {
- $bRes = sqimap_msgs_list_copy ($imap_stream, $id, $trash_folder);
- }
- if ($bRes) {
- return sqimap_toggle_flag($imap_stream, $id, '\\Deleted', true, true);
- } else {
- return false;
+ /**
+ * turn off internal error handling (fourth argument = false) and
+ * ignore copy to trash errors (allows to delete messages when overquota)
+ */
+ sqimap_msgs_list_copy ($imap_stream, $id, $trash_folder, false);
}
+ return sqimap_toggle_flag($imap_stream, $id, '\\Deleted', true, true);
}
* @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), 3 = hide (return error string) (OPTIONAL; default don't hide)
+ * @return mixed Message object or FALSE/error string if error occurred and $hide is set to 2/3
*/
-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();
}
}
} else {
+
+ if ($hide == 1) exit;
+ if ($hide == 2) return FALSE;
+
/* the message was not found, maybe the mailbox was modified? */
global $sort, $startMessage, $color;
- $errmessage = _("The server couldn't find the message you requested.") .
- '<p>'._("Most probably your message list was out of date and the message has been moved away or deleted (perhaps by another program accessing the same mailbox).");
+ $errmessage = _("The server couldn't find the message you requested.");
+
+ if ($hide == 3) return $errmessage;
+
+ $errmessage .= '<p>'._("Most probably your message list was out of date and the message has been moved away or deleted (perhaps by another program accessing the same mailbox).");
+
/* this will include a link back to the message list */
error_message($errmessage, $mailbox, $sort, (int) $startMessage, $color);
exit;