You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@spamassassin.apache.org by bu...@bugzilla.spamassassin.org on 2007/07/03 14:02:23 UTC
[Bug 5543] New: RFE: way to include rules and plugin code in the same file
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5543
Summary: RFE: way to include rules and plugin code in the same
file
Product: Spamassassin
Version: 3.2.1
Platform: Other
OS/Version: other
Status: NEW
Severity: enhancement
Priority: P5
Component: Libraries
AssignedTo: dev@spamassassin.apache.org
ReportedBy: jm@jmason.org
A minor annoyance with plugins is that they have to include at least
two files -- a .pm file, and a .cf file. e.g. take the
http://wiki.apache.org/spamassassin/ClamAVPlugin --
clamav.cf:
loadplugin ClamAV clamav.pm
full CLAMAV eval:check_clamav()
describe CLAMAV Clam AntiVirus detected a virus
score CLAMAV 10
clamav.pm:
package ClamAV;
use strict;
use Mail::SpamAssassin;
use Mail::SpamAssassin::Plugin;
use File::Scan::ClamAV;
our @ISA = qw(Mail::SpamAssassin::Plugin);
sub new {
my ($class, $mailsa) = @_;
$class = ref($class) || $class;
...etc.
}
...etc.
1;
It'd be great if we could come up with a way to consolidate this
into one. That'd be a lot easier to distribute, I think.
How's about this: if a ".pm" file is found, and it contains
a scalar called $PackageName::SPAMASSASSIN_CONFIG, we load that
as SpamAssassin configuration, as if it was a ".cf" file.
e.g.
package ClamAV;
our $SPAMASSASSIN_CONFIG = q{
loadplugin ClamAV clamav.pm
full CLAMAV eval:check_clamav()
describe CLAMAV Clam AntiVirus detected a virus
score CLAMAV 10
};
use strict;
use Mail::SpamAssassin;
use Mail::SpamAssassin::Plugin;
use File::Scan::ClamAV;
our @ISA = qw(Mail::SpamAssassin::Plugin);
...etc.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 5543] RFE: way to include rules and plugin code in the same file
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5543
jm@jmason.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|Undefined |3.3.0
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 5543] RFE: way to include rules and plugin code in the same file
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5543
------- Additional Comments From lwilton@earthlink.net 2007-07-04 21:34 -------
How about a combination of the two concepts? The pm file contains a default
configuration for the plugin. When initialized, it will see
if "plugin_name.cf" exists in some standard location. If not, it will create
it from the default rules included in the pm file. If the cf file is already
there it will obviously do nothing; the user may have modified the contents or
hand-created it.
This you can distribute the whole thing in working form with one file, but the
user doesn't have to fool with the pm file just to change the rules. Of
course, the user could also override the rules in user.cf in the normal manner
I suppose.
This still doesn't solve the problem that there is a third file to modify
somewhere, since loadplugin commands aren't supposed to be in cf files.
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 5543] RFE: way to include rules and plugin code in the same file
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5543
------- Additional Comments From duncf@debian.org 2007-07-04 19:39 -------
That was sort of my inclination too... I think it'd probably be better to keep
config and code separate. The problem is more that a Wiki isn't a great place to
distribute plugins. :-)
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 5543] RFE: way to include rules and plugin code in the same file
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5543
------- Additional Comments From dan.mcdonald@austinenergy.com 2007-07-04 10:53 -------
I disagree. code and configurations should be separate. As a user, I wouldn't
want to modify a .pm unless I knew there was a bug, but I will gladly rip apart
a .cf file
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 5543] RFE: way to include rules and plugin code in the same file
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5543
------- Additional Comments From felicity@apache.org 2007-07-04 20:53 -------
I'll also add in a "ditto", I prefer plugins and rules to be separate.
Also, I think this is already possible. I took the Test plugin and added the
following right before the return() from new():
my $config = q&
body TVD_TRUE eval:check_test_plugin()
&;
$mailsaobject->{conf}->parse_rules($config);
in theory, plugins are only loaded from init(), so we can just call a
parse_rules and be done. Technically there should be something like:
file start NameOfPlugin.pm
...
file end NameOfPlugin.pm
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
[Bug 5543] RFE: way to include rules and plugin code in the same file
Posted by bu...@bugzilla.spamassassin.org.
http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5543
jm@jmason.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WONTFIX
------- Additional Comments From jm@jmason.org 2007-08-22 04:40 -------
ok, I think most people prefer them separate; closing
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.