1Mail::SpamAssassin::SQLUBsaesredCAodndtrrLiibsutt(e3d)PMearill:D:oScpuammeAnstsaatsisoinn::SQLBasedAddrList(3)
2
3
4
6 Mail::SpamAssassin::SQLBasedAddrList - SpamAssassin SQL Based Auto
7 Whitelist
8
10 my $factory = Mail::SpamAssassin::SQLBasedAddrList->new()
11 $spamtest->set_persistent_addr_list_factory ($factory);
12 ... call into SpamAssassin classes...
13
14 SpamAssassin will call:
15
16 my $addrlist = $factory->new_checker($spamtest);
17 $entry = $addrlist->get_addr_entry ($addr, $origip);
18 ...
19
21 A SQL based persistent address list implementation.
22
23 See "Mail::SpamAssassin::PersistentAddrList" for more information.
24
25 Uses DBI::DBD module access to your favorite database (tested with
26 MySQL, SQLite and PostgreSQL) to store user auto-whitelists.
27
28 The default table structure looks like this: CREATE TABLE awl (
29 username VARCHAR NOT NULL,
30 email VARCHAR NOT NULL,
31 ip VARCHAR NOT NULL,
32 count INT NOT NULL,
33 totscore FLOAT NOT NULL,
34 PRIMARY KEY (username, email, ip) )
35
36 You're table definition may change depending on which database driver
37 you choose. There is a config option to override the table name.
38
39 This module introduces several new config variables:
40
41 user_awl_dsn
42
43 user_awl_sql_username
44
45 user_awl_sql_password
46
47 user_awl_sql_table
48
49 user_awl_sql_override_username
50
51 see "Mail::SpamAssassin::Conf" for more information.
52
53 new
54
55 public class (Mail::SpamAssassin::SQLBasedAddrList) new ()
56
57 Description: This method creates a new instance of the SQLBasedAddrList
58 factory and calls the parent's (PersistentAddrList) new method.
59
60 new_checker
61
62 public instance (Mail::SpamAssassin::SQLBasedAddrList) new_checker (\%
63 $main)
64
65 Description: This method is called to setup a new checker interface and
66 return a blessed copy of itself. Here is where we setup the SQL data‐
67 base connection based on the config values.
68
69 get_addr_entry
70
71 public instance (\%) get_addr_entry (String $addr)
72
73 Description: This method takes a given $addr and splits it between the
74 email address component and the ip component and performs a lookup in
75 the database. If nothing is found in the database then a blank entry
76 hash is created and returned, otherwise an entry containing the found
77 information is returned.
78
79 A key, "exists_p", is set to 1 if an entry already exists in the data‐
80 base, otherwise it is set to 0.
81
82 add_score
83
84 public instance (\%) add_score (\% $entry, Integer $score)
85
86 Description: This method adds a given $score to a given $entry. If the
87 entry was marked as not existing in the database then an entry will be
88 inserted, otherwise a simple update will be performed.
89
90 NOTE: This code uses a self referential SQL call (ie set foo = foo + 1)
91 which is supported by most modern database backends, but not everything
92 calling itself a SQL database.
93
94 remove_entry
95
96 public instance () remove_entry (\% $entry)
97
98 Description: This method removes a given $entry from the database. If
99 the ip portion of the entry address is equal to "none" then remove any
100 perl-IP entries for this address as well.
101
102 finish
103
104 public instance () finish ()
105
106 Description: This method provides the necessary cleanup for the address
107 list.
108
109 _unpack_addr
110
111 private instance (String, String) _unpack_addr(string $addr)
112
113 Description: This method splits an autowhitelist address into it's two
114 components, email and ip address.
115
116
117
118perl v5.8.8 2008-0M1a-i0l5::SpamAssassin::SQLBasedAddrList(3)