Index: openacs-4/packages/dotlrn/tcl/spam-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn/tcl/spam-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/dotlrn/tcl/spam-procs.tcl 9 May 2018 15:33:30 -0000 1.13 +++ openacs-4/packages/dotlrn/tcl/spam-procs.tcl 3 Sep 2024 15:37:37 -0000 1.14 @@ -28,20 +28,25 @@ namespace eval spam { - ad_proc -public interpolate { + ad_proc -deprecated -public interpolate { {-values:required} {-text:required} } { Interpolates a set of values into a string. + DEPRECATED: code duplicated in bulk-mail and acs-mail-lite that can be + replaced by "string map" + + @see "string map" + @param values a list of tuples, each one consisting of a target string and the value it is to be replaced with. @param text the string that is to be interpolated @return the interpolated string } { foreach tuple $values { - regsub -all [lindex $tuple 0] $text [lindex $tuple 1] text + regsub -all -- [lindex $tuple 0] $text [lindex $tuple 1] text } return $text @@ -66,22 +71,21 @@ @param message_values a list of tuples of key/value pairs to interpolate into the email } { + set subject [string map $message_values $subject] + set message [string map $message_values $message] - set subject [interpolate -values $message_values -text $subject] - set message [interpolate -values $message_values -text $message] - # loop through all the recipients and send them the spam set errors "" db_foreach select_recipient_info {} { # replace some values in the subject and the message set values [list] - lappend values [list \{email\} $email] - lappend values [list \{first_names\} $first_names] - lappend values [list \{last_name\} $last_name] - lappend values [list \{from\} $from] + lappend values \{email\} "$email" + lappend values \{first_names\} "$first_names" + lappend values \{last_name\} "$last_name" + lappend values \{from_addr\} "$from" - set subject [interpolate -values $values -text $subject] - set message [interpolate -values $values -text $message] + set subject [string map $values $subject] + set message [string map $values $message] # send the email if {[catch {acs_mail_lite::send -send_immediately -to_addr $email -from_addr $from -subject $subject -body $message} errmsg]} {