[Svn] r3358 - in trunk/roundcubemail/program: include steps/mail

trac at roundcube.net trac at roundcube.net
Fri Mar 12 14:54:56 CET 2010


Author: alec
Date: 2010-03-12 07:54:56 -0600 (Fri, 12 Mar 2010)
New Revision: 3358

Modified:
   trunk/roundcubemail/program/include/rcube_imap.php
   trunk/roundcubemail/program/include/rcube_smtp.php
   trunk/roundcubemail/program/steps/mail/func.inc
Log:
- fixes for proper handling of email addresses with form: "user"@domain.tld


Modified: trunk/roundcubemail/program/include/rcube_imap.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_imap.php	2010-03-12 13:33:36 UTC (rev 3357)
+++ trunk/roundcubemail/program/include/rcube_imap.php	2010-03-12 13:54:56 UTC (rev 3358)
@@ -2675,8 +2675,12 @@
     foreach ($a as $val)
       {
       $j++;
-      $address = $val['address'];
-      $name = preg_replace(array('/^[\'"]/', '/[\'"]$/'), '', trim($val['name']));
+      $address = trim($val['address']);
+      $name = trim($val['name']);
+
+      if (preg_match('/^[\'"]/', $name) && preg_match('/[\'"]$/', $name))
+        $name = preg_replace(array('/^[\'"]/', '/[\'"]$/'), '', $name);
+
       if ($name && $address && $name != $address)
         $string = sprintf('%s <%s>', preg_match("/$special_chars/", $name) ? '"'.addcslashes($name, '"').'"' : $name, $address);
       else if ($address)
@@ -2687,7 +2691,7 @@
       $out[$j] = array('name' => $name,
                        'mailto' => $address,
                        'string' => $string);
-              
+
       if ($max && $j==$max)
         break;
       }

Modified: trunk/roundcubemail/program/include/rcube_smtp.php
===================================================================
--- trunk/roundcubemail/program/include/rcube_smtp.php	2010-03-12 13:33:36 UTC (rev 3357)
+++ trunk/roundcubemail/program/include/rcube_smtp.php	2010-03-12 13:54:56 UTC (rev 3358)
@@ -392,14 +392,14 @@
     
     $addresses = array();
     $recipients = rcube_explode_quoted_string(',', $recipients);
-  
+
     reset($recipients);
     while (list($k, $recipient) = each($recipients))
     {
       $a = explode(" ", $recipient);
       while (list($k2, $word) = each($a))
       {
-        if ((strpos($word, "@") > 0) && (strpos($word, "\"")===false))
+        if (strpos($word, "@") > 0 && $word[strlen($word)-1] != '"')
         {
           $word = preg_replace('/^<|>$/', '', trim($word));
           if (in_array($word, $addresses)===false)
@@ -411,5 +411,3 @@
   }
 
 }
-
-?>

Modified: trunk/roundcubemail/program/steps/mail/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/func.inc	2010-03-12 13:33:36 UTC (rev 3357)
+++ trunk/roundcubemail/program/steps/mail/func.inc	2010-03-12 13:54:56 UTC (rev 3358)
@@ -1191,7 +1191,7 @@
   if ($got_writable_abook === null && $books = $RCMAIL->get_address_sources(true)) {
     $got_writable_abook = true;
   }
-  
+
   foreach ($a_parts as $part) {
     $j++;
     if ($PRINT_MODE) {

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list