[ingo] SpamAssassin Black/White list preferences

William R Thomas corvar at zipple.com
Mon Feb 21 12:44:49 PST 2005


--rS8CxjVDS/+yyDmU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

I wanted to have Ingo's blacklist/whitelist functionality also update
the SpamAssassin black/whitelist configuration.  I had it fairly easy
because everything is using the full email address as the login, and I
had already configured SpamAssassin to use MySQL for user preferences.

Attached is a diff from the ingo/lib/Storage/prefs.php file which
includes the above functionality.  It is sort of rough, and I doubt it
would be wanted for general inclusion, but I figured I would share in
case anyone else could use it.

-- 
        William R. Thomas
        Corvar                               corvar at theonering.net
        Co-Webmaster                         http://www.theonering.net/
*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*
Congress shall make no law respecting an establishment of religion, or
prohibiting the free exercise thereof; or abridging the freedom if
speech, or of the press, or the right of the people peaceably to
assemble, and to petition the Government for a redress of grievances.
			-- Amendment I Bill of Rights
X-Stamper-To: corvar at theonering.net

--rS8CxjVDS/+yyDmU
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="intprefs.diff"

15c15
< class Ingo_Storage_intprefs extends Ingo_Storage {
---
> class Ingo_Storage_prefs extends Ingo_Storage {
24c24
<     function Ingo_Storage_intprefs($params = array())
---
>     function Ingo_Storage_prefs($params = array())
99,105c99
<         global $prefs,$conf;
< 
<         $SAdbUserName = $conf['sql']['username'];
<         $SAdbPassword = $conf['sql']['password'];
<         $SAdbName = "spamassassin";
<         $SAconnect = mysql_connect("localhost",$SAdbUserName,$SAdbPassword) or die("Cannot connect to db");
< 	mysql_select_db($SAdbName, $SAconnect) or die("Cannot select DB");
---
>         global $prefs;
112,117d105
<             $sql = sprintf("delete from userpref where username='%s' && preference ='blacklist_from';", Auth::getAuth());
<             $result = mysql_query($sql,$SAconnect) or die("cannot query $sql\n");
< 	    foreach ($ob->getBlacklist() as $address) {
< 		$sql = sprintf("insert into userpref (username,preference,value) VALUES('%s','blacklist_from','$address');",Auth::getAuth());
<                 $result = mysql_query($sql,$SAconnect) or die("cannot query $sql\n");
<             }
145,150d132
<             $sql = sprintf("delete from userpref where username='%s' && preference ='whitelist_from';", Auth::getAuth());
<             $result = mysql_query($sql,$SAconnect) or die("cannot query $sql\n");
< 	    foreach ($ob->getWhitelist() as $address) {
< 		$sql = sprintf("insert into userpref (username,preference,value) VALUES('%s','whitelist_from','$address');",Auth::getAuth());
<                 $result = mysql_query($sql,$SAconnect) or die("cannot query $sql\n");
<             }
157c139
<         mysql_close($SAconnect);
---
> 

--rS8CxjVDS/+yyDmU--


More information about the ingo mailing list