From e66b736aa6c2e00643b9b061d7064c7991503390 Mon Sep 17 00:00:00 2001 From: Joel Uckelman Date: Mon, 27 Feb 2012 05:54:36 +0100 Subject: Remove Edit marker from incoming mail, add it to outgoing mail. --- src/build_email.php | 15 +++++++-------- src/build_post.php | 5 +++-- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/build_email.php b/src/build_email.php index a5bb7bd..567da0d 100644 --- a/src/build_email.php +++ b/src/build_email.php @@ -97,7 +97,7 @@ function build_email_from($name, $email) { return sprintf('%s <%s>', $qname, $email); } -function build_email_subject($forumtag, $reply, $subject) { +function build_email_subject($forumtag, $subject, $reply, $edit) { $subject = trim($subject); if ($subject == '') { $subject = '(no subject)'; @@ -109,22 +109,21 @@ function build_email_subject($forumtag, $reply, $subject) { $subject = 'Re: ' . $subject; } + if ($edit) { + $subject = 'Edit: ' . $subject; + } + return utf8_quote_non_ascii($subject); } function build_email_headers( - $userName, $userEmail, $to, $sender, $subject, $edit, - $time, $messageId, $forumURL, $inReplyTo, $references) + $userName, $userEmail, $to, $sender, $subject, $time, + $messageId, $forumURL, $inReplyTo, $references) { $from = build_email_from($userName, $userEmail); $subject = utf8_quote_non_ascii($subject); $date = date(DATE_RFC2822, $time); - if ($edit) { - $edit_header = 'Edit: '; - $subject = $edit_header . $subject; - } - $headers = array( 'To' => $to, 'From' => $from, diff --git a/src/build_post.php b/src/build_post.php index 98f6dc7..aa0cbf6 100644 --- a/src/build_post.php +++ b/src/build_post.php @@ -6,8 +6,9 @@ function build_post_subject($listtag, $forumtag, $subject) { '|' . preg_quote($forumtag, '/') . ')\\s*/'; $subj = preg_replace($tagpat, '', $subject); - // strip leading sequences of Re-equivalents - if (preg_match('/^(?:(?:RE|AW|SV|VS)(?:\\[\\d+\\])?:\\s*)+/i', $subj, $m)) { + // strip leading sequences of Re-equivalents and Edit + $re = '/^(?:(?:RE|AW|SV|VS|EDIT)(?:\\[\\d+\\])?:\\s*)+/i'; + if (preg_match($re, $subj, $m)) { $subj = substr($subj, strlen($m[0])); } -- cgit v1.2.3