summaryrefslogtreecommitdiffstats
path: root/Bugzilla/BugMail.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-08-16 02:58:10 +0200
committerlpsolit%gmail.com <>2005-08-16 02:58:10 +0200
commit044848e67b4134b9429f880774c9c6cf577226cc (patch)
tree365261b53d20a19ed440fead50676ac7b421af0c /Bugzilla/BugMail.pm
parent746013729e6377357efb68de8d7f2fd93e25a07c (diff)
downloadbugzilla-044848e67b4134b9429f880774c9c6cf577226cc.tar.gz
bugzilla-044848e67b4134b9429f880774c9c6cf577226cc.tar.xz
Bug 304660: PerformSubsts() should be in Util.pm instead of BugMail.pm - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat a=myk
Diffstat (limited to 'Bugzilla/BugMail.pm')
-rw-r--r--Bugzilla/BugMail.pm30
1 files changed, 2 insertions, 28 deletions
diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm
index dffc98a85..59d4210a1 100644
--- a/Bugzilla/BugMail.pm
+++ b/Bugzilla/BugMail.pm
@@ -32,11 +32,6 @@ use strict;
package Bugzilla::BugMail;
-use base qw(Exporter);
-@Bugzilla::BugMail::EXPORT = qw(
- PerformSubsts
-);
-
use Bugzilla::DB qw(:deprecated);
use Bugzilla::User;
use Bugzilla::Constants;
@@ -603,7 +598,7 @@ sub sendMail {
my $template = Param("newchangedmail");
- my $msg = PerformSubsts($template, \%substs);
+ my $msg = perform_substs($template, \%substs);
MessageToMTA($msg);
@@ -730,32 +725,11 @@ sub encode_message {
return ($head, $body);
}
-# Performs substitutions for sending out email with variables in it,
-# or for inserting a parameter into some other string.
-#
-# Takes a string and a reference to a hash containing substitution
-# variables and their values.
-#
-# If the hash is not specified, or if we need to substitute something
-# that's not in the hash, then we will use parameters to do the
-# substitution instead.
-#
-# Substitutions are always enclosed with '%' symbols. So they look like:
-# %some_variable_name%. If "some_variable_name" is a key in the hash, then
-# its value will be placed into the string. If it's not a key in the hash,
-# then the value of the parameter called "some_variable_name" will be placed
-# into the string.
-sub PerformSubsts {
- my ($str, $substs) = (@_);
- $str =~ s/%([a-z]*)%/(defined $substs->{$1} ? $substs->{$1} : Param($1))/eg;
- return $str;
-}
-
# Send the login name and password of the newly created account to the user.
sub MailPassword {
my ($login, $password) = (@_);
my $template = Param("passwordmail");
- my $msg = PerformSubsts($template,
+ my $msg = perform_substs($template,
{"mailaddress" => $login . Param('emailsuffix'),
"login" => $login,
"password" => $password});