You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by he...@apache.org on 2020/05/10 19:34:28 UTC
svn commit: r1877553 - /spamassassin/trunk/lib/Mail/SpamAssassin/GeoDB.pm
Author: hege
Date: Sun May 10 19:34:28 2020
New Revision: 1877553
URL: http://svn.apache.org/viewvc?rev=1877553&view=rev
Log:
Add get_isp_org() get_asn_org() to api
Modified:
spamassassin/trunk/lib/Mail/SpamAssassin/GeoDB.pm
Modified: spamassassin/trunk/lib/Mail/SpamAssassin/GeoDB.pm
URL: http://svn.apache.org/viewvc/spamassassin/trunk/lib/Mail/SpamAssassin/GeoDB.pm?rev=1877553&r1=1877552&r2=1877553&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/GeoDB.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/GeoDB.pm Sun May 10 19:34:28 2020
@@ -741,6 +741,18 @@ sub get_isp {
}
}
+sub get_isp_org {
+ my ($self, $ip) = @_;
+
+ return undef if !defined $ip || $ip !~ /\S/; ## no critic (ProhibitExplicitReturnUndef)
+
+ if ($self->{dbapi}->{isp}) {
+ return $self->_get('isp',$ip)->{organization};
+ } else {
+ return undef; ## no critic (ProhibitExplicitReturnUndef)
+ }
+}
+
sub get_asn {
my ($self, $ip) = @_;
@@ -753,6 +765,20 @@ sub get_asn {
} else {
return undef; ## no critic (ProhibitExplicitReturnUndef)
}
+}
+
+sub get_asn_org {
+ my ($self, $ip) = @_;
+
+ return undef if !defined $ip || $ip !~ /\S/; ## no critic (ProhibitExplicitReturnUndef)
+
+ if ($self->{dbapi}->{asn}) {
+ return $self->_get('asn',$ip)->{asn_organization};
+ } elsif ($self->{dbapi}->{isp}) {
+ return $self->_get('isp',$ip)->{asn_organization};
+ } else {
+ return undef; ## no critic (ProhibitExplicitReturnUndef)
+ }
}
sub get_all {