Changeset 679

Show
Ignore:
Timestamp:
05/05/06 14:51:07
Author:
miyagawa
Message:

make Rule::URLBL work with $args->{entry} so it can be used with SmartFeed/Fresh?::Rule

Files:

Legend:

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

    r469 r679  
    99    my $self = shift; 
    1010 
    11     Plagger->context->error("plase dnbl") 
    12        unless $self->{dnsbl}; 
     11    Plagger->context->error("No dnsbl configuration") 
     12        unless $self->{dnsbl}; 
    1313} 
    1414 
     
    1616    my($self, $args) = @_; 
    1717 
    18     my $feed = $args->{feed} 
    19         or Plagger->context->error("No feed object in this plugin phase"); 
     18    my $url; 
     19    if ($args->{entry}) { 
     20        $url = $args->{entry}->permalink; 
     21    } elsif ($args->{feed}) { 
     22        $url = $args->{feed}->url; 
     23    } else { 
     24        Plagger->context->error("No feed nor entry object in this plugin phase"); 
     25    } 
    2026 
    21     my $url = $args->{feed}->url; 
     27    return unless $url; 
     28     
    2229    my $res = Net::DNS::Resolver->new; 
    2330    my $dnsbl = $self->{dnsbl}; 
     
    2936 
    3037    for my $dns (@$dnsbl) { 
    31        Plagger->context->log(debug => "looking up $domain.$dns"); 
    32        my $q = $res->search("$domain.$dns"); 
    33        if ($q && $q->answer) { 
    34            Plagger->context->log(warn => "$domain.$dns found."); 
    35            return 0; 
    36        
     38        Plagger->context->log(debug => "looking up $domain.$dns"); 
     39        my $q = $res->search("$domain.$dns"); 
     40        if ($q && $q->answer) { 
     41            Plagger->context->log(info => "$domain.$dns found."); 
     42            return 0; 
     43       
    3744    } 
    3845    return 1;