Author Topic: SpamAssassin MySQL Plugin  (Read 98831 times)

Offline magik_cypress

  • Newbie
  • *
  • Posts: 1
SpamAssassin MySQL Plugin
« on: May 29, 2009, 08:41:46 AM »
Hello,

program/localization/fr_FR/labels.inc

Code: [Select]
$labels['sauserprefs']  = 'Spam';
$labels['sauserprefssettings']  = 'Configuration des Spams';
$labels['spamgeneralsettings']  = 'Configuration principale';
$labels['spamthres']  = 'Seuil du score';
$labels['spamsubject']  = 'Tag sur le sujet';
$labels['spamsubjectblank']  = '(Laisser vide le champ)';
$labels['spamlang']  = 'Langue du message';
$labels['enabled']  = 'Activer';
$labels['disabled']  = 'Desactiver';
$labels['headers'] = "Entete du message";
$labels['foldheaders'] = "Autoriser plusieurs lignes dans les en-tetes";
$labels['spamlevelstars'] = "Utiliser 'Niveau de Spam' dans les en-tetes";
$labels['spamlevelchar'] = "Caractere du niveau de spam";
$labels['spamtests'] = "Service de spam externe";
$labels['userazor1'] = "Utiliser Razor v1";
$labels['userazor2'] = "Utiliser Razor v2";
$labels['usepyzor'] = "Utiliser Pyzor";
$labels['usebayes'] = "Utiliser naive Bayesian style classifier";
$labels['usedcc'] = "Utiliser DCC";
$labels['skiprblchecks'] = "Utiliser Realtime Blackhole List";
$labels['spamreportsettings']  = 'Rapport de configuration';
$labels['spamreport0']  = 'Inclure le rapport dans l\'en-tete du message original';
$labels['spamreport1']  = 'Inclure MIME Attachment dans l\'en-tete du message original';
$labels['spamreport2']  = 'Inclure le texte original dans le rapport';
$labels['spamaddressrules']  = 'Regels des adresses';
$labels['whitelist_from']  = 'Accepter les messages de';
$labels['blacklist_from']  = 'Rejeter les messages de';
$labels['whitelist_to']  = 'Accepter les messages envoye a';
$labels['addrule']  = 'Ajouter une regle';
$labels['rule']  = 'Regle';

program/localization/fr_FR/messages.inc

Code: [Select]
$messages['sauserprefchanged'] = 'Succes : modification de la configuration des spams';
$messages['sauserpreffailed'] = 'Erreur: aucun changement de la configuration des spams';
$messages['spamthresexp'] = 'Tout au-dessus du seuil est marque comme spam. L\'augmentation de ce seuil va augmenter la quantite de spam manquer, mais reduire le risque de faux positifs.';
$messages['spamlangexp'] = 'Selectionnez toutes les langues, tous les messages reçus qui sont ecrits dans des langues sélectionnees seront traites comme spam possible.';
$messages['headersexp'] = "Les en-tetes des messages produit par SpamAssassin fournissent des informations sur les resultats. Utilisez les options ci-dessous pour configurer ces en-tetes.";
$messages['spamtestssexp'] = "Certains controles de l\'utilisation des services bases sur Internet peuvent aider a identifier le spam. Selectionnez ceux que vous souhaitez utiliser:";
$messages['spamreport']  = 'Quand un message est identifie comme spam, un rapport de tous les essais et les évaluations attribuées est cree ...';
$messages['autowhitelist'] = 'Les adresses e-mail dans votre carnet d\'adresses sont automatiquement ajoutees a la liste \'accepter le courrier provenant de\'.';
$messages['whitelistexp'] = 'Un asterisque (*) peut être utilise comme un joker pour une plus grande flexibilite. Par exemple: *@example.com or *@*.example.com.';
$messages['spamaddressexists'] = 'Une regle qui existe deja pour cette adresse';
$messages['spamenteraddress'] = 'S\'il vous plait entrer une adresse a ajouter';
$messages['spamaddresserror'] = 'Erreur: L\'adresse semble invalide';
$messages['spamaddressdelete'] = 'Etes vous sur de vouloir supprimer cette regle?';
$messages['noaddressrules'] = 'Pas de regle pour cette d\'adresse trouvee.';

++
Cyp

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
SpamAssassin MySQL Plugin
« Reply #1 on: May 30, 2009, 05:03:47 AM »
Great thanks, I'll add it in the next version.

UPDATE: The new version is now available on the website.
« Last Edit: May 30, 2009, 07:59:39 AM by JohnDoh »
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline mike113

  • Newbie
  • *
  • Posts: 1
Error loading Template sauserprefs
« Reply #2 on: June 04, 2009, 11:26:36 PM »
I'm getting this error when clicking the spam tab I haven't been able to figure out what is failing.
Code: [Select]

[04-Jun-2009 23:11:33 -0400] PHP Error: Error loading template for sauserprefs.sauserprefs in /usr/share/rc.beta.05.09/program/include/rcube_template.php on line 342 (GET /beta3/?_task=settings&_action=plugin.sauserprefs)


any ideas where the error is?

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
SpamAssassin MySQL Plugin
« Reply #3 on: June 05, 2009, 03:02:17 AM »
I think you downloaded the latest developemnt version of the plugin, but you are actually using RC version 0.3b, not trunk. Is that correct? Please download the 0.3b version of the plugin and the error will vanish.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
SpamAssassin MySQL Plugin
« Reply #4 on: August 16, 2008, 11:44:16 AM »
Hi,

I have created a small plugin to integrate management of SpamAssassin preferences into RC. The preferences must be stored in a MySQL database (it will probably work with any database supported by RC but MySQL is what I use).

At the moment there are 2 versions of the patch, one for 0.3b and one for SVN trunk. If you are using Roundcube version 0.3b the development version of this plugin will not work for you, you must use the 0.3b version.

For more information or to download the plugin please visit RoundCube Patches & Plugins
« Last Edit: June 09, 2009, 01:28:49 PM by JohnDoh »
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline patricktech

  • Newbie
  • *
  • Posts: 6
Using this plugin with other skins
« Reply #5 on: June 09, 2009, 02:49:13 PM »
i have another skin installed, mvision, and I cannot get the new tab to show up with this plugin?

Also, I had a previous user setting in the database, and this plugin did not detech or pickup my previous threshold levels?

Thanks, Patrick

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
SpamAssassin MySQL Plugin
« Reply #6 on: June 10, 2009, 02:54:03 AM »
I haven't tried the mvision skin in a while so I cant tell exactly what the problem is but from what I remember I think that it is missing the JS call required to let plugins add tabs, quite a few things have changed in the skin to allow plugins to do their thing. Until the offical guide to making skins comes out I can only work with the default skin.

Its odd that your previous settings were not picked up but without a little more digging I cannot say whats wrong. There is a function in sauserprefs.php called _load_user_prefs this loads loads the settings from the database. First step is to run that query manaully and check what is returned.

One more thing: Is your current threshold level an interger? If not you will need to change the increment setting in your config so that the number is available in the threshold dropdown list. eg. If you have a threshold of 3.5 you will need an increment of 0.5
« Last Edit: June 10, 2009, 04:16:32 AM by JohnDoh »
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline patricktech

  • Newbie
  • *
  • Posts: 6
SpamAssassin MySQL Plugin
« Reply #7 on: June 10, 2009, 12:14:36 PM »
I overlooked the fact that your plugin is configured to set the user prefs threshold as "required_hits" instead of the new syntax being "required_score" in 3.2.x.

Also, an issue that I see is, if a user logs in to roundcube and they click on personal settings and go to the spam tab, it will show a threshold and a everything as already being setup. Even though they do not have any settings in the userprefs table at all. It would be nice to see an enable/disable button or something to that affect. So a user that doesnt have spam filtering turned on, would go to the page and all the defaults would be filled in, they would just have to click an enable button which would put all the necessary settings in the table or if they click disable, it would remove all the settings etc.

Thanks for your time and quick response. I hope you find my suggestions useful.
« Last Edit: June 10, 2009, 04:08:39 PM by patricktech »

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
SpamAssassin MySQL Plugin
« Reply #8 on: June 11, 2009, 02:54:23 AM »
Ah thanks, I did not know `required_hits` had changed, I will have to modify the plugin to read both and always write out `required_score` since it is the more correct one.

For the enabled/disable thing... do you not have any global settings in your database? The plugin reads both the user settings and the global ones and then combines them to get the currently active settings. I have never looked into what happens if you have no global or user settings since I never imaginged that happening. May be it is something I should investigate.

UPDATE: deprecated pref `required_hits` removed from the code in the repo, the plugin will still work with it but will update it to `required_score`
« Last Edit: June 12, 2009, 09:37:06 AM by JohnDoh »
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline patricktech

  • Newbie
  • *
  • Posts: 6
SpamAssassin MySQL Plugin
« Reply #9 on: June 15, 2009, 11:19:44 AM »
Sorry for the delay, I have been out of town for a few days....

I do have the $GLOBAL variables defined. Those are for the entire mail server and the 'required_score' is set to a very high number, almost essentially just allowing spam; really only catching spam that has ridiculous scores. I would think the ability for a end-user to be able to log in to roundcube and enable spam filtering (i.e. puts the required score and other settings in the database for that account) would be a good thing. Since the threshold the end user can set is 1-10, this setting will obviously be more within the realm of catching spam and filtering it out.

If at a later date, they decided they do not want spam filtering (for whatever reason), it would be nice if they could log in to roundcube again and disable spam filtering (i.e. removes any entires in the userprefs table for their account).
« Last Edit: June 15, 2009, 11:22:38 AM by patricktech »


Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
SpamAssassin MySQL Plugin
« Reply #11 on: June 17, 2009, 01:44:12 PM »
I have never really considered a situation where some one would effectivly want to turn off all spam settings. I guess the problem is that removing prefs from the SQL table does not actually turn off spam filtering, it just sets it back to default. So the effect of doing that would be different on different systems. Puting a straing "on or off" on the interface would be misleading in most setups I think.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline patricktech

  • Newbie
  • *
  • Posts: 6
SpamAssassin MySQL Plugin
« Reply #12 on: June 21, 2009, 08:43:18 PM »
Understandable. Something I can look to mod in myself I guess. :)

The one issue I see is a user that doesnt have user prefs, when the go to the spam tab, the plugin shows settings, atleast it could be misleading to an end user that doesnt know what to look for, when in fact no spam settings exist in the userprefs table for them.

I guess depending on its application and how its presented to the users could determine a lot. Maybe I will look at adding an enable and disable button that can be turned on or off in the config file??? i.e. choose to have it in use or not.

Thanks, Patrick
« Last Edit: June 22, 2009, 01:17:30 PM by patricktech »

Offline JohnDoh

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2,845
SpamAssassin MySQL Plugin
« Reply #13 on: June 25, 2009, 03:12:02 AM »
I have added some new options to the code (currently in the repo): In the score drop down a new option at the top called "Default Score". Also if some one has a score which is not in the drop down then a new value is added called "Other ([score])" so that a score is never lost. Then at the bottom of the screen, next to the save button there is a new "Restore Default Settings" button which does excatly what it says on the tin. It has the effect of deleteing all the user's settings since anything which matches the default is not saved to the DB.
Roundcube Plugins: Contextmenu, SpamAssassin Prefs, and more…

Offline jnorth

  • Newbie
  • *
  • Posts: 5
SpamAssassin MySQL Plugin
« Reply #14 on: July 10, 2009, 02:29:28 PM »
How does one tell SpamAssassin to use these settings?  I'll write a step-by-step if someone can point me in the right direction to get mine working.
GeorgiaCarry.org Member[/SIZE][/FONT]