X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=Debbugs%2FEmail.pm;fp=Debbugs%2FEmail.pm;h=0000000000000000000000000000000000000000;hb=53c435119200ab9b1c2538a96b8374c51a078855;hp=980b5fb6e7930870c570b494e9460db6913bc417;hpb=0e8f07fda6e40b5967d9c6b28b3200db22766343;p=debbugs.git diff --git a/Debbugs/Email.pm b/Debbugs/Email.pm deleted file mode 100644 index 980b5fb..0000000 --- a/Debbugs/Email.pm +++ /dev/null @@ -1,79 +0,0 @@ -package Debbugs::Email; - -use strict; - -BEGIN { - use Exporter (); - use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); - - # set the version for version checking - $VERSION = 1.00; - - @ISA = qw(Exporter); - @EXPORT = qw( %GTags ); - %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ], - - # your exported package globals go here, - # as well as any optionally exported functions - @EXPORT_OK = qw( %GTags ); -} - -use vars @EXPORT_OK; -use Debbugs::Config qw(%Globals); - -# initialize package globals, first exported ones -%GTags= ( ); - -############################################################################# -# Initialize Global Tags -############################################################################# -sub InitEmailTags -{ my @config = @_; - - print "V: Initializing Email Tags\n" if $Globals{ 'verbose' }; - for( my $i=0; $i<=$#config; $i++) - { $_ = $config[$i]; - chop $_; - next unless length $_; - next if /^#/; - if ( /^GTAG\s*[:=]\s*(\S)+\s*[:=]\s*([^#]*)/i ) - { $GTags{ $1 } = $2; - print "D2: (email) GTag $1=$GTags{$1}\n" if $Globals{ 'debug' } > 1; - } - } -} - -############################################################################# -# Load File with Tags -############################################################################# -sub LoadEmail -{ my $emailfile = $_[0]; - my @email; - - open( LETTER, $emailfile ) or &::fail( "Unable to open $emailfile: $!" ); - @email = ; - close LETTER; - &ProcessTags( \@email, \%GTags, "GTAG" ); - return @email; -} -############################################################################# -# Process Tags -############################################################################# -sub ProcessTags -{ my ($email, $tagsin, $marker) = @_; - my %tags=%$tagsin; - my $tag; - - print "V: Processing Template Mail\n" if $Globals{ 'verbose' }; - foreach my $line ( @$email ) - { while( $line =~ /\%$marker\_(\S*)\%/s ) - { if( defined( $tags{ $1 } ) ) { $tag = $tags{ $1 }; } - else { $tag = "(missed tag $1)"; } - $line =~ s/\%$marker\_(\S*)\%/$tag/; - } - } - 1; -} - -END { } # module clean-up code here (global destructor) -1;