Bug 1931 - Changes to Configuration and Functionality
Summary: Changes to Configuration and Functionality
Status: RESOLVED FIXED
Alias: None
Product: Spamassassin
Classification: Unclassified
Component: Libraries (show other bugs)
Version: 2.54
Hardware: All Windows 98
: P5 normal
Target Milestone: Undefined
Assignee: SpamAssassin Developer Mailing List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-19 16:52 UTC by John Stevens
Modified: 2004-11-30 11:39 UTC (History)
0 users



Attachment Type Modified Status Actions Submitter/CLA Status
diff -u of my current Conf.pm text/plain None John Stevens [NoCLA]
diff -u of my current PerMsgStatus.pm patch None John Stevens [NoCLA]

Note You need to log in before you can comment on or make changes to this bug.
Description John Stevens 2003-05-19 16:52:02 UTC
I have found that with a minor modification to the Conf.pm module, I can enter 
a JOIN statement rather than a single table name in the user_scores_sql_table 
parameter.  This allows me to user a userpref table for preferences, and an 
aliases table for all user aliases, saving me repeating all settings for each 
alias in the userpref table.  This simplifies the code for a web based user 
preference configuration interface that fetches user aliases from a Windoze 
based domain.

I have also modified the PerMsgStatus.pm and Conf.pm to allow for an option 
subject_tag_append that appends the subject tag rather than prepends it.

The first one I am most interested in becomming standard issue in SA.  The 
second one is nice and would save me some work when upgrading, but is not as 
important.

Thanks
Comment 1 John Stevens 2003-05-19 16:53:14 UTC
Created attachment 979 [details]
diff -u of my current Conf.pm
Comment 2 John Stevens 2003-05-19 16:53:59 UTC
Created attachment 980 [details]
diff -u of my current PerMsgStatus.pm
Comment 3 Justin Mason 2004-03-16 21:51:48 UTC
Michael -- any chance you could comment on the first patch?  it sounds useful
(although possibly better done in a cleaner way).
Comment 4 Michael Parker 2004-03-16 22:13:16 UTC
Subject: Re:  Changes to Configuration and Functionality

On Tue, Mar 16, 2004 at 09:51:49PM -0800, bugzilla-daemon@bugzilla.spamassassin.org wrote:
> 
> ------- Additional Comments From jm@jmason.org  2004-03-16 21:51 -------
> Michael -- any chance you could comment on the first patch?  it sounds useful
> (although possibly better done in a cleaner way).
> 

The new custom SQL code should handle whatever you want to do, and if
not we'll fix it so that it does.

No need for the patch in my opinion.

Michael

Comment 5 John Stevens 2004-03-17 00:47:35 UTC
Sorry guys, but how much cleaner do you want this?  It means no additional SQl 
parameters, just a different way of reading them in from the local.cf (or any 
other).  Having not been privy to the "new custom SQL code" I doubt that it 
could get any easier than this.  But I am willing to be wrong.  Probably makes 
everything you can do with the new SQl code possible with a single line in the 
local.cf as well.

The second patch is merely for a pedantic Company owner and is probably of no 
use to anyone.  I don't care if it never sees the light of day.
Comment 6 Michael Parker 2004-03-17 08:05:42 UTC
Subject: Re:  Changes to Configuration and Functionality

On Wed, Mar 17, 2004 at 12:47:36AM -0800, bugzilla-daemon@bugzilla.spamassassin.org wrote:
> 
> ------- Additional Comments From jstevens@tusc.com.au  2004-03-17 00:47 -------
> Sorry guys, but how much cleaner do you want this?  It means no additional SQl 
> parameters, just a different way of reading them in from the local.cf (or any 
> other).  Having not been privy to the "new custom SQL code" I doubt that it 
> could get any easier than this.  But I am willing to be wrong.  Probably makes 
> everything you can do with the new SQl code possible with a single line in the 
> local.cf as well.

We no longer have code in Conf.pm that supports setting the table and
column names for the user prefs SQL config.  You can do so via the
user_scores_sql_custom_query config.  Here is the documentation
snippet for that feature, I think you will find it flexible and useful
enough for what you are trying to achieve:

=item user_scores_sql_custom_query query

This option gives you the ability to create a custom SQL query to
retrieve user scores and preferences.  In order to work correctly your
query should return two values, the preference name and value, in that
order.  In addition, there are several "variables" that you can use
as part of your query, these variables will be substituted for the
current values right before the query is run.  The current allowed
variables are:

=over 4

=item _TABLE_

The name of the table where user scores and preferences are stored, default
is userpref.

=item _USERNAME_

The current user's username.

=item _MAILBOX_

The portion before the @ as derived from the current user's username.

=item _DOMAIN_

The portion after the @ as derived from the current user's username, this
value may be null.

=back

The query must be one one continuous line in order to parse correctly.

Here are several example queries, please note that these are broken up
for easy reading, in your config it should be one continuous line.

=item Current default query:

SELECT preference, value FROM _TABLE_ WHERE username = _USERNAME_ OR username =
'@GLOBAL' ORDER BY username ASC

=item Use global and then domain level defaults:

SELECT preference, value FROM _TABLE_ WHERE username = _USERNAME_ OR username =
'@GLOBAL' OR username = '@~'||_DOMAIN_ ORDER BY username ASC

=item Maybe global prefs should override user prefs:

SELECT preference, value FROM _TABLE_ WHERE username = _USERNAME_ OR username =
'@GLOBAL' ORDER BY username DESC

=cut


You can then fairly easily write the optimal query for however you
have your preference data stored in the database.

Michael

Comment 7 John Stevens 2004-03-17 15:26:56 UTC
Thanks.  But it seems like an awful lot of trouble to go to, when all that was 
needed was the ability to read to the endo of the line so a select query could 
be entered as the table_name.  But in any case, this is more than what I 
require.  From which version of SA does this apply?  I have not upgraded since 
2.54, which is working fine.
Comment 8 Michael Parker 2004-03-17 15:46:17 UTC
Subject: Re:  Changes to Configuration and Functionality

On Wed, Mar 17, 2004 at 03:26:57PM -0800, bugzilla-daemon@bugzilla.spamassassin.org wrote:
> http://bugzilla.spamassassin.org/show_bug.cgi?id=1931
> 
> 
> 
> 
> 
> ------- Additional Comments From jstevens@tusc.com.au  2004-03-17 15:26 -------
> Thanks.  But it seems like an awful lot of trouble to go to, when all that was 
> needed was the ability to read to the endo of the line so a select query could 
> be entered as the table_name.

It was exactly this kluge that lead to the custom sql solution.  What
you see as overkill we see as the ability to support an infinite
number of variations on the same thing.

> But in any case, this is more than what I 
> require.  From which version of SA does this apply?  I have not upgraded since 
> 2.54, which is working fine.
> 

3.0.0

Michael

Comment 9 Duncan Findlay 2004-11-30 20:39:46 UTC
As per Michael, fixed in 3.0.0