** This implements functions that manipulate messages
**/
- if (!$mime_php) include "../functions/mime.php";
+ if (!isset($mime_php)) include "../functions/mime.php";
/******************************************************************************
** Copies specified messages to specified folder
function sqimap_messages_delete ($imap_stream, $start, $end, $mailbox) {
global $move_to_trash, $trash_folder, $auto_expunge;
- if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder))) {
+ if (($move_to_trash == true) && (sqimap_mailbox_exists($imap_stream, $trash_folder) && ($mailbox != $trash_folder))) {
sqimap_messages_copy ($imap_stream, $start, $end, $trash_folder);
sqimap_messages_flag ($imap_stream, $start, $end, "Deleted");
} else {
}
function sqimap_get_small_header ($imap_stream, $id, $sent) {
- global $where, $what;
fputs ($imap_stream, "a001 FETCH $id BODY.PEEK[HEADER.FIELDS (Date To From Cc Subject Message-Id X-Priority)]\r\n");
$read = sqimap_read_data ($imap_stream, "a001", true, $response, $message);
}
}
- if ($where == "SUBJECT") {
- $subject = eregi_replace($what, "<b>\\0</b>", $subject);
+ // If there isn't a date, it takes the internal date and uses
+ // that as the normal date.
+ if (trim($date) == "") {
+ fputs ($imap_stream, "a002 FETCH $id INTERNALDATE\r\n");
+ $internal_read = sqimap_read_data ($imap_stream, "a002", true, $r, $m);
+
+ // * 22 FETCH (INTERNALDATE " 8-Sep-2000 13:17:07 -0500")
+ $date = $internal_read[0];
+ $date = eregi_replace(".*internaldate \"", "", $date);
+ $date = eregi_replace("\".*", "", $date);
+ $date_ary = explode(" ", trim($date));
+ $date_ary[0] = str_replace("-", " ", $date_ary[0]);
+ $date = implode (" ", $date_ary);
}
+
+ fputs ($imap_stream, "a003 FETCH $id RFC822.SIZE\r\n");
+ $read = sqimap_read_data($imap_stream, "a003", true, $r, $m);
+ preg_match("/([0-9]+)\)\s*$/i", $read[0], $regs);
+ $size = $regs[1] / 1024;
+ settype($size, "integer");
$header = new small_header;
if ($sent == true)
$header->priority = $priority;
$header->message_id = $messageid;
$header->cc = $cc;
+ $header->size = $size;
return $header;
}
$hdr->type1 = "plain";
$hdr->charset = "us-ascii";
+ preg_match("/\{([0-9]+)\}/", $read[$i], $regs);
+ preg_match("/[0-9]+/", $regs[0], $regs);
+
while ($i < count($read)) {
if (substr($read[$i], 0, 17) == "MIME-Version: 1.0") {
$hdr->mime = true;