Changeset 1731

Show
Ignore:
Timestamp:
10/10/06 22:17:42
Author:
miyagawa
Message:

Notify::UpdatePing?: support weblogUpdates.extendedPing. Fixes #419

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/lib/Plagger/Plugin/Notify/UpdatePing.pm

    r1696 r1731  
    2222 
    2323    my @args = (XMLRPC::Data->type(string => $feed->title), $feed->link); 
     24    my $method; 
     25    if ($self->conf->{extended_ping}) { 
     26        $method = 'weblogUpdates.extendedPing'; 
     27        push @args, $feed->count ? $feed->entries->[0]->permalink : $feed->link; 
     28        push @args, $feed->url; 
     29        push @args, join("|", map XMLRPC::Data->type(string => $_), @{ $feed->tags }) 
     30            if @{ $feed->tags }; 
     31    } else { 
     32        $method = 'weblogUpdates.ping'; 
     33    } 
    2434 
    2535    for my $url (@$urls) { 
    2636        $context->log(info => "Ping " . $feed->link . " to $url"); 
    27         eval { 
    28             XMLRPC::Lite->new->proxy($url)->call('weblogUpdates.ping', @args)
     37        my $res = eval { 
     38            XMLRPC::Lite->new->proxy($url)->call($method, @args)->result
    2939        }; 
    30         if ($@) { 
    31             $context->log(error => "Error sending UpdatePing: $@"); 
     40        if (my $err = $@ || $res->{flerror}) { 
     41            $context->log(error => "Error sending UpdatePing: $err"); 
    3242        } 
    3343    } 
     
    5262This plugin notifies feed updates to update ping servers using XML-RPC. 
    5363 
     64=head1 CONFIG 
     65 
     66=over 4 
     67 
     68=item extended_ping 
     69 
     70  extended_ping: 1 
     71 
     72Whether to use I<weblogUpdates.extendedPing> method for extra 
     73information. Defaults to 0. 
     74 
     75=back 
     76 
    5477=head1 AUTHOR 
    5578