Changeset 90a6aff in github


Ignore:
Timestamp:
Sep 27, 2011 2:59:59 AM (20 months ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.7, release-0.8
Children:
0c1cb2f
Parents:
00d4242
Message:
  • Fix bug where when replying always the last identity is used (#1488101)
Location:
program
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • program/js/common.js

    r699a25a r90a6aff  
    618618  } 
    619619  else { 
    620     begin += 2;   
    621   } 
    622  
    623   var end = document.cookie.indexOf(";", begin); 
     620    begin += 2; 
     621  } 
     622 
     623  var end = dc.indexOf(";", begin); 
    624624  if (end == -1) 
    625625    end = dc.length; 
  • program/steps/mail/compose.inc

    r609d392 r90a6aff  
    4747    'mailbox' => $IMAP->get_mailbox_name(), 
    4848  ); 
    49    
     49 
    5050  // process values like "mailto:foo@bar.com?subject=new+message&cc=another" 
    5151  if ($_SESSION['compose']['param']['to']) { 
     
    6060    } 
    6161  } 
    62    
     62 
    6363  // select folder where to save the sent message 
    6464  $_SESSION['compose']['param']['sent_mbox'] = $RCMAIL->config->get('sent_mbox'); 
    65    
     65 
    6666  // pipe compose parameters thru plugins 
    6767  $plugin = $RCMAIL->plugins->exec_hook('message_compose', $_SESSION['compose']); 
     
    8585        ); 
    8686      } 
    87        
     87 
    8888      // save attachment if valid 
    8989      if (($attachment['data'] && $attachment['name']) || ($attachment['path'] && file_exists($attachment['path']))) { 
    9090        $attachment = rcmail::get_instance()->plugins->exec_hook('attachment_save', $attachment); 
    9191      } 
    92        
     92 
    9393      if ($attachment['status'] && !$attachment['abort']) { 
    9494        unset($attachment['data'], $attachment['status'], $attachment['abort']); 
     
    243243} 
    244244else if (count($MESSAGE->identities)) { 
     245  $a_recipients = array(); 
     246  $a_names      = array(); 
     247 
    245248  // extract all recipients of the reply-message 
    246   $a_recipients = array(); 
    247249  if (is_object($MESSAGE->headers) && in_array($compose_mode, array(RCUBE_COMPOSE_REPLY, RCUBE_COMPOSE_FORWARD))) 
    248250  { 
    249251    $a_to = $IMAP->decode_address_list($MESSAGE->headers->to); 
    250252    foreach ($a_to as $addr) { 
    251       if (!empty($addr['mailto'])) 
     253      if (!empty($addr['mailto'])) { 
    252254        $a_recipients[] = strtolower($addr['mailto']); 
     255        $a_names[]      = $addr['name']; 
     256      } 
    253257    } 
    254258 
     
    256260      $a_cc = $IMAP->decode_address_list($MESSAGE->headers->cc); 
    257261      foreach ($a_cc as $addr) { 
    258         if (!empty($addr['mailto'])) 
     262        if (!empty($addr['mailto'])) { 
    259263          $a_recipients[] = strtolower($addr['mailto']); 
     264          $a_names[]      = $addr['name']; 
     265        } 
    260266      } 
    261267    } 
     
    286292    } 
    287293    // use replied message recipients 
    288     else if (in_array($ident['email_ascii'], $a_recipients)) { 
    289       $from_idx = $idx; 
     294    else if (($found = array_search($ident['email_ascii'], $a_recipients)) !== false) { 
     295      // match identity name, prefer default identity 
     296      if ($from_idx === null || ($a_names[$found] && $ident['name'] && $a_names[$found] == $ident['name'])) { 
     297        $from_idx = $idx; 
     298      } 
    290299    } 
    291300  } 
Note: See TracChangeset for help on using the changeset viewer.