From: lkehresman Date: Tue, 14 Dec 1999 20:28:35 +0000 (+0000) Subject: added "reply-to" capabilities X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=commitdiff_plain;h=5c55c29540e62b101fcebdb779daf3309bde2709;hp=050432de09a481dac57fd18b93122e9e4b8d811b added "reply-to" capabilities git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@79 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/mailbox.php b/functions/mailbox.php index 8f9c92ab..383da2df 100644 --- a/functions/mailbox.php +++ b/functions/mailbox.php @@ -244,7 +244,7 @@ } function fetchHeader($imapConnection, $id) { - fputs($imapConnection, "messageFetch FETCH $id:$id RFC822.HEADER.LINES (From Subject Date To Cc Content-Type MIME-Version)\n"); + fputs($imapConnection, "messageFetch FETCH $id:$id RFC822.HEADER\n"); $read = fgets($imapConnection, 1024); /** defaults... if the don't get overwritten, it will display text **/ @@ -309,9 +309,18 @@ } } + + /** REPLY-TO **/ + else if (substr($read, 0, 9) == "Reply-To:") { + $header["REPLYTO"] = trim(substr($read, 9, strlen($read))); + $read = fgets($imapConnection, 1024); + } + /** FROM **/ else if (substr($read, 0, 5) == "From:") { $header["FROM"] = trim(substr($read, 5, strlen($read) - 6)); + if ($header["REPLYTO"] == "") + $header["REPLYTO"] = $header["FROM"]; $read = fgets($imapConnection, 1024); } /** DATE **/ diff --git a/functions/mime.php b/functions/mime.php index aabd9cd8..6182250f 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -6,7 +6,7 @@ function decodeMime($body, $bound, $type0, $type1) { - echo "$type0/$type1
"; +// echo "$type0/$type1
"; if ($type0 == "multipart") { if ($body[0] == "") $i = 1; @@ -42,7 +42,7 @@ /** This gets one entity's properties **/ function getEntity($body, $bound, $type0, $type1, $encoding, $charset) { - echo "$type0/$type1
"; +// echo "$type0/$type1
"; $msg[0]["TYPE0"] = $type0; $msg[0]["TYPE1"] = $type1; $msg[0]["ENCODING"] = $encoding; diff --git a/src/compose.php b/src/compose.php index 38ca4215..83cb45bd 100644 --- a/src/compose.php +++ b/src/compose.php @@ -12,17 +12,14 @@ $imapConnection = loginToImapServer($username, $key, $imapServerAddress); displayPageHeader("None"); - if ($reply_id) { + if ($reply_id || $forward_id) { selectMailbox($imapConnection, $mailbox, $numMessages); - $body_ary = fetchBody($imapConnection, $reply_id); - for ($i=0;$i < count($body_ary);$i++) { - $tmp = strip_tags($body_ary[$i]); - $tmp = substr($tmp, 0, strlen($tmp) -1); - $body = "$body> $tmp"; - } - } else if ($forward_id) { - selectMailbox($imapConnection, $mailbox, $numMessages); - $body_ary = fetchBody($imapConnection, $forward_id); + if ($reply_id) + $msg = fetchMessage($imapConnection, $reply_id); + else + $msg = fetchMessage($imapConnection, $forward_id); + + $body_ary = formatBody($msg); for ($i=0;$i < count($body_ary);$i++) { $tmp = strip_tags($body_ary[$i]); $tmp = substr($tmp, 0, strlen($tmp) -1); @@ -31,11 +28,11 @@ } echo "
\n"; - echo "\n"; + echo "
\n"; echo " \n"; - echo " \n"; echo " \n"; echo " \n"; - echo " \n"; echo " \n"; echo " \n"; - echo " \n"; echo " \n"; echo " \n"; - echo " \n"; echo " \n"; echo " \n"; - echo " "; - echo " "; echo " \n"; echo "
\n"; + echo " \n"; echo " To: \n"; - echo " \n"; + echo " \n"; if ($send_to) echo "
"; else @@ -43,31 +40,40 @@ echo "
\n"; + echo " \n"; echo " CC:\n"; - echo " \n"; + echo " \n"; echo "
"; echo "
\n"; + echo " \n"; echo " BCC:\n"; - echo " \n"; + echo " \n"; echo "
"; echo "
\n"; + echo " \n"; echo " Subject:\n"; - echo " \n"; + echo " \n"; if ($reply_subj) { $reply_subj = str_replace("\"", "'", $reply_subj); $reply_subj = stripslashes($reply_subj); - echo "
"; + $reply_subj = trim($reply_subj); + if (substr(strtolower($reply_subj), 0, 3) != "re:") + $reply_subj = "Re: $reply_subj"; + echo " "; } else if ($forward_subj) { - $forward_subj = stripquotes($forward_subj); - echo "
"; + $forward_subj = str_replace("\"", "'", $forward_subj); + $forward_subj = stripslashes($forward_subj); + $forward_subj = trim($forward_subj); + if ((substr(strtolower($forward_subj), 0, 4) != "fwd:") && + (substr(strtolower($forward_subj), 0, 5) != "[fwd:") && + (substr(strtolower($forward_subj), 0, 6) != "[ fwd:")) + $forward_subj = "[Fwd: $forward_subj]"; + echo " "; } else { echo " "; } @@ -75,10 +81,8 @@ echo "
\n"; - echo " \n"; - echo "
"; + echo "
\n"; + echo "   
"; echo "
\n"; diff --git a/src/read_body.php b/src/read_body.php index 7e98d1a5..88c1093f 100644 --- a/src/read_body.php +++ b/src/read_body.php @@ -22,7 +22,7 @@ /** translate the subject and mailbox into url-able text **/ $url_subj = urlencode(trim($message["HEADER"]["SUBJECT"])); $urlMailbox = urlencode($mailbox); - $url_from = urlencode($message["HEADER"]["FROM"]); + $url_replyto = urlencode($message["HEADER"]["REPLYTO"]); $dateString = getLongDateString($message["HEADER"]["DATE"]); @@ -91,7 +91,7 @@ echo " "; echo " "; echo " Forward  "; - echo " Reply  "; + echo " Reply  "; echo " "; echo " "; echo " "; @@ -145,32 +145,11 @@ echo " \n"; $body = formatBody($message); + for ($i = 0; $i < count($body); $i++) { echo "$body[$i]"; } -/* if (count($message["ENTITIES"]) > 1) { - echo "
This is a multipart MIME encoded message.
"; - echo ""; - - $i = 0; - $q = 0; - $entity[0] = $i; - while ($i < count($message["ENTITIES"])) { - $b = $i + 1; - echo "
Part $b
"; - for ($p = 0; $p < count($message["ENTITIES"][$i][0]["BODY"]); $p++) { - echo $message["ENTITIES"][$i][0]["BODY"][$p]; - } - $i++; - } - } else { - echo "
This is a single part MIME encoded message.
"; - for ($p = 0; $p < count($message["ENTITIES"][0]["BODY"]); $p++) { - echo $message["ENTITIES"][0]["BODY"][$p]; - } - } -*/ echo "
\n"; echo "  "; echo "\n";