[Hastymail-cvs] SF.net SVN: hastymail:[1777] trunk/hastymail2/lib
Brought to you by:
sailfrog,
slushpupie
From: <sai...@us...> - 2011-01-28 18:04:42
|
Revision: 1777 http://hastymail.svn.sourceforge.net/hastymail/?rev=1777&view=rev Author: sailfrog Date: 2011-01-28 18:04:36 +0000 (Fri, 28 Jan 2011) Log Message: ----------- more work on properly setting up the To: field on the compose page when replying to a message Modified Paths: -------------- trunk/hastymail2/lib/misc_functions.php trunk/hastymail2/lib/url_action_classes/compose.php Modified: trunk/hastymail2/lib/misc_functions.php =================================================================== --- trunk/hastymail2/lib/misc_functions.php 2011-01-27 14:19:18 UTC (rev 1776) +++ trunk/hastymail2/lib/misc_functions.php 2011-01-28 18:04:36 UTC (rev 1777) @@ -62,13 +62,12 @@ global $page_id; global $user; $res = array(); - $str = $user->decode_fld($str, $charset); $replacements = array(); if (strstr($str, ',') || strstr($str, ';')) { if (preg_match_all("/[\"']{1}[^\"']+[\"']{1}/", $str, $matches)) { foreach ($matches as $i => $v) { $str = str_replace($v, $page_id.'_'.$i, $str); - $replacements[$page_id.'_'.$i] = $v; + $replacements[$page_id.'_'.$i] = $v[0]; } } $bits = preg_split("/(;|,)/", $str); @@ -79,13 +78,14 @@ } foreach ($bits as $val) { if (trim($val)) { - if (isset($replacements[$val])) { - $val = $replacements[$val]; + foreach ($replacements as $hash => $orig) { + $val = str_replace($hash, $orig, $val); } $address = ''; $labels = ''; if (strstr($val, ' ')) { foreach (explode(' ', $val) as $v) { + $v = trim($v); if (strstr($v, '@')) { $address = trim($v); } @@ -93,6 +93,10 @@ $labels .= ' '.trim($v); } } + $labels = trim($labels); + if ($val != $user->decode_fld($val, $charset) && !preg_match("/^'[^']*'$/", $labels) && !preg_match('/^"[^"]*"$/', $labels)) { + $val = str_replace($labels, '"'.str_replace('"', '\"', $labels).'"', $val); + } } else { if (strstr($val, '@')) { Modified: trunk/hastymail2/lib/url_action_classes/compose.php =================================================================== --- trunk/hastymail2/lib/url_action_classes/compose.php 2011-01-27 14:19:18 UTC (rev 1776) +++ trunk/hastymail2/lib/url_action_classes/compose.php 2011-01-28 18:04:36 UTC (rev 1777) @@ -307,6 +307,10 @@ elseif (isset($all_headers['delivered-to'])) { $to_address = $all_headers['delivered-to']; } + $to = parse_address_fld($to, $message_data['charset']); + if ($to) { + $to = $to[0]['raw']; + } if ($type == 'all') { $to_vals = array(); $cc_vals = array(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |