Changeset 1293

Show
Ignore:
Timestamp:
08/12/06 21:33:38
Author:
miyagawa
Message:

Filter::BreakEntriesToFeeds?: support Rule to handle which feeds to braek. Suggested by otsune

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Filter/BreakEntriesToFeeds.pm

    r1289 r1293  
    77    $context->register_hook( 
    88        $self, 
    9         'update.entry.fixup' => \&entry, 
    10         'update.fixup' => \&fixup, 
     9        'update.feed.fixup' => \&break, 
    1110    ); 
    1211} 
    1312 
    14 sub entry
     13sub break
    1514    my($self, $context, $args) = @_; 
    1615 
    17     my $feed = $args->{feed}->clone; 
    18     $feed->clear_entries; 
    19     $feed->add_entry($args->{entry}); 
    20     $feed->title($args->{entry}->title) 
    21         if $self->conf->{use_entry_title}; 
     16    for my $entry ($args->{feed}->entries) { 
     17        my $feed = $args->{feed}->clone; 
     18        $feed->clear_entries; 
     19        $feed->add_entry($entry); 
     20        $feed->title($entry->title) 
     21            if $self->conf->{use_entry_title}; 
     22        $context->update->add($feed); 
     23    } 
    2224 
    23     push @{$self->{feeds}}, $feed; 
    24 
    25  
    26 sub fixup { 
    27     my($self, $context, $args) = @_; 
    28  
    29     $context->update->{feeds} = $self->{feeds} 
    30         if $self->{feeds}; 
     25    $context->update->delete_feed($args->{feed}); 
    3126} 
    3227 
  • trunk/plagger/lib/Plagger/Update.pm

    r444 r1293  
    3131} 
    3232 
     33sub count { 
     34    my $self = shift; 
     35    scalar @{ $self->{feeds} }; 
     36} 
     37 
    3338sub feeds_by_tag { 
    3439    my($self, $tag) = @_;