Bug 7029

Summary: custom query to bayes username -> id lookup
Product: Spamassassin Reporter: Marcel Asio <spamassassin>
Component: LibrariesAssignee: SpamAssassin Developer Mailing List <dev>
Status: NEW ---    
Severity: enhancement    
Priority: P2    
Version: SVN Trunk (Latest Devel Version)   
Target Milestone: Undefined   
Hardware: All   
OS: All   
Whiteboard:
Attachments: Patch for proposed change which adds a config param.

Description Marcel Asio 2014-03-31 08:16:47 UTC
Created attachment 5195 [details]
Patch for proposed change which adds a config param.

I'm doing a setup where I'm going to put spamassassin  checks before the delivery of the mail, and at this stage the username of receiving user is not know but only the email address.

The problem with this approach is that the query spamassassin uses for looking up the id in bayes_vars expects username. So I would like to make a change to the code that adds a config option where a custom query can be defined. Code for this change is attached as a patch. 

This would allow me to use this query for lookup:
  SELECT id FROM bayes_vars WHERE username = spam_user(?)

Instead of the hardcoded one:
  SELECT id FROM bayes_vars WHERE username = ?