summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authorthomascube <thomas@roundcube.net>2006-02-04 19:08:10 +0000
committerthomascube <thomas@roundcube.net>2006-02-04 19:08:10 +0000
commit58e3602a37cccab55f71fbf839b32fbc4322699c (patch)
tree4f48f72eb95d6ad7fb69ac09644e96f890bfded8 /program/steps
parent76ffa2a099300325b34c92a9291dc4031b8a0d8a (diff)
Bugfixes for encoding and sending with attachments
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/check_recent.inc5
-rw-r--r--program/steps/mail/compose.inc9
-rw-r--r--program/steps/mail/func.inc24
-rw-r--r--program/steps/mail/move_del.inc1
-rw-r--r--program/steps/mail/sendmail.inc6
5 files changed, 36 insertions, 9 deletions
diff --git a/program/steps/mail/check_recent.inc b/program/steps/mail/check_recent.inc
index 3d0ceb2a9..0bde47ed8 100644
--- a/program/steps/mail/check_recent.inc
+++ b/program/steps/mail/check_recent.inc
@@ -30,7 +30,8 @@ if ($recent_count = $IMAP->messagecount(NULL, 'RECENT', TRUE))
$commands = sprintf("this.set_unread_count('%s', %d, true);\n", addslashes($mbox), $unread_count);
$commands .= sprintf("this.set_env('messagecount', %d);\n", $count);
$commands .= sprintf("this.set_rowcount('%s');\n", rcmail_get_messagecount_text());
-
+ $commands .= sprintf("this.set_quota('%s');\n", $IMAP->get_quota());
+
// add new message headers to list
$a_headers = array();
for ($i=$recent_count, $id=$count-$recent_count+1; $i>0; $i--, $id++)
@@ -44,4 +45,4 @@ if (strtoupper($mbox)!='INBOX' && $IMAP->messagecount('INBOX', 'RECENT'))
rcube_remote_response($commands);
-?> \ No newline at end of file
+?>
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 80a32a9f3..80f69b596 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -145,8 +145,10 @@ function rcmail_compose_headers($attrib)
// get recipent address(es) out of the message headers
if ($header=='to' && $REPLY_MESSAGE['headers']->replyto)
$fvalue = $IMAP->decode_header($REPLY_MESSAGE['headers']->replyto);
+
else if ($header=='to' && $REPLY_MESSAGE['headers']->from)
$fvalue = $IMAP->decode_header($REPLY_MESSAGE['headers']->from);
+
// add recipent of original message if reply to all
else if ($header=='cc' && $REPLY_MESSAGE['reply_all'])
{
@@ -169,7 +171,7 @@ function rcmail_compose_headers($attrib)
$fvalue = '';
foreach ($to_addresses as $addr_part)
{
- if (!in_array($addr_part['mailto'], $sa_recipients))
+ if (!in_array($addr_part['mailto'], $sa_recipients) && (!$REPLY_MESSAGE['FROM'] || !in_array($addr_part['mailto'], $REPLY_MESSAGE['FROM'])))
{
$fvalue .= (strlen($fvalue) ? ', ':'').$addr_part['string'];
$sa_recipients[] = $addr_part['mailto'];
@@ -214,6 +216,8 @@ function rcmail_compose_header_from($attrib)
$a_recipients = array();
if ($REPLY_MESSAGE && is_object($REPLY_MESSAGE['headers']))
{
+ $REPLY_MESSAGE['FROM'] = array();
+
$a_to = $IMAP->decode_address_list($REPLY_MESSAGE['headers']->to);
foreach ($a_to as $addr)
{
@@ -259,6 +263,9 @@ function rcmail_compose_header_from($attrib)
// set identity if it's one of the reply-message recipients
if (in_array($sql_arr['email'], $a_recipients))
$from_id = $sql_arr['identity_id'];
+
+ if ($REPLY_MESSAGE && is_array($REPLY_MESSAGE['FROM']))
+ $REPLY_MESSAGE['FROM'][] = $sql_arr['email'];
}
// overwrite identity selection with post parameter
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index 8e0178d7a..d089dd272 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -545,6 +545,25 @@ function rcmail_messagecount_display($attrib)
}
+function rcmail_quota_display($attrib)
+ {
+ global $IMAP, $OUTPUT, $JS_OBJECT_NAME;
+
+ if (!$attrib['id'])
+ $attrib['id'] = 'rcmquotadisplay';
+
+ $OUTPUT->add_script(sprintf("%s.gui_object('quotadisplay', '%s');", $JS_OBJECT_NAME, $attrib['id']));
+
+ // allow the following attributes to be added to the <span> tag
+ $attrib_str = create_attrib_string($attrib, array('style', 'class', 'id'));
+
+
+ $out = '<span' . $attrib_str . '>';
+ $out .= $IMAP->get_quota();
+ $out .= '</span>';
+ return $out;
+ }
+
function rcmail_get_messagecount_text()
{
@@ -580,10 +599,9 @@ function rcmail_print_body($part, $safe=FALSE, $plain=FALSE) // $body, $ctype_pr
extract($part);
$block = $plain ? '%s' : '%s'; //'<div style="display:block;">%s</div>';
- $body = $IMAP->mime_decode($body, $encoding);
+ $body = $IMAP->mime_decode($body, $encoding);
$body = $IMAP->charset_decode($body, $parameters);
-
// text/html
if ($ctype_secondary=='html')
{
@@ -804,7 +822,7 @@ function rcmail_parse_message($structure, $arg=array(), $recursive=FALSE)
}
// part text/[plain|html] OR message/delivery-status
- else if (($primary_type=='text' && ($secondary_type=='plain' || $secondary_type=='html')) ||
+ else if (($primary_type=='text' && ($secondary_type=='plain' || $secondary_type=='html') && $mail_part->disposition!='attachment') ||
($primary_type=='message' && $secondary_type=='delivery-status'))
{
$a_return_parts[] = array('type' => 'content',
diff --git a/program/steps/mail/move_del.inc b/program/steps/mail/move_del.inc
index e3c7549b4..e4da207f4 100644
--- a/program/steps/mail/move_del.inc
+++ b/program/steps/mail/move_del.inc
@@ -73,6 +73,7 @@ $commands .= sprintf("this.set_unread_count('%s', %d);\n", $mbox, $IMAP->message
if ($_action=='moveto')
$commands .= sprintf("this.set_unread_count('%s', %d);\n", $_GET['_target_mbox'], $IMAP->messagecount($_GET['_target_mbox'], 'UNSEEN'));
+$commands .= sprintf("this.set_quota('%s');\n", $IMAP->get_quota());
// add new rows from next page (if any)
if ($_GET['_from']!='show' && $pages>1 && $IMAP->list_page < $pages)
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index ab0c6ed07..9d9303436 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -115,7 +115,7 @@ if (strlen($identity_arr['bcc']))
$headers['Bcc'] = ($headers['Bcc'] ? $headers['Bcc'].', ' : '') . $identity_arr['bcc'];
// add subject
-$headers['Subject'] = rcube_charset_convert(trim(stripslashes($_POST['_subject'])), $input_charset, $message_charset);
+$headers['Subject'] = rcube_charset_convert(trim($_POST['_subject']), $input_charset, $message_charset);
if (strlen($identity_arr['organization']))
$headers['Organization'] = $identity_arr['organization'];
@@ -144,7 +144,7 @@ if ($CONFIG['useragent'])
$headers['User-Agent'] = $CONFIG['useragent'];
// fetch message body
-$message_body = rcube_charset_convert(stripslashes($_POST['_message']), $input_charset, $message_charset);
+$message_body = rcube_charset_convert($_POST['_message'], $input_charset, $message_charset);
// append generic footer to all messages
if (!empty($CONFIG['generic_message_footer']))
@@ -225,7 +225,7 @@ if ($CONFIG['smtp_server'])
else
{
// unset some headers because they will be added by the mail() function
- $headers_php = $headers;
+ $headers_php = $MAIL_MIME->_headers;
$headers_enc = $MAIL_MIME->headers($headers);
unset($headers_php['To'], $headers_php['Subject']);