diff options
author | thomascube <thomas@roundcube.net> | 2007-03-14 00:39:51 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2007-03-14 00:39:51 +0000 |
commit | 5a6ad209837a8bcca14d4f74541d8ac3ea760341 (patch) | |
tree | 72ebaf62990f65cd2d95e27feeb2d30a0f9e4cdb /program/include | |
parent | 1c7b97e81bea919c26bfe878312c5118c02ac0a9 (diff) |
Fixed message headers encoding; improved recipient splitting; applied patch for attachment download (#1484198)
Diffstat (limited to 'program/include')
-rw-r--r-- | program/include/rcube_imap.inc | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/program/include/rcube_imap.inc b/program/include/rcube_imap.inc index 9f249d57b..7ac51fcc5 100644 --- a/program/include/rcube_imap.inc +++ b/program/include/rcube_imap.inc @@ -2454,7 +2454,7 @@ class rcube_imap function _parse_address_list($str) { // remove any newlines and carriage returns before - $a = $this->_explode_quoted_string(',', preg_replace( "/[\r\n]/", " ", $str)); + $a = $this->_explode_quoted_string('[,;]', preg_replace( "/[\r\n]/", " ", $str)); $result = array(); foreach ($a as $key => $val) @@ -2481,17 +2481,20 @@ class rcube_imap function _explode_quoted_string($delimiter, $string) { - $quotes = explode("\"", $string); - foreach ($quotes as $key => $val) - if (($key % 2) == 1) - $quotes[$key] = str_replace($delimiter, "_!@!_", $quotes[$key]); - - $string = implode("\"", $quotes); - - $result = explode($delimiter, $string); - foreach ($result as $key => $val) - $result[$key] = str_replace("_!@!_", $delimiter, $result[$key]); + $result = array(); + $strlen = strlen($string); + for ($q=$p=$i=0; $i < $strlen; $i++) + { + if ($string{$i} == "\"" && $string{$i-1} != "\\") + $q = $q ? false : true; + else if (!$q && preg_match("/$delimiter/", $string{$i})) + { + $result[] = substr($string, $p, $i - $p); + $p = $i + 1; + } + } + $result[] = substr($string, $p); return $result; } } |