[Mimedefang] proposing a patch for URL listing in boilerplate	and	more
    David F. Skoll 
    dfs at roaringpenguin.com
       
    Tue Dec 25 12:02:15 EST 2007
    
    
  
OK, I think I see the problem you're trying to solve.  I think
action_replace_with_url is badly designed.  We should split out
the copying of the attachment to the document root from the message
modification.  An API something like this:
my @saved_parts;
sub filter_begin
{
	undef @saved_parts;
}
sub filter
{
	# ...
	# Save a copy in the document root
	my $hash = action_save_for_web($entity, $doc_root);
	# Save hash for later
	push(@saved_parts, $hash);
	# Remove attachment from message
	action_drop();
}
sub filter_end
{
	# ...
	if (scalar(@saved_parts)) {
		my $boilerplate = '';
		foreach my $hash(@saved_parts) {
			$boilerplate .= "A part was saved as http://example.com/$hash\n";
		}
		append_text_boilerplate($entity, $boilerplate);
        }
}
In other words, action_save_for_web will return a hash.  It's up to you
to save the hashes somewhere and add the boilerplate text in filter_end.
What do you think?
Regards,
David.
    
    
More information about the MIMEDefang
mailing list