From ef56c491a65eed9dfddb2866c5faa59acb69b0ed Mon Sep 17 00:00:00 2001 From: "dkl%redhat.com" <> Date: Thu, 28 Aug 2008 01:38:45 +0000 Subject: Bug 449791 – Allow flag notification emails to be threaded similar to normal bug change emails Patch by Dave Lawrence - r/a=LpSolit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Bugzilla/Mailer.pm | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'Bugzilla/Mailer.pm') diff --git a/Bugzilla/Mailer.pm b/Bugzilla/Mailer.pm index 5c7a75450..c790d179f 100644 --- a/Bugzilla/Mailer.pm +++ b/Bugzilla/Mailer.pm @@ -35,7 +35,7 @@ package Bugzilla::Mailer; use strict; use base qw(Exporter); -@Bugzilla::Mailer::EXPORT = qw(MessageToMTA); +@Bugzilla::Mailer::EXPORT = qw(MessageToMTA build_thread_marker); use Bugzilla::Constants; use Bugzilla::Error; @@ -154,4 +154,31 @@ sub MessageToMTA { } } +# Builds header suitable for use as a threading marker in email notifications +sub build_thread_marker { + my ($bug_id, $user_id, $is_new) = @_; + + if (!defined $user_id) { + $user_id = Bugzilla->user->id; + } + + my $sitespec = '@' . Bugzilla->params->{'urlbase'}; + $sitespec =~ s/:\/\//\./; # Make the protocol look like part of the domain + $sitespec =~ s/^([^:\/]+):(\d+)/$1/; # Remove a port number, to relocate + if ($2) { + $sitespec = "-$2$sitespec"; # Put the port number back in, before the '@' + } + + my $threadingmarker; + if ($is_new) { + $threadingmarker = "Message-ID: "; + } + else { + $threadingmarker = "In-Reply-To: " . + "\nReferences: "; + } + + return $threadingmarker; +} + 1; -- cgit v1.2.3-24-g4f1b