Changeset 1232

Show
Ignore:
Timestamp:
08/08/06 12:51:31
Author:
miyagawa
Message:

move Notify::IRC to publish.entry phase

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/assets/plugins/Notify-IRC/irc_notify.tt

    r1043 r1232  
    11[%- SET title = feed.title || '(no-title)' -%] 
    2 [% FOREACH entry = feed.entries -%][% feed.title_text %]: [% entry.title_text %] - [% entry.link %][% IF entry.author %] by [% entry.author %][% END %] 
    3 [% END -%] 
     2[% feed.title_text %]: [% entry.title_text %] - [% entry.link %][% IF entry.author %] by [% entry.author %][% END %] 
  • trunk/plagger/lib/Plagger/Plugin/Notify/IRC.pm

    r1173 r1232  
    1010    $context->register_hook( 
    1111        $self, 
    12         'publish.feed' => \&update, 
     12        'publish.entry' => \&update, 
     13        'plugin.init'   => \&initialize, 
    1314    ); 
    1415} 
    1516 
    16 sub update { 
     17sub initialize { 
    1718    my($self, $context, $args) = @_; 
    1819 
     
    2021    my $port = $self->conf->{daemon_port} || 9999; 
    2122 
    22     my $remote = POE::Component::IKC::ClientLite::create_ikc_client( 
     23    $self->{remote} = POE::Component::IKC::ClientLite::create_ikc_client( 
    2324        port    => $port, 
    2425        ip      => $host, 
     
    2728    ); 
    2829 
    29     unless ($remote) { 
     30    unless ($self->{remote}) { 
    3031        my $msg = q{unable to connect to plagger-ircbot process on }  
    3132            . "$host:$port" 
     
    3637        return; 
    3738    } 
     39} 
    3840 
    39     $context->log(info => "Notifying " . $args->{feed}->title . " to IRC"); 
     41sub update { 
     42    my($self, $context, $args) = @_; 
    4043 
    41     my $body = $self->templatize('irc_notify.tt', { feed => $args->{feed} }); 
     44    $context->log(info => "Notifying " . $args->{entry}->title . " to IRC"); 
     45 
     46    my $body = $self->templatize('irc_notify.tt', $args); 
    4247    Encode::_utf8_off($body) if Encode::is_utf8($body); 
    4348    Encode::from_to($body, 'utf-8', $self->conf->{charset})