> sorry I didn't read your question thoroughly
>
> /etc/mail/spamassassin/local.cf will be the defaults
>
> but I see you wanted to preload the database with entries if none exists
>
> Here's an possible idea in ConfSourceSQL.pm
>
>   my @row;
>       my $text;
>       my $sql;
>       $sql =
>          "select preference, value  from userpref where username = "
>          $dbh->quote($username)";
>          my $rv = $sth->execute();
>          if($rv) = $sth->execute();
>          if ($rv) {
>             $text = '';
>             #setup defaults to plugin if no entries exist for user
>             #or maybe read this from local.cf
>             my $defaults={
>                         'required_hits' => '5.0',
>                         'whitelist_from' => 'domain.com',
>                         etc..
>                         et...
>                         };
>             my $default_preference;
>             if(!(@row = $sth->fetchrow_arry())){
>                 #insert each preference for user
>                 foreach $default_preference (keys %$defaults){
>                         $sql = "insert into userpref;
>
values('$dbh->quote($username)','$default_preferencere','$$defaults{$default
_key}','')";
>                         $dbh->prepare($sql);
>                         $sth->execute();
>                         $sth->finish();
>                 }
>             }
>           }
> #...continue on normally
>       my $sql =
>          "select preference, value  from userpref where username = " .
>          $dbh->quote($username) ." OR username = 'GLOBAL'";
>       my $sth = $dbh->prepare($sql);
>       if($sth) {
>
> On Thu, 20 Jun 2002, Christopher Davis wrote:
>
> > Hi -- is there a way to set the default MySQL settings for a user?
(Much
> > like user_prefs.template)  For example, when a new account is created
and
> > spamd looks in MySQL for the address and it doesn't exist, it would
create a
> > fisrt-time default score my choosing.
> > Thanks,
> > --chris
> >

Thanks for the help!  Specifically, would I just add this to the file?  I
found a copy at:
/usr/lib/perl5/site_perl/5.6.0/Mail/SpamAssassin/ConfSourceSQL.pm
Do I need to recompile SA after modifing this file?
I put the new code you sent after
   if($dbh) {
I set the default value to 9.0 for testing.  It didn't seem to work.  Any
ideas?
Thanks!
--chris davis



-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/
_______________________________________________
Spamassassin-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/spamassassin-talk

Reply via email to