Changeset 2b180b1 in github


Ignore:
Timestamp:
Oct 13, 2008 3:05:31 AM (5 years ago)
Author:
alecpl <alec@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
87b7959
Parents:
34942eb
Message:

#1485494: fixed signatures removal on reply

File:
1 edited

Legend:

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

    r70087c5 r2b180b1  
    500500  if (! $bodyIsHtml) 
    501501  { 
     502    // try to remove the signature 
     503    if (($sp = strrpos($body, '-- ')) !== false && ($sp == 0 || $body{$sp-1} == "\n")) 
     504      { 
     505      if ($body{$sp+3}==' ' || $body{$sp+3}=="\n" || $body{$sp+3}=="\r") 
     506        $body = substr($body, 0, max(0, $sp-1)); 
     507      } 
     508 
    502509    // soft-wrap message first 
    503510    $body = rcmail_wrap_quoted($body, 75); 
    504    
    505     // split body into single lines 
    506     $a_lines = preg_split('/\r?\n/', $body); 
    507    
    508     // add > to each line 
    509     for($n=0; $n<sizeof($a_lines); $n++) 
    510     { 
    511       if (strpos($a_lines[$n], '>')===0) 
    512         $a_lines[$n] = '>'.$a_lines[$n]; 
    513       else 
    514         $a_lines[$n] = '> '.$a_lines[$n]; 
    515     } 
     511 
     512    $body = rtrim($body, "\r\n"); 
     513 
     514    if ($body) { 
     515      // split body into single lines 
     516      $a_lines = preg_split('/\r?\n/', $body); 
     517 
     518      // add > to each line 
     519      for($n=0; $n<sizeof($a_lines); $n++) { 
     520        if (strpos($a_lines[$n], '>')===0) 
     521          $a_lines[$n] = '>'.$a_lines[$n]; 
     522        else 
     523          $a_lines[$n] = '> '.$a_lines[$n]; 
     524        } 
    516525  
    517     $body = join("\n", $a_lines); 
     526      $body = join("\n", $a_lines); 
     527      } 
    518528 
    519529    // add title line 
     
    522532      $MESSAGE->get_header('from')); 
    523533 
    524     // try to remove the signature 
    525     if ($sp = strrpos($body, '-- ')) 
    526       { 
    527       if ($body{$sp+3}==' ' || $body{$sp+3}=="\n" || $body{$sp+3}=="\r") 
    528         $body = substr($body, 0, $sp-1); 
    529       } 
    530534    $suffix = ''; 
    531535  } 
Note: See TracChangeset for help on using the changeset viewer.