|
Revision 856
(checked in by miyagawa, 4 years ago)
|
merge from trunk to plagger-server for Enclosures support and such. Sorry for the big commit
|
| Line | |
|---|
| 1 |
package Plagger::Plugin::Filter::BreakEntriesToFeeds; |
|---|
| 2 |
use strict; |
|---|
| 3 |
use base qw( Plagger::Plugin ); |
|---|
| 4 |
|
|---|
| 5 |
sub register { |
|---|
| 6 |
my($self, $context) = @_; |
|---|
| 7 |
$context->register_hook( |
|---|
| 8 |
$self, |
|---|
| 9 |
'update.entry.fixup' => \&entry, |
|---|
| 10 |
'update.fixup' => \&fixup, |
|---|
| 11 |
); |
|---|
| 12 |
} |
|---|
| 13 |
|
|---|
| 14 |
sub entry { |
|---|
| 15 |
my($self, $context, $args) = @_; |
|---|
| 16 |
|
|---|
| 17 |
my $feed = $args->{feed}->clone; |
|---|
| 18 |
$feed->clear_entries; |
|---|
| 19 |
$feed->add_entry($args->{entry}); |
|---|
| 20 |
|
|---|
| 21 |
push @{$self->{feeds}}, $feed; |
|---|
| 22 |
} |
|---|
| 23 |
|
|---|
| 24 |
sub fixup { |
|---|
| 25 |
my($self, $context, $args) = @_; |
|---|
| 26 |
|
|---|
| 27 |
$context->update->{feeds} = $self->{feeds} |
|---|
| 28 |
if $self->{feeds}; |
|---|
| 29 |
} |
|---|
| 30 |
|
|---|
| 31 |
1; |
|---|
| 32 |
|
|---|
| 33 |
__END__ |
|---|
| 34 |
|
|---|
| 35 |
=head1 NAME |
|---|
| 36 |
|
|---|
| 37 |
Plagger::Plugin::Filter::BreakEntriesToFeeds - 1 entry = 1 feed |
|---|
| 38 |
|
|---|
| 39 |
=head1 SYNOPSIS |
|---|
| 40 |
|
|---|
| 41 |
- module: Filter::BreakEntriesToFeeds |
|---|
| 42 |
|
|---|
| 43 |
=head1 DESCRIPTION |
|---|
| 44 |
|
|---|
| 45 |
This plugin breaks all the updated entries into a single feed. This is |
|---|
| 46 |
a bit hackish plugin but allows things like sending a single mail |
|---|
| 47 |
containing single entry, rather than a feed containing multiple |
|---|
| 48 |
entries, with Publish::Gmail plugin. |
|---|
| 49 |
|
|---|
| 50 |
=head1 AUTHOR |
|---|
| 51 |
|
|---|
| 52 |
Tatsuhiko Miyagawa |
|---|
| 53 |
|
|---|
| 54 |
=head1 SEE ALSO |
|---|
| 55 |
|
|---|
| 56 |
L<Plagger> |
|---|
| 57 |
|
|---|
| 58 |
=cut |
|---|