Got reply and forward working
[squirrelmail.git] / functions / mailbox.php
index 44ea499de34d6f33af0f8cc70fba90cb7691e57c..9092744d48cad7db4c440c5f72d202217c533c7d 100644 (file)
       }
    }
 
+   function decodeEmailAddr($sender) {
+      $emailAddr = getEmailAddr($sender);
+      $emailStart = strpos($emailAddr, "EMAILSTART--");
+      $emailEnd = strpos($emailAddr, "--EMAILEND") - 10;
+
+      $emailAddr = ereg_replace("EMAILSTART--", "", $emailAddr);
+      $emailAddr = ereg_replace("--EMAILEND", "", $emailAddr);
+      return $emailAddr;
+   }
+
    function getEmailAddr($sender) {
       if (strpos($sender, "EMAILSTART--") == false)
          return "";
       $wrap_at = 80; // Make this configurable int the config file some time
       if (strlen($line) - 2 >= $wrap_at) // -2 because of the ^^ at the beginning
          $line = wordWrap($line, $wrap_at);
+
       $line = str_replace(" ", " ", $line);
       $line = str_replace("\t", "        ", $line);
 
           "www" and "mailto" also.  That should probably be added later. **/
       if (strpos(strtolower($line), "http://") != false) {
          $start = strpos(strtolower($line), "http://");
-         $link = substr($line, $start, strlen($line));
+         $text = substr($line, $start, strlen($line));
+         $link = ereg_replace("<BR>", "", $text);
 
          if (strpos($link, "&"))
             $end = strpos($link, "&");
             $end = strlen($link);
 
          $link = substr($link, 0, $end);
-
-         $line = str_replace($link, "<A HREF=\"$link\" TARGET=_top>$link</A>", $line);
+         $line = str_replace($text, "<A HREF=\"$link\" TARGET=_top>$text</A>", $line);
       }
 
       return $line;