Changeset 583f1c8 in github for program/steps/mail/compose.inc


Ignore:
Timestamp:
Nov 8, 2005 3:18:56 PM (8 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
ecf7590
Parents:
b595c9f
Message:

Added reply-to-all function (submitted by Julien Brette)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • program/steps/mail/compose.inc

    r10a69975 r583f1c8  
    5151                                             'decode_headers' => TRUE, 
    5252                                             'decode_bodies' => FALSE)); 
    53                                               
     53 
    5454  $MESSAGE['subject'] = $IMAP->decode_header($MESSAGE['headers']->subject); 
    5555  $MESSAGE['parts'] = $mmd->getMimeNumbers($MESSAGE['structure']); 
     
    5757  if ($_GET['_reply_uid']) 
    5858    { 
    59     $REPLY_MESSAGE = $MESSAGE; 
     59    $REPLY_MESSAGE = &$MESSAGE; 
    6060    $_SESSION['compose']['reply_uid'] = $_GET['_reply_uid']; 
    6161    $_SESSION['compose']['reply_msgid'] = $REPLY_MESSAGE['headers']->messageID; 
     62 
     63    if ($_GET['_all']) 
     64      $REPLY_MESSAGE['reply_all'] = 1; 
    6265    } 
    6366  else 
     
    7679  { 
    7780  global $IMAP, $REPLY_MESSAGE, $DB; 
     81  static $sa_recipients = array(); 
    7882 
    7983  list($form_start, $form_end) = get_form_tags($attrib); 
     
    145149        { 
    146150        $fname = '_cc'; 
    147         //$header = 'cc'; 
     151        $header = 'cc'; 
    148152        } 
    149153    case 'bcc': 
     
    163167     
    164168    } 
    165      
     169 
    166170     
    167171  if ($fname && !empty($_POST[$fname])) 
     
    174178    else if ($header=='to' && $REPLY_MESSAGE['headers']->from) 
    175179      $fvalue = $IMAP->decode_header($REPLY_MESSAGE['headers']->from); 
    176      
     180    // add recipent of original message if reply to all 
     181    else if ($header=='cc' && $REPLY_MESSAGE['reply_all']) 
     182      { 
     183      if ($IMAP->decode_header($REPLY_MESSAGE['headers']->to)) 
     184        $fvalue .= $IMAP->decode_header($REPLY_MESSAGE['headers']->to); 
     185 
     186      if ($IMAP->decode_header($REPLY_MESSAGE['headers']->cc)) 
     187        { 
     188        if($fvalue) 
     189          $fvalue .= ', '; 
     190 
     191        $fvalue .= $IMAP->decode_header($REPLY_MESSAGE['headers']->cc); 
     192        } 
     193      } 
     194 
    177195    // split recipients and put them back together in a unique way 
    178     $to_addresses = $IMAP->decode_address_list($fvalue); 
    179     $fvalue = ''; 
    180     foreach ($to_addresses as $addr_part) 
    181       $fvalue .= (strlen($fvalue) ? ', ':'').$addr_part['string']; 
    182     } 
    183      
     196    if (!empty($fvalue)) 
     197      { 
     198      $to_addresses = $IMAP->decode_address_list($fvalue); 
     199      $fvalue = ''; 
     200      foreach ($to_addresses as $addr_part) 
     201        { 
     202        if (!in_array($addr_part['mailto'], $sa_recipients)) 
     203          { 
     204          $fvalue .= (strlen($fvalue) ? ', ':'').$addr_part['string']; 
     205          $sa_recipients[] = $addr_part['mailto']; 
     206          } 
     207        } 
     208      } 
     209    } 
     210 
    184211         
    185212  if ($fname && $field_type) 
Note: See TracChangeset for help on using the changeset viewer.