Mailinglist Archive: opensuse-boosters (69 mails)

< Previous Next >
[opensuse-boosters] Threads in hermes mails
  • From: Vincent Untz <vuntz@xxxxxxxxxxxx>
  • Date: Mon, 21 Dec 2009 14:18:06 +0100
  • Message-id: <20091221131806.GA14049@xxxxxxxxx>
Hey,

I love hermes mails, but I would love them even more if the mails for
one request where all grouped in a thread.

So here's my completely untested attempt for this (and I'm not sure I'm
still fluent in perl, so there might be some stupid errors). Is there
any way to easily test this kind of things?

Cheers,

Vincent

--
Les gens heureux ne sont pas press├ęs.
From b2e45ba248e64fa543ae7d1bd123f616992d7fad Mon Sep 17 00:00:00 2001
From: Vincent Untz <vuntz@xxxxxxxxxxxx>
Date: Mon, 21 Dec 2009 14:12:58 +0100
Subject: [PATCH] use threads for request mails

---
Hermes/Delivery/Mail.pm | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/Hermes/Delivery/Mail.pm b/Hermes/Delivery/Mail.pm
index d20661d..989e10a 100644
--- a/Hermes/Delivery/Mail.pm
+++ b/Hermes/Delivery/Mail.pm
@@ -92,6 +92,23 @@ sub sendMail( $ )
$mime_msg->add('reply-to' => $pReplyToRef->{email} || "unknown" ) ;
}

+ if( $msg->{type} =~ /obs_srcsrv_request_/ ) {
+ my $type = $msg->{type};
+ my $id = $msg->{_msgTypeId};
+ my $OBSAPIUrl = $Hermes::Config::OBSAPIBase || "http://api.opensuse.org/";;
+ $OBSAPIUrl =~ s/\s*$//; # Wipe whitespace at end.
+ $OBSAPIUrl =~ s/\W/./g; # Replace any non-alphanumeric with .
+ $OBSAPIUrl =~ s/\.\.+/./g; # Do not have more than one consecutive .
+ my $messageid = "<$type-request-$id\@$OBSAPIUrl>";
+
+ if( $msg->{type} == 'obs_srcsrv_request_create' ) {
+ $mime_msg->replace('Message-ID' => $messageid);
+ } else {
+ $mime_msg->add('In-Reply-To' => $messageid);
+ $mime_msg->add('References' => $messageid);
+ }
+ }
+
$mime_msg->add('X-hermes-msg-type' => $msg->{type} ) if( $msg->{type} );
$mime_msg->replace('Precedence' => 'bulk');
$mime_msg->replace('X-Mailer' => 'openSUSE Notification System');
--
1.6.4.2

< Previous Next >
List Navigation
Follow Ups