| 1 |
|
| package VUser::SpamAssassin; |
| 2 |
|
| use warnings; |
| 3 |
|
| use strict; |
| 4 |
|
| |
| 5 |
|
| # Copyright 2004 Randy Smith |
| 6 |
|
| # $Id: SpamAssassin.pm,v 1.6 2007/04/12 17:23:30 perlstalker Exp $ |
| 7 |
|
| |
| 8 |
|
| use vars qw(@ISA); |
| 9 |
|
| |
| 10 |
|
| our $REVISION = (split (' ', '$Revision: 1.6 $'))[1]; |
| 11 |
|
| our $VERSION = "0.3.0"; |
| 12 |
|
| |
| 13 |
|
| use VUser::Meta; |
| 14 |
|
| use VUser::ResultSet; |
| 15 |
|
| use VUser::Extension; |
| 16 |
|
| push @ISA, 'VUser::Extension'; |
| 17 |
|
| |
| 18 |
|
| my %dbs = ('scores' => undef, |
| 19 |
|
| 'awl' => undef, |
| 20 |
|
| 'bayes' => undef); |
| 21 |
|
| |
| 22 |
|
| my %meta = ('username' => VUser::Meta->new(name => 'username', |
| 23 |
|
| type => 'string', |
| 24 |
|
| description => 'User name'), |
| 25 |
|
| 'option' => VUser::Meta->new (name => 'option', |
| 26 |
|
| type => 'string', |
| 27 |
|
| description => 'SA option'), |
| 28 |
|
| 'value' => VUser::Meta->new (name => 'value', |
| 29 |
|
| type => 'string', |
| 30 |
|
| description => 'Value for option') |
| 31 |
|
| ); |
| 32 |
|
| |
| 33 |
|
| my $c_sec = 'Extension SpamAssassin'; |
| 34 |
|
| |
| 35 |
|
| sub c_sec { return $c_sec; } |
| 36 |
|
| sub meta { return %meta; } |
| 37 |
|
| |
| 38 |
|
| sub init |
| 39 |
|
| { |
| 40 |
|
| my $eh = shift; |
| 41 |
|
| my %cfg = @_; |
| 42 |
|
| |
| 43 |
|
| # SA |
| 44 |
|
| $eh->register_keyword('sa', 'Manage SpamAssassin settings'); |
| 45 |
|
| |
| 46 |
|
| # SA-delall: Delete all options for a user. |
| 47 |
|
| $eh->register_action('sa', 'delall'); |
| 48 |
|
| $eh->register_option('sa', 'delall', $meta{'username'}, 1); |
| 49 |
|
| |
| 50 |
|
| # SA-add: add an option for a user. |
| 51 |
|
| $eh->register_action('sa', 'add'); |
| 52 |
|
| $eh->register_option('sa', 'add', $meta{'username'}, 1); |
| 53 |
|
| $eh->register_option('sa', 'add', $meta{'option'}, 1); |
| 54 |
|
| $eh->register_option('sa', 'add', $meta{'value'}, 1); |
| 55 |
|
| |
| 56 |
|
| # SA-mod: modify a user's options |
| 57 |
|
| $eh->register_action('sa', 'mod'); |
| 58 |
|
| $eh->register_option('sa', 'mod', $meta{'username'}, 1); |
| 59 |
|
| $eh->register_option('sa', 'mod', $meta{'option'}, 1); |
| 60 |
|
| $eh->register_option('sa', 'mod', $meta{'value'}); |
| 61 |
|
| $eh->register_option('sa', 'mod', |
| 62 |
|
| VUser::Meta->new(name => 'delete', |
| 63 |
|
| type => 'boolean', |
| 64 |
|
| description => 'Delete the option') |
| 65 |
|
| ); |
| 66 |
|
| |
| 67 |
|
| # SA-mod: delete an option for a user. |
| 68 |
|
| $eh->register_action('sa', 'del'); |
| 69 |
|
| $eh->register_option('sa', 'del', $meta{'username'}, 1); |
| 70 |
|
| $eh->register_option('sa', 'del', $meta{'option'}, 1); |
| 71 |
|
| |
| 72 |
|
| # SA-show: Show user settings |
| 73 |
|
| $eh->register_action('sa', 'show'); |
| 74 |
|
| $eh->register_option('sa', 'show', $meta{'username'}); |
| 75 |
|
| $eh->register_option('sa', 'show', $meta{'option'}); |
| 76 |
|
| |
| 77 |
|
| # Email |
| 78 |
|
| $eh->register_keyword('email'); |
| 79 |
|
| |
| 80 |
|
| # Email-del: When an email is deleted, we need to remove all their |
| 81 |
|
| # settings as well. |
| 82 |
|
| $eh->register_action('email', 'del'); |
| 83 |
|
| } |
| 84 |
|
| |
| 85 |
|
| sub unload {}; |
| 86 |
|
| |
| 87 |
|
| 1; |
| 88 |
|
| |
| 89 |
|
| __END__ |