Permalink
Browse files

domainkeys: only register hooks if Mail::DomainKeys is loadable

  • Loading branch information...
1 parent efbaf2e commit 41550c26814670afd44ee714e9bbdecf4b81a46e @msimerson msimerson committed May 21, 2012
Showing with 16 additions and 1 deletion.
  1. +16 −1 plugins/domainkeys
View
@@ -68,7 +68,22 @@ sub init {
};
}
-sub hook_data_post {
+sub register {
+ my $self = shift;
+
+ for my $m ( qw/ Mail::DomainKeys::Message Mail::DomainKeys::Policy / ) {
+ eval "use $m";
+ if ( $@ ) {
+ warn "skip: plugin disabled, could not load $m\n";
+ $self->log(LOGERROR, "skip: plugin disabled, is $m installed?");
+ return;
+ };
+ };
+
+ $self->register_hook('data_post', 'data_post_handler');
+};
+
+sub data_post_handler {
my ($self, $transaction) = @_;
if ( ! $transaction->header->get('DomainKey-Signature') ) {

0 comments on commit 41550c2

Please sign in to comment.