[interchange-cvs] interchange - racke modified lib/Vend/Email.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Thu Oct 18 15:33:26 EDT 2007


User:      racke
Date:      2007-10-18 19:33:25 GMT
Modified:  lib/Vend Email.pm
Log:
Copy option hash to avoid messing with caller's data
Unravel code setting reply_to from reply input, primarily
to fix a bug which resulted in "1" as reply-to header

Revision  Changes    Path
1.5       +17 -6     interchange/lib/Vend/Email.pm


rev 1.5, prev_rev 1.4
Index: Email.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Email.pm,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- Email.pm	10 Oct 2007 17:29:41 -0000	1.4
+++ Email.pm	18 Oct 2007 19:33:25 -0000	1.5
@@ -1,6 +1,6 @@
 # Vend::Email - Handle Interchange email functions
 # 
-# $Id: Email.pm,v 1.4 2007/10/10 17:29:41 racke Exp $
+# $Id: Email.pm,v 1.5 2007/10/18 19:33:25 racke Exp $
 #
 # Copyright (C) 2007 Interchange Development Group
 #
@@ -55,7 +55,7 @@
 
 use vars qw/$VERSION/;
 
-$VERSION = substr(q$Revision: 1.4 $, 10);
+$VERSION = substr(q$Revision: 1.5 $, 10);
 
 
 ###########################################################################
@@ -81,7 +81,9 @@
 #   $opt->{data} || $opt->{body} || $_[1] (arg 2)
 #
 sub tag_mime_lite_email {
-	my ($opt, $body) = @_;
+	my ($optin, $body) = @_;
+	my ($opt);
+	
 	#::logDebug('mime_lite_email invoked, OPT=' .uneval($opt) . ' BODY=' . $body);
 
 	local $_;
@@ -94,6 +96,11 @@
 		::logError('Unable to send email, config option SendMailProgram=none.');
 		return;
 	}
+	#
+	# Copy option hash to avoid messing with caller's data
+	#
+
+	%$opt = %$optin;
 
 	#
 	# Quickly make sure that all options and header names satisfy basic rules.
@@ -280,9 +287,13 @@
 
 	# REPLY
 	if (!( $opt->{reply_to} and @{ $opt->{reply_to} } )) {
-		@{ $opt->{reply_to} } = 
-			( ref $opt->{reply} ? @{ $opt->{reply} } : $opt->{reply} ) ||
-			$::Values->{mv_email};
+		$opt->{reply_to} = [$::Values->{email}];
+		
+		if (ref($opt->{reply})) {
+			$opt->{reply_to} = $opt->{reply};
+		} elsif ($opt->{reply}) {
+			$opt->{reply_to} = [$opt->{reply}];
+		}
 	}
 	delete $opt->{reply};
 








More information about the interchange-cvs mailing list