diff options
author | Dexter Morgan <dmorgan@mageia.org> | 2013-02-21 08:36:33 +0000 |
---|---|---|
committer | Dexter Morgan <dmorgan@mageia.org> | 2013-02-21 08:36:33 +0000 |
commit | 549bd6b0e3fa182d3eff47e67d4f1ab2729dd21d (patch) | |
tree | 4d8248e158f2f38a3b78758caae40b93a750656e /Extension.pm | |
download | bugzilla-549bd6b0e3fa182d3eff47e67d4f1ab2729dd21d.tar bugzilla-549bd6b0e3fa182d3eff47e67d4f1ab2729dd21d.tar.gz bugzilla-549bd6b0e3fa182d3eff47e67d4f1ab2729dd21d.tar.bz2 bugzilla-549bd6b0e3fa182d3eff47e67d4f1ab2729dd21d.tar.xz bugzilla-549bd6b0e3fa182d3eff47e67d4f1ab2729dd21d.zip |
Add mageia extension, from Frederic Buclin
Diffstat (limited to 'Extension.pm')
-rw-r--r-- | Extension.pm | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/Extension.pm b/Extension.pm new file mode 100644 index 0000000..1ebd30b --- /dev/null +++ b/Extension.pm @@ -0,0 +1,32 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +package Bugzilla::Extension::Mageia; +use strict; +use base qw(Bugzilla::Extension); + +use Bugzilla::User; +use Bugzilla::Extension::Mageia::Util; + +use Email::Address; + +our $VERSION = '0.02'; + +sub mailer_before_send { + my ($self, $args) = @_; + my $email = $args->{email}; + + # Include the changer's name in the "From:" field. + if (my $changer = $email->header('X-Bugzilla-Who')) { + $changer = Bugzilla::User->new({ name => $changer }); + my $changer_name = $changer ? $changer->name : undef; + my $address = Email::Address->new($changer_name, $email->header('From')); + $email->header_set('From', $address->format); + } +} + +__PACKAGE__->NAME; |