Re: [PATCH] don't print GeoIP country if not defined

[email protected] (Matt Simerson)
Newsgroups perl.qpsmtpd
Message-ID <[email protected]>
On Apr 22, 2012, at 11:45 PM, Robert Spier <[email protected]> wrote:

> This change contains a bunch of unnecessary whitespace changes.  This can make it hard to trace back to original changes.  I'm not saying there's not a need for a whitespace cleanup, but I wonder if it would be better to do it all at once?

I agree entirely. 

If you will recall, I tried the 'do it all at once' approach a year ago. I would love to see the entire code base run through perltidy and committed.

Matt



> On Sun, Apr 22, 2012 at 2:25 PM, Matt Simerson <[email protected]> wrote:
> don't print GeoIP country if not defined (suppress warning)
> 
> If we don't get a result from the lookup, all we know is that we didn't get a result. Maybe an error, maybe the IP not in the database.
> 
> ---
> plugins/ident/geoip |   15 ++++++++-------
> 1 file changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/plugins/ident/geoip b/plugins/ident/geoip
> index 526989f..eff0fa6 100644
> --- a/plugins/ident/geoip
> +++ b/plugins/ident/geoip
> @@ -16,14 +16,15 @@ or greylist.
> use Geo::IP;
> 
> sub hook_connect {
> -  my ($self) = @_;
> +    my ($self) = @_;
> 
> -  my $geoip = Geo::IP->new(GEOIP_STANDARD);
> -  my $country =
> -    $geoip->country_code_by_addr( $self->qp->connection->remote_ip );
> +    my $geoip = Geo::IP->new(GEOIP_STANDARD);
> +    my $country =
> +        $geoip->country_code_by_addr( $self->qp->connection->remote_ip )
> +            or return (DECLINED);
> 
> -  $self->qp->connection->notes('geoip_country', $country);
> -  $self->log(LOGNOTICE, "GeoIP Country: $country");
> +    $self->qp->connection->notes('geoip_country', $country);
> +    $self->log(LOGNOTICE, "GeoIP Country: $country");
> 
> -  return DECLINED;
> +    return DECLINED;
> }
> --
> 1.7.9.6
> 
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.