[imp] imp-3.2.2 messes up from addresses

Peter Solodov peter at alcor.concordia.ca
Tue Sep 16 18:28:49 PDT 2003


On 16 Sep 2003, Tim Winders wrote:
> I have upgraded from imp-3.1 to imp-3.2.2 and now, when sending
> email from IMP, the From addresses are not getting sent correctly.
>
> The end user cannot change the from address.
>
> Now, when sending email, it gets delivered to the recipient as
> \"twinders\"@southplainscollege.edu
>
> There is something with the quotes / quoting going on that I can't
> figure out.
>
> Any clues on this one?

Yep, just finished fixing it (only in one place though).  It still
happens when addresses are inserted from address book, didn't find
where that happens yet.  The diff is after the signature.  I was going
to send that same question to the list but then found where to fix it
and decided to do that first.

        - Peter

-- 
Peter Solodov                    | Concordia University 
http://alcor.concordia.ca/~peter | Montreal, QC, Canada

--- imp-3.2.2/lib/IMP.php.20030916      2003-09-16 21:15:50.000000000
-0400
+++ imp-3.2.2/lib/IMP.php       2003-09-16 21:10:54.000000000 -0400
@@ -1381,7 +1381,23 @@
         $filter .= "()<>@,;:\\\"[]\1\2\3\4\5\6\7\10\11\12\13\14\15\16\17\20\21\22\23\24\25\26\27\30\31\32\33\34\35\36\37\177";

         if (strcspn($str, $filter) != strlen($str)) {
-            return '"' . str_replace('"', '\\"', str_replace('\\', '\\\\', $str)) . '"';
+            // 2003/09/16 Peter Solodov: take surrounding quotes into account
+
+            $start = 0;
+            $end = strlen($str);
+
+            if ($str[0] == '"')
+            {
+                $start = 1;
+            }
+            if ($str[strlen($str) - 1] == '"')
+            {
+                $end = strlen($str) - 2;
+            }
+
+            $sub_str = substr($str, $start, $end);
+
+            return '"' . str_replace('"', '\\"', str_replace('\\',
+            '\\\\', $sub_str)) . '"';
         } else {
             return $str;
         }


More information about the imp mailing list