From 583850d00cb61771333a19ed57bef753ac140fe0 Mon Sep 17 00:00:00 2001 From: alecpl Date: Thu, 8 May 2008 09:07:04 +0000 Subject: - Corrected message headers decoding when charset isn't specified and improved support for native languages (#1485050, #1485048) --- program/steps/mail/func.inc | 18 ++++++++++++------ program/steps/mail/show.inc | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'program/steps') diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index 36bd4cb89..073950a23 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -232,16 +232,19 @@ function rcmail_message_list($attrib) $out .= sprintf("%s\n", $message_icon ? sprintf($image_tag, $skin_path, $message_icon, '') : ''); + if (!empty($header->charset)) + $IMAP->set_charset($header->charset); + // format each col foreach ($a_show_cols as $col) { if ($col=='from' || $col=='to') - $cont = Q(rcmail_address_string(rcube_imap::decode_mime_string($header->$col, $header->charset), 3, $attrib['addicon']), 'show'); + $cont = Q(rcmail_address_string($header->$col, 3, $attrib['addicon']), 'show'); else if ($col=='subject') { $action = $mbox==$CONFIG['drafts_mbox'] ? 'compose' : 'show'; $uid_param = $mbox==$CONFIG['drafts_mbox'] ? '_draf_uid' : '_uid'; - $cont = Q(rcube_imap::decode_mime_string($header->$col, $header->charset)); + $cont = Q($IMAP->decode_header($header->$col)); if (empty($cont)) $cont = Q(rcube_label('nosubject')); $cont = sprintf('%s', Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox))), $cont); } @@ -321,16 +324,19 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE) if (empty($header)) continue; + if (!empty($header->charset)) + $IMAP->set_charset($header->charset); + // format each col; similar as in rcmail_message_list() foreach ($a_show_cols as $col) { if ($col=='from' || $col=='to') - $cont = Q(rcmail_address_string(rcube_imap::decode_mime_string($header->$col, $header->charset), 3), 'show'); + $cont = Q(rcmail_address_string($header->$col, 3), 'show'); else if ($col=='subject') { $action = $mbox==$CONFIG['drafts_mbox'] ? 'compose' : 'show'; $uid_param = $mbox==$CONFIG['drafts_mbox'] ? '_draf_uid' : '_uid'; - $cont = Q(rcube_imap::decode_mime_string($header->$col, $header->charset)); + $cont = Q($IMAP->decode_header($header->$col)); if (!$cont) $cont = Q(rcube_label('nosubject')); $cont = sprintf('%s', Q(rcmail_url($action, array($uid_param=>$header->uid, '_mbox'=>$mbox))), $cont); } @@ -974,7 +980,7 @@ function rcmail_message_headers($attrib, $headers=NULL) else if (in_array($hkey, array('from', 'to', 'cc', 'bcc', 'reply-to'))) $header_value = Q(rcmail_address_string($headers[$hkey], NULL, $attrib['addicon']), 'show'); else - $header_value = Q(rcube_imap::decode_mime_string($headers[$hkey], $headers['charset'])); + $header_value = Q($IMAP->decode_header($headers[$hkey])); $out .= "\n\n"; $out .= ''.Q(rcube_label($hkey)).": \n"; @@ -1466,7 +1472,7 @@ function rcmail_send_mdn($uid) $message = array('UID' => $uid); $message['headers'] = $IMAP->get_headers($message['UID']); - $message['subject'] = rcube_imap::decode_mime_string($message['headers']->subject, $message['headers']->charset); + $message['subject'] = $IMAP->decode_header($message['headers']->subject); if ($message['headers']->mdn_to && !$message['headers']->mdn_sent) { diff --git a/program/steps/mail/show.inc b/program/steps/mail/show.inc index 8062f4598..daf2e0859 100644 --- a/program/steps/mail/show.inc +++ b/program/steps/mail/show.inc @@ -61,7 +61,7 @@ if ($_GET['_uid']) else if (empty($CONFIG['devel_mode'])) send_modified_header($_SESSION['login_time'], $etag, !$MESSAGE['headers']->seen); - $MESSAGE['subject'] = rcube_imap::decode_mime_string($MESSAGE['headers']->subject, $MESSAGE['headers']->charset); + $MESSAGE['subject'] = $IMAP->decode_header($MESSAGE['headers']->subject); $OUTPUT->set_pagetitle($MESSAGE['subject']); if ($MESSAGE['structure'] = $IMAP->get_structure($MESSAGE['UID'])) -- cgit v1.2.3