From e70d6ea64e711096af36b1234f8545b870ea5f45 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Sat, 05 Apr 2008 08:49:21 -0400
Subject: [PATCH] Apply changes from trunk to 0.1-stable

---
 program/steps/mail/compose.inc |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 3e768c8..fd3743e 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -90,7 +90,11 @@
   // similar as in program/steps/mail/show.inc
   $MESSAGE = array('UID' => $msg_uid);
   $MESSAGE['headers'] = &$IMAP->get_headers($msg_uid);
-  $MESSAGE['structure'] = &$IMAP->get_structure($msg_uid);  
+  $MESSAGE['structure'] = &$IMAP->get_structure($msg_uid);
+  
+  if (!empty($MESSAGE['headers']->charset))
+    $IMAP->set_charset($MESSAGE['headers']->charset);
+    
   $MESSAGE['subject'] = $IMAP->decode_header($MESSAGE['headers']->subject);
   $MESSAGE['parts'] = $IMAP->get_mime_numbers($MESSAGE['structure']);
   
@@ -587,7 +591,7 @@
   
   foreach ($message['parts'] as $pid => $part)
   {
-    if ($part->ctype_primary != 'message' && $part->ctype_primary != 'text' &&
+    if ($part->ctype_primary != 'message' &&
         ($part->disposition=='attachment' || $part->disposition=='inline' || $part->headers['content-id'] ||
          (empty($part->disposition) && $part->filename)))
     {
@@ -889,7 +893,7 @@
   {
   while ($sql_arr = $result->iterate())
     if ($sql_arr['email'])
-      $a_contacts[] = format_email_recipient($sql_arr['email'], JQ($sql_arr['name']));
+      $a_contacts[] = format_email_recipient($sql_arr['email'], $sql_arr['name']);
   }
 if (isset($CONFIG['ldap_public']))
   {
@@ -914,7 +918,7 @@
  	    $email = $results->records[$i]['email']; 
  	    $name = $results->records[$i]['name']; 
  		 
- 	    $a_contacts[] = format_email_recipient($email, JQ($name)); 
+ 	    $a_contacts[] = format_email_recipient($email, $name);
  	    } 
  	  }
     $LDAP->close(); 

--
Gitblit v1.9.1