From c58c0aedbaab765406de262f792b0998da151812 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Fri, 16 Jan 2009 14:32:58 -0500
Subject: [PATCH] - Fix address names with '@' sign handling (#1485654)

---
 program/include/rcube_imap.php |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php
index 36a3463..9fae0c6 100644
--- a/program/include/rcube_imap.php
+++ b/program/include/rcube_imap.php
@@ -2933,7 +2933,7 @@
     // remove any newlines and carriage returns before
     $a = $this->_explode_quoted_string('[,;]', preg_replace( "/[\r\n]/", " ", $str));
     $result = array();
-    
+
     foreach ($a as $key => $val)
       {
       $val = preg_replace("/([\"\w])</", "$1 <", $val);
@@ -2942,8 +2942,8 @@
 
       foreach ($sub_a as $k => $v)
         {
-        if (strpos($v, '@') > 0)
-          $result[$key]['address'] = str_replace('<', '', str_replace('>', '', $v));
+        if (preg_match('/^<\S+@\S+>$/', $v))
+          $result[$key]['address'] = trim($v, '<>');
         else
           $result[$key]['name'] .= (empty($result[$key]['name'])?'':' ').str_replace("\"",'',stripslashes($v));
         }

--
Gitblit v1.9.1