From 5cc4b13a0c6d32d74d0cba17feeb6c5fbceaf25f Mon Sep 17 00:00:00 2001 From: thomascube Date: Mon, 19 Mar 2007 22:36:24 +0000 Subject: Correctly parse message/rfc822; fixed html2text conversion; code cleanup --- program/steps/mail/compose.inc | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) (limited to 'program/steps/mail/compose.inc') diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 1c2639d9b..a794e9814 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -401,8 +401,8 @@ function rcmail_compose_body($attrib) $body = rcmail_first_text_part($MESSAGE); $isHtml = false; } - if (strlen($body)) - $body = rcmail_create_forward_body($body, $isHtml); + + $body = rcmail_create_forward_body($body, $isHtml); } else if ($compose_mode == RCUBE_COMPOSE_DRAFT) { @@ -564,10 +564,9 @@ function rcmail_create_forward_body($body, $bodyIsHtml) } // add attachments - if (!isset($_SESSION['compose']['forward_attachments']) && - is_array($MESSAGE['parts']) && sizeof($MESSAGE['parts'])>1) + if (!isset($_SESSION['compose']['forward_attachments']) && is_array($MESSAGE['parts'])) rcmail_write_compose_attachments($MESSAGE); - + return $prefix.$body; } @@ -598,7 +597,7 @@ function rcmail_write_compose_attachments(&$message) { if ($part->ctype_primary != 'message' && $part->ctype_primary != 'text' && ($part->disposition=='attachment' || $part->disposition=='inline' || $part->headers['content-id'] || - (empty($part->disposition) && ($part->d_parameters['filename'] || $part->ctype_parameters['name'])))) + (empty($part->disposition) && $part->filename))) { $tmp_path = tempnam($temp_dir, 'rcmAttmnt'); if ($fp = fopen($tmp_path, 'w')) @@ -606,13 +605,9 @@ function rcmail_write_compose_attachments(&$message) fwrite($fp, $IMAP->get_message_part($message['UID'], $pid, $part->encoding)); fclose($fp); - $filename = !empty($part->d_parameters['filename']) ? $part->d_parameters['filename'] : - (!empty($part->ctype_parameters['name']) ? $part->ctype_parameters['name'] : - (!empty($part->headers['content-description']) ? $part->headers['content-description'] : 'file')); - $_SESSION['compose']['attachments'][] = array( - 'name' => rcube_imap::decode_mime_string($filename), 'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, + 'name' => $part->filename, 'path' => $tmp_path ); } -- cgit v1.2.3