return 0;
}
-=item retreive_libravatar
+=over
- $cache_location = retreive_libravatar(location => $cache_location,
+=item retrieve_libravatar
+
+ $cache_location = retrieve_libravatar(location => $cache_location,
email => lc($param{email}),
);
=cut
-sub retreive_libravatar{
+sub retrieve_libravatar{
my %type_mapping =
(jpeg => 'jpg',
png => 'png',
return $cache_location.'.'.$dest_type;
}
+sub blocked_libravatar {
+ my ($email,$md5sum) = @_;
+ my $blocked = 0;
+ for my $blocker (@{$config{libravatar_blacklist}||[]}) {
+ for my $element ($email,$md5sum) {
+ next unless defined $element;
+ eval {
+ if ($element =~ /$blocker/) {
+ $blocked=1;
+ }
+ };
+ }
+ }
+ return $blocked;
+}
+
sub cache_location {
my %param = @_;
my $md5sum;
} else {
croak("cache_location must be called with one of md5sum or email");
}
+ return undef if blocked_libravatar($param{email},$md5sum);
for my $ext (qw(.png .jpg)) {
if (-e $config{libravatar_cache_dir}.'/'.$md5sum.$ext) {
return $config{libravatar_cache_dir}.'/'.$md5sum.$ext;
$r->finfo(APR::Finfo::stat($cache_location, APR::Const::FINFO_NORM, $r->pool));
}
+=back
+
+=cut
1;