Flail::Exec::Cmd::forward - Flail "forward" command


flail documentation Contained in the flail distribution.

Index


Code Index:

NAME

Top

Flail::Exec::Cmd::forward - Flail "forward" command

VERSION

Top

  Time-stamp: <2006-12-03 10:45:26 attila@stalphonsos.com>

SYNOPSIS

Top

  use Flail::Exec::Cmd::forward;
  blah;

DESCRIPTION

Top

Describe the module.

AUTHOR

Top

  attila <attila@stalphonsos.com>

COPYRIGHT AND LICENSE

Top


flail documentation Contained in the flail distribution.
package Flail::Exec::Cmd::forward;
use strict;
use Carp;
use Flail::Utils;
use Mail::Internet;
use base qw(Exporter);
use vars qw(@EXPORT @EXPORT_OK %EXPORT_TAGS);
@EXPORT_OK = qw(flail_forward);
@EXPORT = ();
%EXPORT_TAGS = ( 'cmd' => \@EXPORT_OK );
 
sub flail_forward {
    my $cur = get_cur_msg();
    my $as = hack_as($::OPT->{as});
    $as = $::FromAddress unless $as;
    if (!defined($cur)) {
        print "no current message to forward\n";
        return;
    }
    my $cur_hdr = $cur->head();
    my $cur_subj = $cur_hdr->get("Subject");
    chomp($cur_subj);
    my $forw_body_str = ("-" x 20) . " Forwarded message follows\n\n";
    $forw_body_str .= $cur->as_string();
    my @lines = split("\n", $forw_body_str);
    my $i = 0;
    while ($i <= $#lines) {
        $lines[$i] .= "\n";
        ++$i;
    }
    my $hdr = new Mail::Header;
    $hdr->add("From", $as);
    $hdr->add("Subject", "[Fwd: $cur_subj]");
    my $forw = new Mail::Internet(Header => $hdr, Body => \@lines);
    send_internal($cur, $forw, $as, @_);
}

1;

__END__

##
# Local variables:
# mode: perl
# tab-width: 4
# perl-indent-level: 4
# cperl-indent-level: 4
# cperl-continued-statement-offset: 4
# indent-tabs-mode: nil
# comment-column: 40
# time-stamp-line-limit: 40
# End:
##