From cf09a662adcfdcaacd8c9ab762e3329207f76b14 Mon Sep 17 00:00:00 2001
From: Jared Johnson <jjohnson@efolder.net>
Date: Thu, 13 Nov 2014 16:29:52 -0600
Subject: [PATCH] New convention for calling Qpsmtpd::Base stuff

I think
---
 lib/Qpsmtpd/Transaction.pm | 1 -
 plugins/fcrdns             | 2 +-
 plugins/greylisting        | 2 +-
 plugins/helo               | 9 ++++-----
 plugins/ident/geoip        | 2 +-
 5 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/lib/Qpsmtpd/Transaction.pm b/lib/Qpsmtpd/Transaction.pm
index 4a5b0a0..b880329 100644
--- a/lib/Qpsmtpd/Transaction.pm
+++ b/lib/Qpsmtpd/Transaction.pm
@@ -4,7 +4,6 @@ use Qpsmtpd;
 use strict;
 use warnings;
 
-use Qpsmtpd::Base;
 use Qpsmtpd::Constants;
 
 use IO::File qw(O_RDWR O_CREAT);
diff --git a/plugins/fcrdns b/plugins/fcrdns
index a993dea..18df058 100644
--- a/plugins/fcrdns
+++ b/plugins/fcrdns
@@ -164,7 +164,7 @@ sub connect_handler {
 sub is_valid_localhost {
     my ($self) = @_;
 
-    if (Qpsmtpd::Base->is_localhost($self->qp->connection->remote_ip)) {
+    if ($self->is_localhost($self->qp->connection->remote_ip)) {
         $self->adjust_karma(1);
         $self->log(LOGDEBUG, "pass, is localhost");
         return 1;
diff --git a/plugins/greylisting b/plugins/greylisting
index c6fae6e..b753a62 100644
--- a/plugins/greylisting
+++ b/plugins/greylisting
@@ -255,7 +255,7 @@ sub exclude_host {
     if ( $pattern =~ /^\/(.*)\/$/ ) {
         push @{ $self->{_exclude_re} }, qr/$1/;
     }
-    elsif ( Qpsmtpd::Base->is_valid_ip($pattern) ) {
+    elsif ( $self->is_valid_ip($pattern) ) {
         $self->{_exclude_ip}{$pattern} = 1;
     }
     else {
diff --git a/plugins/helo b/plugins/helo
index 7c354f8..c444adc 100644
--- a/plugins/helo
+++ b/plugins/helo
@@ -229,7 +229,6 @@ use warnings;
 
 use Net::IP;
 
-use Qpsmtpd::Base;
 use Qpsmtpd::Constants;
 
 sub register {
@@ -342,7 +341,7 @@ sub is_regex_match {
 
 sub invalid_localhost {
     my ($self, $host) = @_;
-    if (Qpsmtpd::Base->is_localhost($self->qp->connection->remote_ip)) {
+    if ($self->is_localhost($self->qp->connection->remote_ip)) {
         $self->log(LOGDEBUG, "pass, is localhost");
         return;
     }
@@ -357,7 +356,7 @@ sub invalid_localhost {
 
 sub is_plain_ip {
     my ($self, $host) = @_;
-    return if !Qpsmtpd::Base->is_valid_ip($host);
+    return if ! $self->is_valid_ip($host);
 
     $self->log(LOGDEBUG, "fail, plain IP");
     return "Plain IP is invalid HELO hostname (RFC 2821)", "plain IP";
@@ -369,7 +368,7 @@ sub is_address_literal {
     my ($ip) = $host =~ /^\[(.*)\]/;  # strip off any brackets
     return if !$ip;   # no brackets, not a literal
 
-    return if !Qpsmtpd::Base->is_valid_ip($ip);
+    return if ! $self->is_valid_ip($ip);
 
     $self->log(LOGDEBUG, "fail, bracketed IP");
     return "RFC 2821 allows an address literal, but we do not","bracketed IP";
@@ -377,7 +376,7 @@ sub is_address_literal {
 
 sub is_forged_literal {
     my ($self, $host) = @_;
-    return if !Qpsmtpd::Base->is_valid_ip($host);
+    return if ! $self->is_valid_ip($host);
 
   # should we add exceptions for reserved internal IP space? (192.168,10., etc)
     $host = substr $host, 1, -1;
diff --git a/plugins/ident/geoip b/plugins/ident/geoip
index c1c30c9..53e48e8 100644
--- a/plugins/ident/geoip
+++ b/plugins/ident/geoip
@@ -404,7 +404,7 @@ sub set_asn {
     my ($self, $ip) = @_;
     $ip ||= $self->qp->connection->remote_ip;
 
-    if (Qpsmtpd::Base->is_ipv6($ip)) {
+    if ($self->is_ipv6($ip)) {
         return $self->set_asn_ipv6($ip);
     }
     return if ! $self->{GeoIPASNum};