summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2012-01-05 11:25:42 +0000
committeralecpl <alec@alec.pl>2012-01-05 11:25:42 +0000
commit1c4f23d6e58e12f93d8de2c3ae416df575e8ad85 (patch)
treedb507bbdd32724fac52ca38208cf4f7d1f8bde71 /program/steps
parentc21d7fa7876d2160c3771e892be4a6e06cc143e3 (diff)
- Exclude MIME functionality from rcube_imap class into rcube_mime class
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/addcontact.inc2
-rw-r--r--program/steps/mail/compose.inc10
-rw-r--r--program/steps/mail/func.inc23
-rw-r--r--program/steps/mail/sendmail.inc2
-rw-r--r--program/steps/mail/viewsource.inc3
5 files changed, 20 insertions, 20 deletions
diff --git a/program/steps/mail/addcontact.inc b/program/steps/mail/addcontact.inc
index 0120852a9..ab7bfc06f 100644
--- a/program/steps/mail/addcontact.inc
+++ b/program/steps/mail/addcontact.inc
@@ -37,7 +37,7 @@ if ($abook == null || !is_object($CONTACTS)) {
if (!empty($_POST['_address']) && is_object($CONTACTS))
{
- $contact_arr = $RCMAIL->imap->decode_address_list(get_input_value('_address', RCUBE_INPUT_POST, true), 1, false);
+ $contact_arr = rcube_mime::decode_address_list(get_input_value('_address', RCUBE_INPUT_POST, true), 1, false);
if (!empty($contact_arr[1]['mailto'])) {
$contact = array(
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 855fbab67..3095d2436 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -268,7 +268,7 @@ else if (count($MESSAGE->identities)) {
// extract all recipients of the reply-message
if (is_object($MESSAGE->headers) && in_array($compose_mode, array(RCUBE_COMPOSE_REPLY, RCUBE_COMPOSE_FORWARD)))
{
- $a_to = $RCMAIL->imap->decode_address_list($MESSAGE->headers->to);
+ $a_to = rcube_mime::decode_address_list($MESSAGE->headers->to, null, true, $MESSAGE->headers->charset);
foreach ($a_to as $addr) {
if (!empty($addr['mailto'])) {
$a_recipients[] = strtolower($addr['mailto']);
@@ -277,7 +277,7 @@ else if (count($MESSAGE->identities)) {
}
if (!empty($MESSAGE->headers->cc)) {
- $a_cc = $RCMAIL->imap->decode_address_list($MESSAGE->headers->cc);
+ $a_cc = rcube_mime::decode_address_list($MESSAGE->headers->cc, null, true, $MESSAGE->headers->charset);
foreach ($a_cc as $addr) {
if (!empty($addr['mailto'])) {
$a_recipients[] = strtolower($addr['mailto']);
@@ -420,7 +420,7 @@ foreach ($parts as $header) {
// split recipients and put them back together in a unique way
if (!empty($fvalue) && in_array($header, array('to', 'cc', 'bcc'))) {
- $to_addresses = $RCMAIL->imap->decode_address_list($fvalue, null, $decode_header);
+ $to_addresses = rcube_mime::decode_address_list($fvalue, null, $decode_header, $MESSAGE->headers->charset);
$fvalue = array();
foreach ($to_addresses as $addr_part) {
@@ -650,7 +650,7 @@ function rcmail_prepare_message_body()
if ($body && $part && $part->ctype_secondary == 'plain'
&& $part->ctype_parameters['format'] == 'flowed'
) {
- $body = rcube_message::unfold_flowed($body);
+ $body = rcube_mime::unfold_flowed($body);
}
}
}
@@ -811,7 +811,7 @@ function rcmail_create_reply_body($body, $bodyIsHtml)
global $RCMAIL, $MESSAGE, $LINE_LENGTH;
// build reply prefix
- $from = array_pop($RCMAIL->imap->decode_address_list($MESSAGE->get_header('from'), 1, false));
+ $from = array_pop(rcube_mime::decode_address_list($MESSAGE->get_header('from'), 1, false, $MESSAGE->headers->charset));
$prefix = rcube_label(array(
'name' => 'mailreplyintro',
'vars' => array(
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index f791f7033..e17b19615 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -266,14 +266,12 @@ function rcmail_js_message_list($a_headers, $insert_top=FALSE, $a_show_cols=null
$a_msg_cols = array();
$a_msg_flags = array();
- $RCMAIL->imap->set_charset(!empty($header->charset) ? $header->charset : $CONFIG['default_charset']);
-
// format each col; similar as in rcmail_message_list()
foreach ($a_show_cols as $col) {
if (in_array($col, array('from', 'to', 'cc', 'replyto')))
- $cont = Q(rcmail_address_string($header->$col, 3), 'show');
+ $cont = Q(rcmail_address_string($header->$col, 3, false, null, $header->charset), 'show');
else if ($col=='subject') {
- $cont = trim($RCMAIL->imap->decode_header($header->$col));
+ $cont = trim(rcube_mime::decode_header($header->$col, $header->charset));
if (!$cont) $cont = rcube_label('nosubject');
$cont = Q($cont);
}
@@ -914,7 +912,7 @@ function rcmail_message_headers($attrib, $headers=NULL)
}
else if ($hkey == 'replyto') {
if ($headers['replyto'] != $headers['from'])
- $header_value = rcmail_address_string($value, null, true, $attrib['addicon']);
+ $header_value = rcmail_address_string($value, null, true, $attrib['addicon'], $headers['charset']);
else
continue;
}
@@ -922,19 +920,19 @@ function rcmail_message_headers($attrib, $headers=NULL)
if ($headers['mail-replyto'] != $headers['reply-to']
&& $headers['reply-to'] != $headers['from']
)
- $header_value = rcmail_address_string($value, null, true, $attrib['addicon']);
+ $header_value = rcmail_address_string($value, null, true, $attrib['addicon'], $headers['charset']);
else
continue;
}
else if ($hkey == 'mail-followup-to') {
- $header_value = rcmail_address_string($value, null, true, $attrib['addicon']);
+ $header_value = rcmail_address_string($value, null, true, $attrib['addicon'], $headers['charset']);
}
else if (in_array($hkey, array('from', 'to', 'cc', 'bcc')))
- $header_value = rcmail_address_string($value, null, true, $attrib['addicon']);
+ $header_value = rcmail_address_string($value, null, true, $attrib['addicon'], $headers['charset']);
else if ($hkey == 'subject' && empty($value))
$header_value = rcube_label('nosubject');
else
- $header_value = trim($RCMAIL->imap->decode_header($value));
+ $header_value = trim(rcube_mime::decode_header($value, $headers['charset']));
$output_headers[$hkey] = array(
'title' => rcube_label(preg_replace('/(^mail-|-)/', '', $hkey)),
@@ -1260,11 +1258,11 @@ function rcmail_alter_html_link($matches)
/**
* decode address string and re-format it as HTML links
*/
-function rcmail_address_string($input, $max=null, $linked=false, $addicon=null)
+function rcmail_address_string($input, $max=null, $linked=false, $addicon=null, $default_charset=null)
{
global $RCMAIL, $PRINT_MODE, $CONFIG;
- $a_parts = $RCMAIL->imap->decode_address_list($input);
+ $a_parts = rcube_mime::decode_address_list($input, null, true, $default_charset);
if (!sizeof($a_parts))
return $input;
@@ -1483,7 +1481,8 @@ function rcmail_send_mdn($message, &$smtp_error)
{
$identity = $RCMAIL->user->get_identity();
$sender = format_email_recipient($identity['email'], $identity['name']);
- $recipient = array_shift($RCMAIL->imap->decode_address_list($message->headers->mdn_to));
+ $recipient = array_shift(rcube_mime::decode_address_list(
+ $message->headers->mdn_to, 1, true, $message->headers->charset));
$mailto = $recipient['mailto'];
$compose = new Mail_mime("\r\n");
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index 9d4d42562..953c7521a 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -520,7 +520,7 @@ else {
// compose format=flowed content if enabled
if ($flowed = $RCMAIL->config->get('send_format_flowed', true))
- $message_body = rcube_message::format_flowed($message_body, min($LINE_LENGTH+2, 79));
+ $message_body = rcube_mime::format_flowed($message_body, min($LINE_LENGTH+2, 79));
else
$message_body = rc_wordwrap($message_body, $LINE_LENGTH, "\r\n");
diff --git a/program/steps/mail/viewsource.inc b/program/steps/mail/viewsource.inc
index d951fbead..e2b4e1b61 100644
--- a/program/steps/mail/viewsource.inc
+++ b/program/steps/mail/viewsource.inc
@@ -29,7 +29,8 @@ if ($uid = get_input_value('_uid', RCUBE_INPUT_GET))
header("Content-Type: text/plain; charset={$charset}");
if (!empty($_GET['_save'])) {
- $filename = ($headers->subject ? $RCMAIL->imap->decode_header($headers->subject) : 'roundcube') . '.eml';
+ $subject = rcube_mime::decode_header($headers->subject, $headers->charset);
+ $filename = ($subject ? $subject : $RCMAIL->config->get('product_name', 'email')) . '.eml';
$browser = $RCMAIL->output->browser;
if ($browser->ie && $browser->ver < 7)