Changeset 726

Show
Ignore:
Timestamp:
05/13/06 04:36:18
Author:
miyagawa
Message:
  • Added $enclosure->local_path
  • Set local_path in FetchEnclosure? so that later plugins can use
  • Attach enclosures in Gmail emails! w00t!
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Enclosure.pm

    r720 r726  
    33 
    44use base qw( Class::Accessor::Fast ); 
    5 __PACKAGE__->mk_accessors(qw( url length type )); 
     5__PACKAGE__->mk_accessors(qw( url length type local_path )); 
    66 
    77sub auto_set_type { 
  • trunk/plagger/lib/Plagger/Plugin/Filter/FetchEnclosure.pm

    r721 r726  
    3939        $context->log(info => "fetch " . $enclosure->url . " to " . $path); 
    4040        $ua->mirror($enclosure->url, $path); 
     41        $enclosure->local_path($path); # set to be used in later plugins 
    4142    } 
    4243} 
  • trunk/plagger/lib/Plagger/Plugin/Publish/Gmail.pm

    r450 r726  
    6969    ); 
    7070 
     71    for my $entry ($args->{feed}->entries) { 
     72        for my $enclosure (grep $_->local_path, $entry->enclosures) { 
     73            $msg->attach( 
     74                Type => $enclosure->type, 
     75                Path => $enclosure->local_path, 
     76                Filename => $enclosure->filename, 
     77                Disposition => 'attachment', 
     78            ); 
     79        } 
     80    } 
     81 
    7182    my $route = $cfg->{mailroute} || { via => 'smtp', host => 'localhost' }; 
     83    $route->{via} ||= 'smtp'; 
     84 
    7285    if ($route->{via} eq 'smtp_tls') { 
    7386        $self->{tls_args} = [