Mailing List Archive

svn commit: r1871201 [8/17] - in /spamassassin/site/full/3.4.x: ./ doc/
Added: spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin.html
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin.html?rev=1871201&view=auto
==============================================================================
--- spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin.html (added)
+++ spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin.html Wed Dec 11 22:18:49 2019
@@ -0,0 +1,1246 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title></title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+
+
+<ul id="index">
+ <li><a href="#NAME">NAME</a></li>
+ <li><a href="#SYNOPSIS">SYNOPSIS</a>
+ <ul>
+ <li><a href="#SpamAssassin-configuration">SpamAssassin configuration:</a></li>
+ <li><a href="#Perl-code">Perl code:</a></li>
+ </ul>
+ </li>
+ <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
+ <li><a href="#INTERFACE">INTERFACE</a></li>
+ <li><a href="#METHODS">METHODS</a></li>
+ <li><a href="#HELPER-APIS">HELPER APIS</a></li>
+ <li><a href="#LOGGING">LOGGING</a></li>
+ <li><a href="#REGISTERING-EVAL-RULES">REGISTERING EVAL RULES</a></li>
+ <li><a href="#STANDARD-ARGUMENTS-FOR-RULE-TYPES">STANDARD ARGUMENTS FOR RULE TYPES</a></li>
+ <li><a href="#BACKWARD-COMPATIBILITY">BACKWARD COMPATIBILITY</a></li>
+ <li><a href="#SEE-ALSO">SEE ALSO</a></li>
+</ul>
+
+<h1 id="NAME">NAME</h1>
+
+<p>Mail::SpamAssassin::Plugin - SpamAssassin plugin base class</p>
+
+<h1 id="SYNOPSIS">SYNOPSIS</h1>
+
+<h2 id="SpamAssassin-configuration">SpamAssassin configuration:</h2>
+
+<pre><code> loadplugin MyPlugin /path/to/myplugin.pm</code></pre>
+
+<h2 id="Perl-code">Perl code:</h2>
+
+<pre><code> package MyPlugin;
+
+ use Mail::SpamAssassin::Plugin;
+ our @ISA = qw(Mail::SpamAssassin::Plugin);
+
+ sub new {
+ my ($class, $mailsa) = @_;
+
+ # the usual perlobj boilerplate to create a subclass object
+ $class = ref($class) || $class;
+ my $self = $class-&gt;SUPER::new($mailsa);
+ bless ($self, $class);
+
+ # then register an eval rule, if desired...
+ $self-&gt;register_eval_rule (&quot;check_for_foo&quot;);
+
+ # and return the new plugin object
+ return $self;
+ }
+
+ ...methods...
+
+ 1;</code></pre>
+
+<h1 id="DESCRIPTION">DESCRIPTION</h1>
+
+<p>This is the base class for SpamAssassin plugins; all plugins must be objects that implement this class.</p>
+
+<p>This class provides no-op stub methods for all the callbacks that a plugin can receive. It is expected that your plugin will override one or more of these stubs to perform its actions.</p>
+
+<p>SpamAssassin implements a plugin chain; each callback event is passed to each of the registered plugin objects in turn. Any plugin can call <code>$self-&gt;inhibit_further_callbacks()</code> to block delivery of that event to later plugins in the chain. This is useful if the plugin has handled the event, and there will be no need for later plugins to handle it as well.</p>
+
+<p>If you&#39;re looking to write a simple eval rule, skip straight to <code>register_eval_rule()</code>, below.</p>
+
+<h1 id="INTERFACE">INTERFACE</h1>
+
+<p>In all the plugin APIs below, <code>options</code> refers to a reference to a hash containing name-value pairs. This is used to ensure future-compatibility, in that we can add new options in future without affecting objects built to an earlier version of the API.</p>
+
+<p>For example, here would be how to print out the <code>line</code> item in a <code>parse_config()</code> method:</p>
+
+<pre><code> sub parse_config {
+ my ($self, $opts) = @_;
+ print &quot;MyPlugin: parse_config got &quot;.$opts-&gt;{line}.&quot;\n&quot;;
+ }</code></pre>
+
+<h1 id="METHODS">METHODS</h1>
+
+<p>The following methods can be overridden by subclasses to handle events.</p>
+
+<dl>
+
+<dt id="plugin-MyPluginClass-new-mailsaobject">$plugin = MyPluginClass-&gt;new ($mailsaobject)</dt>
+<dd>
+
+<p>Constructor. Plugins that need to register themselves will need to define their own; the default super-class constructor will work fine for plugins that just override a method.</p>
+
+<p>Note that subclasses must provide the <code>$mailsaobject</code> to the superclass constructor, like so:</p>
+
+<pre><code> my $self = $class-&gt;SUPER::new($mailsaobject);</code></pre>
+
+<p>Lifecycle note: plugins that will need to store per-scan state should not store that on the Plugin object; instead this should be stored on the PerMsgStatus object, see <code>check_start()</code> below. It is also likewise recommended that configuration settings be stored on the Conf object; see <code>parse_config()</code>.</p>
+
+</dd>
+<dt id="plugin-parse_config-options">$plugin-&gt;parse_config ( { options ... } )</dt>
+<dd>
+
+<p>Parse a configuration line that hasn&#39;t already been handled. <code>options</code> is a reference to a hash containing these options:</p>
+
+<dl>
+
+<dt id="line">line</dt>
+<dd>
+
+<p>The line of configuration text to parse. This has leading and trailing whitespace, and comments, removed.</p>
+
+</dd>
+<dt id="key">key</dt>
+<dd>
+
+<p>The configuration key; ie. the first &quot;word&quot; on the line.</p>
+
+</dd>
+<dt id="value">value</dt>
+<dd>
+
+<p>The configuration value; everything after the first &quot;word&quot; and any whitespace after that.</p>
+
+</dd>
+<dt id="conf">conf</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::Conf</code> object on which the configuration data should be stored.</p>
+
+</dd>
+<dt id="user_config">user_config</dt>
+<dd>
+
+<p>A boolean: <code>1</code> if reading a user&#39;s configuration, <code>0</code> if reading the system-wide configuration files.</p>
+
+</dd>
+</dl>
+
+<p>If the configuration line was a setting that is handled by this plugin, the method implementation should call <code>$self-&gt;inhibit_further_callbacks()</code>.</p>
+
+<p>If the setting is not handled by this plugin, the method should return <code>0</code> so that a later plugin may handle it, or so that SpamAssassin can output a warning message to the user if no plugin understands it.</p>
+
+<p>Lifecycle note: it is suggested that configuration be stored on the <code>Mail::SpamAssassin::Conf</code> object in use, instead of the plugin object itself. That can be found as <code>$plugin-&gt;{main}-&gt;{conf}</code>, or as &quot;conf&quot; in the <code>$options</code> hash reference above. By storing it on <code>conf</code>, this allows per-user and system-wide configuration precedence to be dealt with correctly.</p>
+
+</dd>
+<dt id="plugin-finish_parsing_start-options">$plugin-&gt;finish_parsing_start ( { options ... } )</dt>
+<dd>
+
+<p>Signals that the system-wide configuration has been completely read, but internal data structures are not yet created. It is possible to use this hook to dynamically change the configuration already read in or add new config options.</p>
+
+<p><code>options</code> is a reference to a hash containing these options:</p>
+
+<dl>
+
+<dt id="conf1">conf</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::Conf</code> object on which the configuration data should be stored.</p>
+
+</dd>
+</dl>
+
+<p>Note: there are no guarantees that the internal data structures of SpamAssassin will not change from release to release. In particular to this plugin hook, if you modify the rules data structures in a third-party plugin, all bets are off until such time that an API is present for modifying that configuration data.</p>
+
+</dd>
+<dt id="plugin-finish_parsing_end-options">$plugin-&gt;finish_parsing_end ( { options ... } )</dt>
+<dd>
+
+<p>Signals that the system-wide configuration parsing has just finished, and SpamAssassin is nearly ready to check messages.</p>
+
+<p><code>options</code> is a reference to a hash containing these options:</p>
+
+<dl>
+
+<dt id="conf2">conf</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::Conf</code> object on which the configuration data should be stored.</p>
+
+</dd>
+</dl>
+
+<p>Note: there are no guarantees that the internal data structures of SpamAssassin will not change from release to release. In particular to this plugin hook, if you modify the rules data structures in a third-party plugin, all bets are off until such time that an API is present for modifying that configuration data.</p>
+
+</dd>
+<dt id="plugin-user_conf_parsing_start-options">$plugin-&gt;user_conf_parsing_start ( { options ... } )</dt>
+<dd>
+
+<p>Signals that the per-user configuration has been completely read, but not converted to internal data structures. It is possible to use this hook to dynamically change the configuration already read in or add new config options.</p>
+
+<p>If <code>allow_user_rules</code> is enabled in the configuration, it is possible that additional rules have been added since the <code>finish_parsing_start</code> plugin hook invocation was called.</p>
+
+<dl>
+
+<dt id="conf3">conf</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::Conf</code> object on which the configuration data should be stored.</p>
+
+</dd>
+</dl>
+
+<p>Note: there are no guarantees that the internal data structures of SpamAssassin will not change from release to release. In particular to this plugin hook, if you modify the rules data structures in a third-party plugin, all bets are off until such time that an API is present for modifying that configuration data.</p>
+
+</dd>
+<dt id="plugin-user_conf_parsing_end-options">$plugin-&gt;user_conf_parsing_end ( { options ... } )</dt>
+<dd>
+
+<p>Signals that the per-user configuration parsing has just finished, and SpamAssassin is nearly ready to check messages. If <code>allow_user_rules</code> is enabled in the configuration, it is possible that additional rules have been added since the <code>finish_parsing_end</code> plugin hook invocation was called.</p>
+
+<p><code>options</code> is a reference to a hash containing these options:</p>
+
+<dl>
+
+<dt id="conf4">conf</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::Conf</code> object on which the configuration data should be stored.</p>
+
+</dd>
+</dl>
+
+<p>Note: there are no guarantees that the internal data structures of SpamAssassin will not change from release to release. In particular to this plugin hook, if you modify the rules data structures in a third-party plugin, all bets are off until such time that an API is present for modifying that configuration data.</p>
+
+</dd>
+<dt id="plugin-signal_user_changed-options">$plugin-&gt;signal_user_changed ( { options ... } )</dt>
+<dd>
+
+<p>Signals that the current user has changed for a new one.</p>
+
+<dl>
+
+<dt id="username">username</dt>
+<dd>
+
+<p>The new user&#39;s username.</p>
+
+</dd>
+<dt id="user_dir">user_dir</dt>
+<dd>
+
+<p>The new user&#39;s home directory. (equivalent to <code>~</code>.)</p>
+
+</dd>
+<dt id="userstate_dir">userstate_dir</dt>
+<dd>
+
+<p>The new user&#39;s storage directory. (equivalent to <code>~/.spamassassin</code>.)</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-services_authorized_for_username-options">$plugin-&gt;services_authorized_for_username ( { options ... } )</dt>
+<dd>
+
+<p>Validates that a given username is authorized to use certain services.</p>
+
+<p>In order to authorize a user, the plugin should first check that it can handle any of the services passed into the method and then set the value for each allowed service to true (or any non-negative value).</p>
+
+<p>The current supported services are: bayessql</p>
+
+<dl>
+
+<dt id="username1">username</dt>
+<dd>
+
+<p>A username</p>
+
+</dd>
+<dt id="services">services</dt>
+<dd>
+
+<p>Reference to a hash containing the services you want to check.</p>
+
+<p>{</p>
+
+<pre><code> &#39;bayessql&#39; =&gt; 0</code></pre>
+
+<p>}</p>
+
+</dd>
+<dt id="conf5">conf</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::Conf</code> object on which the configuration data should be stored.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-compile_now_start-options">$plugin-&gt;compile_now_start ( { options ... } )</dt>
+<dd>
+
+<p>This is called at the beginning of Mail::SpamAssassin::compile_now() so plugins can do any necessary initialization for multi-process SpamAssassin (such as spamd or mass-check -j).</p>
+
+<dl>
+
+<dt id="use_user_prefs">use_user_prefs</dt>
+<dd>
+
+<p>The value of $use_user_prefs option in compile_now().</p>
+
+</dd>
+<dt id="keep_userstate">keep_userstate</dt>
+<dd>
+
+<p>The value of $keep_userstate option in compile_now().</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-compile_now_finish-options">$plugin-&gt;compile_now_finish ( { options ... } )</dt>
+<dd>
+
+<p>This is called at the end of Mail::SpamAssassin::compile_now() so plugins can do any necessary initialization for multi-process SpamAssassin (such as spamd or mass-check -j).</p>
+
+<dl>
+
+<dt id="use_user_prefs1">use_user_prefs</dt>
+<dd>
+
+<p>The value of $use_user_prefs option in compile_now().</p>
+
+</dd>
+<dt id="keep_userstate1">keep_userstate</dt>
+<dd>
+
+<p>The value of $keep_userstate option in compile_now().</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-check_start-options">$plugin-&gt;check_start ( { options ... } )</dt>
+<dd>
+
+<p>Signals that a message check operation is starting.</p>
+
+<dl>
+
+<dt id="permsgstatus">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+<p>Lifecycle note: it is recommended that rules that need to track test state on a per-scan basis should store that state on this object, not on the plugin object itself, since the plugin object will be shared between all active scanners.</p>
+
+<p>The message being scanned is accessible through the <code>$permsgstatus-&gt;get_message()</code> API; there are a number of other public APIs on that object, too. See <code>Mail::SpamAssassin::PerMsgStatus</code> perldoc.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-check_main-options">$plugin-&gt;check_main ( { options ... } )</dt>
+<dd>
+
+<p>Signals that a message should be checked. Note that implementations of this hook should return <code>1</code>.</p>
+
+<dl>
+
+<dt id="permsgstatus1">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-check_tick-options">$plugin-&gt;check_tick ( { options ... } )</dt>
+<dd>
+
+<p>Called periodically during a message check operation. A callback set for this method is a good place to run through an event loop dealing with network events triggered in a <code>parse_metadata</code> method, for example.</p>
+
+<dl>
+
+<dt id="permsgstatus2">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-check_post_dnsbl-options">$plugin-&gt;check_post_dnsbl ( { options ... } )</dt>
+<dd>
+
+<p>Called after the DNSBL results have been harvested. This is a good place to harvest your own asynchronously-started network lookups.</p>
+
+<dl>
+
+<dt id="permsgstatus3">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-check_post_learn-options">$plugin-&gt;check_post_learn ( { options ... } )</dt>
+<dd>
+
+<p>Called after auto-learning may (or may not) have taken place. If you wish to perform additional learning, whether or not auto-learning happens, this is the place to do it.</p>
+
+<dl>
+
+<dt id="permsgstatus4">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-check_end-options">$plugin-&gt;check_end ( { options ... } )</dt>
+<dd>
+
+<p>Signals that a message check operation has just finished, and the results are about to be returned to the caller.</p>
+
+<dl>
+
+<dt id="permsgstatus5">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan. The current score, names of rules that hit, etc. can be retrieved using the public APIs on this object.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-finish_tests-options">$plugin-&gt;finish_tests ( { options ... } )</dt>
+<dd>
+
+<p>Called via <code>Mail::SpamAssassin::finish</code>. This should clear up any tests that a plugin has added to the namespace.</p>
+
+<p>In certain circumstances, plugins may find it useful to compile perl functions from the ruleset, on the fly. It is important to remove these once the <code>Mail::SpamAssassin</code> object is deleted, however, and this API allows this.</p>
+
+<p>Each plugin is responsible for its own generated perl functions.</p>
+
+<dl>
+
+<dt id="conf6">conf</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::Conf</code> object on which the configuration data should be stored.</p>
+
+</dd>
+</dl>
+
+<p>See also the <code>register_generated_rule_method</code> helper API, below.</p>
+
+</dd>
+<dt id="plugin-extract_metadata-options">$plugin-&gt;extract_metadata ( { options ... } )</dt>
+<dd>
+
+<p>Signals that a message is being mined for metadata. Some plugins may wish to add their own metadata as well.</p>
+
+<dl>
+
+<dt id="msg">msg</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::Message</code> object for this message.</p>
+
+</dd>
+<dt id="permsgstatus6">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-parsed_metadata-options">$plugin-&gt;parsed_metadata ( { options ... } )</dt>
+<dd>
+
+<p>Signals that a message&#39;s metadata has been parsed, and can now be accessed by the plugin.</p>
+
+<dl>
+
+<dt id="permsgstatus7">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-start_rules-options">$plugin-&gt;start_rules ( { options ... } )</dt>
+<dd>
+
+<p>Called before testing a set of rules of a given type and priority.</p>
+
+<dl>
+
+<dt id="permsgstatus8">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+</dd>
+<dt id="ruletype">ruletype</dt>
+<dd>
+
+<p>The type of the rules about to be performed.</p>
+
+</dd>
+<dt id="priority">priority</dt>
+<dd>
+
+<p>The priority level of the rules about to be performed.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-hit_rule-options">$plugin-&gt;hit_rule ( { options ... } )</dt>
+<dd>
+
+<p>Called when a rule fires.</p>
+
+<dl>
+
+<dt id="permsgstatus9">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+</dd>
+<dt id="ruletype1">ruletype</dt>
+<dd>
+
+<p>The type of the rule that fired.</p>
+
+</dd>
+<dt id="rulename">rulename</dt>
+<dd>
+
+<p>The name of the rule that fired.</p>
+
+</dd>
+<dt id="score">score</dt>
+<dd>
+
+<p>The rule&#39;s score in the active scoreset.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-ran_rule-options">$plugin-&gt;ran_rule ( { options ... } )</dt>
+<dd>
+
+<p>Called after a rule has been tested, whether or not it fired. When the rule fires, the hit_rule callback is always called before this.</p>
+
+<dl>
+
+<dt id="permsgstatus10">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+</dd>
+<dt id="ruletype2">ruletype</dt>
+<dd>
+
+<p>The type of the rule that was tested.</p>
+
+</dd>
+<dt id="rulename1">rulename</dt>
+<dd>
+
+<p>The name of the rule that was tested.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-autolearn_discriminator-options">$plugin-&gt;autolearn_discriminator ( { options ... } )</dt>
+<dd>
+
+<p>Control whether a just-scanned message should be learned as either spam or ham. This method should return one of <code>1</code> to learn the message as spam, <code>0</code> to learn as ham, or <code>undef</code> to not learn from the message at all.</p>
+
+<dl>
+
+<dt id="permsgstatus11">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-autolearn-options">$plugin-&gt;autolearn ( { options ... } )</dt>
+<dd>
+
+<p>Signals that a message is about to be auto-learned as either ham or spam.</p>
+
+<dl>
+
+<dt id="permsgstatus12">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+</dd>
+<dt id="isspam">isspam</dt>
+<dd>
+
+<p><code>1</code> if the message is spam, <code>0</code> if ham.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-per_msg_finish-options">$plugin-&gt;per_msg_finish ( { options ... } )</dt>
+<dd>
+
+<p>Signals that a <code>Mail::SpamAssassin::PerMsgStatus</code> object is being destroyed, and any per-scan context held on that object by this plugin should be destroyed as well.</p>
+
+<p>Normally, any member variables on the <code>PerMsgStatus</code> object will be cleaned up automatically -- but if your plugin has made a circular reference on that object, this is the place to break them so that garbage collection can operate correctly.</p>
+
+<dl>
+
+<dt id="permsgstatus13">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-have_shortcircuited-options">$plugin-&gt;have_shortcircuited ( { options ... } )</dt>
+<dd>
+
+<p>Has the current scan operation &#39;short-circuited&#39;? In other words, can further scanning be skipped, since the message is already definitively classified as either spam or ham?</p>
+
+<p>Plugins should return <code>0</code> to indicate that scanning should continue, or <code>1</code> to indicate that short-circuiting has taken effect.</p>
+
+<dl>
+
+<dt id="permsgstatus14">permsgstatus</dt>
+<dd>
+
+<p>The <code>Mail::SpamAssassin::PerMsgStatus</code> context object for this scan.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-bayes_learn-options">$plugin-&gt;bayes_learn ( { options ... } )</dt>
+<dd>
+
+<p>Called at the end of a bayes learn operation.</p>
+
+<p>This phase is the best place to map the raw (original) token value to the SHA1 hashed value.</p>
+
+<dl>
+
+<dt id="toksref">toksref</dt>
+<dd>
+
+<p>Reference to hash returned by call to tokenize. The hash takes the format of:</p>
+
+<pre><code> {
+ &#39;SHA1 Hash Value&#39; =&gt; &#39;raw (original) value&#39;,
+ ...
+ }</code></pre>
+
+<p>NOTE: This data structure has changed since it was originally introduced in version 3.0.0. The values are no longer perl anonymous hashes, they are a single string containing the raw token value. You can test for backward compatibility by checking to see if the value for a key is a reference to a perl HASH, for instance:</p>
+
+<p>if (ref($toksref-&gt;{$sometokenkey}) eq &#39;HASH&#39;) {...</p>
+
+<p>If it is, then you are using the old interface, otherwise you are using the current interface.</p>
+
+</dd>
+<dt id="isspam1">isspam</dt>
+<dd>
+
+<p>Boolean value stating what flavor of message the tokens represent, if true then message was specified as spam, false is nonspam. Note, when function is scan then isspam value is not valid.</p>
+
+</dd>
+<dt id="msgid">msgid</dt>
+<dd>
+
+<p>Generated message id of the message just learned.</p>
+
+</dd>
+<dt id="msgatime">msgatime</dt>
+<dd>
+
+<p>Received date of the current message or current time if received date could not be determined. In addition, if the receive date is more than 24 hrs into the future it will be reset to current datetime.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-bayes_forget-options">$plugin-&gt;bayes_forget ( { options ... } )</dt>
+<dd>
+
+<p>Called at the end of a bayes forget operation.</p>
+
+<dl>
+
+<dt id="toksref1">toksref</dt>
+<dd>
+
+<p>Reference to hash returned by call to tokenize. See bayes_learn documentation for additional information on the format.</p>
+
+</dd>
+<dt id="isspam2">isspam</dt>
+<dd>
+
+<p>Boolean value stating what flavor of message the tokens represent, if true then message was specified as spam, false is nonspam. Note, when function is scan then isspam value is not valid.</p>
+
+</dd>
+<dt id="msgid1">msgid</dt>
+<dd>
+
+<p>Generated message id of the message just forgotten.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-bayes_scan-options">$plugin-&gt;bayes_scan ( { options ... } )</dt>
+<dd>
+
+<p>Called at the end of a bayes scan operation. NOTE: Will not be called in case of error or if the message is otherwise skipped.</p>
+
+<dl>
+
+<dt id="toksref2">toksref</dt>
+<dd>
+
+<p>Reference to hash returned by call to tokenize. See bayes_learn documentation for additional information on the format.</p>
+
+</dd>
+<dt id="probsref">probsref</dt>
+<dd>
+
+<p>Reference to hash of calculated probabilities for tokens found in the database.</p>
+
+<pre><code> {
+ &#39;SHA1 Hash Value&#39; =&gt; {
+ &#39;prob&#39; =&gt; &#39;calculated probability&#39;,
+ &#39;spam_count&#39; =&gt; &#39;Total number of spam msgs w/ token&#39;,
+ &#39;ham_count&#39; =&gt; &#39;Total number of ham msgs w/ token&#39;,
+ &#39;atime&#39; =&gt; &#39;Atime value for token in database&#39;
+ }
+ }</code></pre>
+
+</dd>
+<dt id="score1">score</dt>
+<dd>
+
+<p>Score calculated for this particular message.</p>
+
+</dd>
+<dt id="msgatime1">msgatime</dt>
+<dd>
+
+<p>Calculated atime of the message just learned, note it may have been adjusted if it was determined to be too far into the future.</p>
+
+</dd>
+<dt id="significant_tokens">significant_tokens</dt>
+<dd>
+
+<p>Array ref of the tokens found to be significant in determining the score for this message.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-plugin_report-options">$plugin-&gt;plugin_report ( { options ... } )</dt>
+<dd>
+
+<p>Called if the message is to be reported as spam. If the reporting system is available, the variable <code>$options-&gt;{report}-&gt;report_available}</code> should be set to <code>1</code>; if the reporting system successfully reported the message, the variable <code>$options-&gt;{report}-&gt;report_return}</code> should be set to <code>1</code>.</p>
+
+<dl>
+
+<dt id="report">report</dt>
+<dd>
+
+<p>Reference to the Reporter object (<code>$options-&gt;{report}</code> in the paragraph above.)</p>
+
+</dd>
+<dt id="text">text</dt>
+<dd>
+
+<p>Reference to a markup removed copy of the message in scalar string format.</p>
+
+</dd>
+<dt id="msg1">msg</dt>
+<dd>
+
+<p>Reference to the original message object.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-plugin_revoke-options">$plugin-&gt;plugin_revoke ( { options ... } )</dt>
+<dd>
+
+<p>Called if the message is to be reported as ham (revokes a spam report). If the reporting system is available, the variable <code>$options-&gt;{revoke}-&gt;revoke_available}</code> should be set to <code>1</code>; if the reporting system successfully revoked the message, the variable <code>$options-&gt;{revoke}-&gt;revoke_return}</code> should be set to <code>1</code>.</p>
+
+<dl>
+
+<dt id="revoke">revoke</dt>
+<dd>
+
+<p>Reference to the Reporter object (<code>$options-&gt;{revoke}</code> in the paragraph above.)</p>
+
+</dd>
+<dt id="text1">text</dt>
+<dd>
+
+<p>Reference to a markup removed copy of the message in scalar string format.</p>
+
+</dd>
+<dt id="msg2">msg</dt>
+<dd>
+
+<p>Reference to the original message object.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-whitelist_address-options">$plugin-&gt;whitelist_address( { options ... } )</dt>
+<dd>
+
+<p>Called when a request is made to add an address to a persistent address list.</p>
+
+<dl>
+
+<dt id="address">address</dt>
+<dd>
+
+<p>Address you wish to add.</p>
+
+</dd>
+<dt id="cli_p">cli_p</dt>
+<dd>
+
+<p>Indicate if the call is being made from a command line interface.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-blacklist_address-options">$plugin-&gt;blacklist_address( { options ... } )</dt>
+<dd>
+
+<p>Called when a request is made to add an address to a persistent address list.</p>
+
+<dl>
+
+<dt id="address1">address</dt>
+<dd>
+
+<p>Address you wish to add.</p>
+
+</dd>
+<dt id="cli_p1">cli_p</dt>
+<dd>
+
+<p>Indicate if the call is being made from a command line interface.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-remove_address-options">$plugin-&gt;remove_address( { options ... } )</dt>
+<dd>
+
+<p>Called when a request is made to remove an address to a persistent address list.</p>
+
+<dl>
+
+<dt id="address2">address</dt>
+<dd>
+
+<p>Address you wish to remove.</p>
+
+</dd>
+<dt id="cli_p2">cli_p</dt>
+<dd>
+
+<p>Indicate if the call is being made from a command line interface.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-spamd_child_init">$plugin-&gt;spamd_child_init ()</dt>
+<dd>
+
+<p>Called in each new child process when it starts up under spamd.</p>
+
+</dd>
+<dt id="plugin-log_scan_result-options">$plugin-&gt;log_scan_result ( { options ... } )</dt>
+<dd>
+
+<p>Called when spamd has completed scanning a message. Currently, only spamd calls this API.</p>
+
+<dl>
+
+<dt id="result">result</dt>
+<dd>
+
+<p>The <code>&#39;result: ...&#39;</code> line for this scan. Format is as described at <b>http://wiki.apache.org/spamassassin/SpamdSyslogFormat</b>.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-spamd_child_post_connection_close">$plugin-&gt;spamd_child_post_connection_close ()</dt>
+<dd>
+
+<p>Called when child returns from handling a connection.</p>
+
+<p>If there was an accept failure, the child will die and this code will not be called.</p>
+
+</dd>
+<dt id="plugin-finish">$plugin-&gt;finish ()</dt>
+<dd>
+
+<p>Called when the <code>Mail::SpamAssassin</code> object is destroyed.</p>
+
+</dd>
+<dt id="plugin-learner_new">$plugin-&gt;learner_new ()</dt>
+<dd>
+
+<p>Used to support human-trained probabilistic classifiers like the BAYES_* ruleset. Called when a new <code>Mail::SpamAssassin::Bayes</code> object has been created; typically when a new user&#39;s scan is about to start.</p>
+
+</dd>
+<dt id="plugin-learn_message">$plugin-&gt;learn_message ()</dt>
+<dd>
+
+<p>Train the classifier with a training message.</p>
+
+<dl>
+
+<dt id="isspam3">isspam</dt>
+<dd>
+
+<p>1 if the message is spam, 0 if it&#39;s non-spam.</p>
+
+</dd>
+<dt id="msg3">msg</dt>
+<dd>
+
+<p>The message&#39;s <code>Mail::SpamAssassin::Message</code> object.</p>
+
+</dd>
+<dt id="id">id</dt>
+<dd>
+
+<p>An optional message-identification string, used internally to tag the message. If it is <code>undef</code>, one will be generated. It should be unique to that message.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-forget_message">$plugin-&gt;forget_message ()</dt>
+<dd>
+
+<p>Tell the classifier to &#39;forget&#39; its training about a specific message.</p>
+
+<dl>
+
+<dt id="msg4">msg</dt>
+<dd>
+
+<p>The message&#39;s <code>Mail::SpamAssassin::Message</code> object.</p>
+
+</dd>
+<dt id="id1">id</dt>
+<dd>
+
+<p>An optional message-identification string, used internally to tag the message. If it is <code>undef</code>, one will be generated. It should be unique to that message.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-learner_sync">$plugin-&gt;learner_sync ()</dt>
+<dd>
+
+<p>Tell the classifier to &#39;sync&#39; any pending changes against the current user&#39;s training database. This is called by <code>sa-learn --sync</code>.</p>
+
+<p>If you do not need to implement these for your classifier, create an implementation that just contains <code>return 1</code>.</p>
+
+</dd>
+<dt id="plugin-learner_expire_old_training">$plugin-&gt;learner_expire_old_training ()</dt>
+<dd>
+
+<p>Tell the classifier to perform infrequent, time-consuming cleanup of the current user&#39;s training database. This is called by <code>sa-learn --force-expire</code>.</p>
+
+<p>If you do not need to implement these for your classifier, create an implementation that just contains <code>return 1</code>.</p>
+
+</dd>
+<dt id="plugin-learner_is_scan_available">$plugin-&gt;learner_is_scan_available ()</dt>
+<dd>
+
+<p>Should return 1 if it is possible to use the current user&#39;s training data for a message-scan operation, or 0 otherwise.</p>
+
+</dd>
+<dt id="plugin-learner_dump_database">$plugin-&gt;learner_dump_database ()</dt>
+<dd>
+
+<p>Dump information about the current user&#39;s training data to <code>stdout</code>. This is called by <code>sa-learn --dump</code>.</p>
+
+<dl>
+
+<dt id="magic">magic</dt>
+<dd>
+
+<p>Set to 1 if &quot;magic&quot; name-value metadata should be dumped.</p>
+
+</dd>
+<dt id="toks">toks</dt>
+<dd>
+
+<p>Set to 1 if the database of tokens should be dumped.</p>
+
+</dd>
+<dt id="regex">regex</dt>
+<dd>
+
+<p>Either <code>undef</code> to dump all tokens, or a value which specifies a regular expression subset of the tokens to dump.</p>
+
+</dd>
+</dl>
+
+</dd>
+<dt id="plugin-learner_close">$plugin-&gt;learner_close ()</dt>
+<dd>
+
+<p>Close any open databases.</p>
+
+<dl>
+
+<dt id="quiet">quiet</dt>
+<dd>
+
+<p>Set to 1 if warning messages should be suppressed.</p>
+
+</dd>
+</dl>
+
+</dd>
+</dl>
+
+<h1 id="HELPER-APIS">HELPER APIS</h1>
+
+<p>These methods provide an API for plugins to register themselves to receive specific events, or control the callback chain behaviour.</p>
+
+<dl>
+
+<dt id="plugin-register_eval_rule-nameofevalsub">$plugin-&gt;register_eval_rule ($nameofevalsub)</dt>
+<dd>
+
+<p>Plugins that implement an eval test will need to call this, so that SpamAssassin calls into the object when that eval test is encountered. See the <b>REGISTERING EVAL RULES</b> section for full details.</p>
+
+</dd>
+<dt id="plugin-register_generated_rule_method-nameofsub">$plugin-&gt;register_generated_rule_method ($nameofsub)</dt>
+<dd>
+
+<p>In certain circumstances, plugins may find it useful to compile perl functions from the ruleset, on the fly. It is important to remove these once the <code>Mail::SpamAssassin</code> object is deleted, however, and this API allows this.</p>
+
+<p>Once the method <code>$nameofsub</code> has been generated, call this API with the name of the method (including full package scope). This indicates that it&#39;s a temporary piece of generated code, built from the SpamAssassin ruleset, and when <code>Mail::SpamAssassin::finish()</code> is called, the method will be destroyed.</p>
+
+<p>This API was added in SpamAssassin 3.2.0.</p>
+
+</dd>
+<dt id="plugin-register_method_priority-methodname-priority">$plugin-&gt;register_method_priority($methodname, $priority)</dt>
+<dd>
+
+<p>Indicate that the method named <code>$methodname</code> on the current object has a callback priority of <code>$priority</code>.</p>
+
+<p>This is used by the plugin handler to determine the relative order of callbacks; plugins with lower-numbered priorities are called before plugins with higher-numbered priorities. Each method can have a different priority value. The default value is <code>0</code>. The ordering of callbacks to methods with equal priority is undefined.</p>
+
+<p>Typically, you only need to worry about this if you need to ensure your plugin&#39;s method is called before another plugin&#39;s implementation of that method. It should be called from your plugin&#39;s constructor.</p>
+
+<p>This API was added in SpamAssassin 3.2.0.</p>
+
+</dd>
+<dt id="plugin-inhibit_further_callbacks">$plugin-&gt;inhibit_further_callbacks()</dt>
+<dd>
+
+<p>Tells the plugin handler to inhibit calling into other plugins in the plugin chain for the current callback. Frequently used when parsing configuration settings using <code>parse_config()</code>.</p>
+
+</dd>
+</dl>
+
+<h1 id="LOGGING">LOGGING</h1>
+
+<dl>
+
+<dt id="Mail::SpamAssassin::Plugin::dbg-message">Mail::SpamAssassin::Plugin::dbg($message)</dt>
+<dd>
+
+<p>Output a debugging message <code>$message</code>, if the SpamAssassin object is running with debugging turned on.</p>
+
+<p><i>NOTE:</i> This function is not available in the package namespace of general plugins and can&#39;t be called via $self-&gt;dbg(). If a plugin wishes to output debug information, it should call <code>Mail::SpamAssassin::Plugin::dbg($msg)</code>.</p>
+
+</dd>
+<dt id="Mail::SpamAssassin::Plugin::info-message">Mail::SpamAssassin::Plugin::info($message)</dt>
+<dd>
+
+<p>Output an informational message <code>$message</code>, if the SpamAssassin object is running with informational messages turned on.</p>
+
+<p><i>NOTE:</i> This function is not available in the package namespace of general plugins and can&#39;t be called via $self-&gt;info(). If a plugin wishes to output debug information, it should call <code>Mail::SpamAssassin::Plugin::info($msg)</code>.</p>
+
+<p>In general, it is better for plugins to use the <code>Mail::SpamAssassin::Logger</code> module to import <code>dbg</code> and <code>info</code> directly, like so:</p>
+
+<pre><code> use Mail::SpamAssassin::Logger;
+ dbg(&quot;some message&quot;);
+ info(&quot;some other message&quot;);</code></pre>
+
+</dd>
+</dl>
+
+<h1 id="REGISTERING-EVAL-RULES">REGISTERING EVAL RULES</h1>
+
+<p>Plugins that implement an eval test must register the methods that can be called from rules in the configuration files, in the plugin class&#39; constructor.</p>
+
+<p>For example,</p>
+
+<pre><code> $plugin-&gt;register_eval_rule (&#39;check_for_foo&#39;)</code></pre>
+
+<p>will cause <code>$plugin-&gt;check_for_foo()</code> to be called for this SpamAssassin rule:</p>
+
+<pre><code> header FOO_RULE eval:check_for_foo()</code></pre>
+
+<p>Note that eval rules are passed the following arguments:</p>
+
+<dl>
+
+<dt id="The-plugin-object-itself">- The plugin object itself</dt>
+<dd>
+
+</dd>
+<dt id="The-Mail::SpamAssassin::PerMsgStatus-object-calling-the-rule">- The <code>Mail::SpamAssassin::PerMsgStatus</code> object calling the rule</dt>
+<dd>
+
+</dd>
+<dt id="standard-arguments-for-the-rule-type-in-use">- standard arguments for the rule type in use</dt>
+<dd>
+
+</dd>
+<dt id="any-and-all-arguments-as-specified-in-the-configuration-file">- any and all arguments as specified in the configuration file</dt>
+<dd>
+
+</dd>
+</dl>
+
+<p>In other words, the eval test method should look something like this:</p>
+
+<pre><code> sub check_for_foo {
+ my ($self, $permsgstatus, ...arguments...) = @_;
+ ...code returning 0 or 1
+ }</code></pre>
+
+<p>Note that the headers can be accessed using the <code>get()</code> method on the <code>Mail::SpamAssassin::PerMsgStatus</code> object, and the body by <code>get_decoded_stripped_body_text_array()</code> and other similar methods. Similarly, the <code>Mail::SpamAssassin::Conf</code> object holding the current configuration may be accessed through <code>$permsgstatus-&gt;{main}-&gt;{conf}</code>.</p>
+
+<p>The eval rule should return <code>1</code> for a hit, or <code>0</code> if the rule is not hit.</p>
+
+<p>State for a single message being scanned should be stored on the <code>$permsgstatus</code> object, not on the <code>$self</code> object, since <code>$self</code> persists between scan operations. See the &#39;lifecycle note&#39; on the <code>check_start()</code> method above.</p>
+
+<h1 id="STANDARD-ARGUMENTS-FOR-RULE-TYPES">STANDARD ARGUMENTS FOR RULE TYPES</h1>
+
+<p>Plugins will be called with the same arguments as a standard EvalTest. Different rule types receive different information by default:</p>
+
+<dl>
+
+<dt id="header-tests:-no-extra-arguments">- header tests: no extra arguments</dt>
+<dd>
+
+</dd>
+<dt id="body-tests:-fully-rendered-message-as-array-reference">- body tests: fully rendered message as array reference</dt>
+<dd>
+
+</dd>
+<dt id="rawbody-tests:-fully-decoded-message-as-array-reference">- rawbody tests: fully decoded message as array reference</dt>
+<dd>
+
+</dd>
+<dt id="full-tests:-pristine-message-as-scalar-reference">- full tests: pristine message as scalar reference</dt>
+<dd>
+
+</dd>
+</dl>
+
+<p>The configuration file arguments will be passed in after the standard arguments.</p>
+
+<h1 id="BACKWARD-COMPATIBILITY">BACKWARD COMPATIBILITY</h1>
+
+<p>Note that if you write a plugin and need to determine if a particular helper method is supported on <code>Mail::SpamAssassin::Plugin</code>, you can do this:</p>
+
+<pre><code> if ($self-&gt;can(&quot;name_of_method&quot;)) {
+ eval {
+ $self-&gt;name_of_method(); # etc.
+ }
+ } else {
+ # take fallback action
+ }</code></pre>
+
+<p>The same applies for the public APIs on objects of other types, such as <code>Mail::SpamAssassin::PerMsgStatus</code>.</p>
+
+<h1 id="SEE-ALSO">SEE ALSO</h1>
+
+<p>Mail::SpamAssassin(3)</p>
+
+<p>Mail::SpamAssassin::PerMsgStatus(3)</p>
+
+<p>http://wiki.apache.org/spamassassin/PluginWritingTips</p>
+
+<p>http://issues.apache.org/SpamAssassin/show_bug.cgi?id=2163</p>
+
+
+</body>
+
+</html>
+
+

Added: spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin.txt
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin.txt?rev=1871201&view=auto
==============================================================================
--- spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin.txt (added)
+++ spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin.txt Wed Dec 11 22:18:49 2019
@@ -0,0 +1,838 @@
+NAME
+ Mail::SpamAssassin::Plugin - SpamAssassin plugin base class
+
+SYNOPSIS
+ SpamAssassin configuration:
+ loadplugin MyPlugin /path/to/myplugin.pm
+
+ Perl code:
+ package MyPlugin;
+
+ use Mail::SpamAssassin::Plugin;
+ our @ISA = qw(Mail::SpamAssassin::Plugin);
+
+ sub new {
+ my ($class, $mailsa) = @_;
+
+ # the usual perlobj boilerplate to create a subclass object
+ $class = ref($class) || $class;
+ my $self = $class->SUPER::new($mailsa);
+ bless ($self, $class);
+
+ # then register an eval rule, if desired...
+ $self->register_eval_rule ("check_for_foo");
+
+ # and return the new plugin object
+ return $self;
+ }
+
+ ...methods...
+
+ 1;
+
+DESCRIPTION
+ This is the base class for SpamAssassin plugins; all plugins must be
+ objects that implement this class.
+
+ This class provides no-op stub methods for all the callbacks that a
+ plugin can receive. It is expected that your plugin will override one or
+ more of these stubs to perform its actions.
+
+ SpamAssassin implements a plugin chain; each callback event is passed to
+ each of the registered plugin objects in turn. Any plugin can call
+ "$self->inhibit_further_callbacks()" to block delivery of that event to
+ later plugins in the chain. This is useful if the plugin has handled the
+ event, and there will be no need for later plugins to handle it as well.
+
+ If you're looking to write a simple eval rule, skip straight to
+ "register_eval_rule()", below.
+
+INTERFACE
+ In all the plugin APIs below, "options" refers to a reference to a hash
+ containing name-value pairs. This is used to ensure
+ future-compatibility, in that we can add new options in future without
+ affecting objects built to an earlier version of the API.
+
+ For example, here would be how to print out the "line" item in a
+ "parse_config()" method:
+
+ sub parse_config {
+ my ($self, $opts) = @_;
+ print "MyPlugin: parse_config got ".$opts->{line}."\n";
+ }
+
+METHODS
+ The following methods can be overridden by subclasses to handle events.
+
+ $plugin = MyPluginClass->new ($mailsaobject)
+ Constructor. Plugins that need to register themselves will need to
+ define their own; the default super-class constructor will work fine
+ for plugins that just override a method.
+
+ Note that subclasses must provide the $mailsaobject to the
+ superclass constructor, like so:
+
+ my $self = $class->SUPER::new($mailsaobject);
+
+ Lifecycle note: plugins that will need to store per-scan state
+ should not store that on the Plugin object; instead this should be
+ stored on the PerMsgStatus object, see "check_start()" below. It is
+ also likewise recommended that configuration settings be stored on
+ the Conf object; see "parse_config()".
+
+ $plugin->parse_config ( { options ... } )
+ Parse a configuration line that hasn't already been handled.
+ "options" is a reference to a hash containing these options:
+
+ line
+ The line of configuration text to parse. This has leading and
+ trailing whitespace, and comments, removed.
+
+ key The configuration key; ie. the first "word" on the line.
+
+ value
+ The configuration value; everything after the first "word" and
+ any whitespace after that.
+
+ conf
+ The "Mail::SpamAssassin::Conf" object on which the configuration
+ data should be stored.
+
+ user_config
+ A boolean: 1 if reading a user's configuration, 0 if reading the
+ system-wide configuration files.
+
+ If the configuration line was a setting that is handled by this
+ plugin, the method implementation should call
+ "$self->inhibit_further_callbacks()".
+
+ If the setting is not handled by this plugin, the method should
+ return 0 so that a later plugin may handle it, or so that
+ SpamAssassin can output a warning message to the user if no plugin
+ understands it.
+
+ Lifecycle note: it is suggested that configuration be stored on the
+ "Mail::SpamAssassin::Conf" object in use, instead of the plugin
+ object itself. That can be found as "$plugin->{main}->{conf}", or as
+ "conf" in the $options hash reference above. By storing it on
+ "conf", this allows per-user and system-wide configuration
+ precedence to be dealt with correctly.
+
+ $plugin->finish_parsing_start ( { options ... } )
+ Signals that the system-wide configuration has been completely read,
+ but internal data structures are not yet created. It is possible to
+ use this hook to dynamically change the configuration already read
+ in or add new config options.
+
+ "options" is a reference to a hash containing these options:
+
+ conf
+ The "Mail::SpamAssassin::Conf" object on which the configuration
+ data should be stored.
+
+ Note: there are no guarantees that the internal data structures of
+ SpamAssassin will not change from release to release. In particular
+ to this plugin hook, if you modify the rules data structures in a
+ third-party plugin, all bets are off until such time that an API is
+ present for modifying that configuration data.
+
+ $plugin->finish_parsing_end ( { options ... } )
+ Signals that the system-wide configuration parsing has just
+ finished, and SpamAssassin is nearly ready to check messages.
+
+ "options" is a reference to a hash containing these options:
+
+ conf
+ The "Mail::SpamAssassin::Conf" object on which the configuration
+ data should be stored.
+
+ Note: there are no guarantees that the internal data structures of
+ SpamAssassin will not change from release to release. In particular
+ to this plugin hook, if you modify the rules data structures in a
+ third-party plugin, all bets are off until such time that an API is
+ present for modifying that configuration data.
+
+ $plugin->user_conf_parsing_start ( { options ... } )
+ Signals that the per-user configuration has been completely read,
+ but not converted to internal data structures. It is possible to use
+ this hook to dynamically change the configuration already read in or
+ add new config options.
+
+ If "allow_user_rules" is enabled in the configuration, it is
+ possible that additional rules have been added since the
+ "finish_parsing_start" plugin hook invocation was called.
+
+ conf
+ The "Mail::SpamAssassin::Conf" object on which the configuration
+ data should be stored.
+
+ Note: there are no guarantees that the internal data structures of
+ SpamAssassin will not change from release to release. In particular
+ to this plugin hook, if you modify the rules data structures in a
+ third-party plugin, all bets are off until such time that an API is
+ present for modifying that configuration data.
+
+ $plugin->user_conf_parsing_end ( { options ... } )
+ Signals that the per-user configuration parsing has just finished,
+ and SpamAssassin is nearly ready to check messages. If
+ "allow_user_rules" is enabled in the configuration, it is possible
+ that additional rules have been added since the "finish_parsing_end"
+ plugin hook invocation was called.
+
+ "options" is a reference to a hash containing these options:
+
+ conf
+ The "Mail::SpamAssassin::Conf" object on which the configuration
+ data should be stored.
+
+ Note: there are no guarantees that the internal data structures of
+ SpamAssassin will not change from release to release. In particular
+ to this plugin hook, if you modify the rules data structures in a
+ third-party plugin, all bets are off until such time that an API is
+ present for modifying that configuration data.
+
+ $plugin->signal_user_changed ( { options ... } )
+ Signals that the current user has changed for a new one.
+
+ username
+ The new user's username.
+
+ user_dir
+ The new user's home directory. (equivalent to "~".)
+
+ userstate_dir
+ The new user's storage directory. (equivalent to
+ "~/.spamassassin".)
+
+ $plugin->services_authorized_for_username ( { options ... } )
+ Validates that a given username is authorized to use certain
+ services.
+
+ In order to authorize a user, the plugin should first check that it
+ can handle any of the services passed into the method and then set
+ the value for each allowed service to true (or any non-negative
+ value).
+
+ The current supported services are: bayessql
+
+ username
+ A username
+
+ services
+ Reference to a hash containing the services you want to check.
+
+ {
+
+ 'bayessql' => 0
+
+ }
+
+ conf
+ The "Mail::SpamAssassin::Conf" object on which the configuration
+ data should be stored.
+
+ $plugin->compile_now_start ( { options ... } )
+ This is called at the beginning of Mail::SpamAssassin::compile_now()
+ so plugins can do any necessary initialization for multi-process
+ SpamAssassin (such as spamd or mass-check -j).
+
+ use_user_prefs
+ The value of $use_user_prefs option in compile_now().
+
+ keep_userstate
+ The value of $keep_userstate option in compile_now().
+
+ $plugin->compile_now_finish ( { options ... } )
+ This is called at the end of Mail::SpamAssassin::compile_now() so
+ plugins can do any necessary initialization for multi-process
+ SpamAssassin (such as spamd or mass-check -j).
+
+ use_user_prefs
+ The value of $use_user_prefs option in compile_now().
+
+ keep_userstate
+ The value of $keep_userstate option in compile_now().
+
+ $plugin->check_start ( { options ... } )
+ Signals that a message check operation is starting.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ Lifecycle note: it is recommended that rules that need to track
+ test state on a per-scan basis should store that state on this
+ object, not on the plugin object itself, since the plugin object
+ will be shared between all active scanners.
+
+ The message being scanned is accessible through the
+ "$permsgstatus->get_message()" API; there are a number of other
+ public APIs on that object, too. See
+ "Mail::SpamAssassin::PerMsgStatus" perldoc.
+
+ $plugin->check_main ( { options ... } )
+ Signals that a message should be checked. Note that implementations
+ of this hook should return 1.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ $plugin->check_tick ( { options ... } )
+ Called periodically during a message check operation. A callback set
+ for this method is a good place to run through an event loop dealing
+ with network events triggered in a "parse_metadata" method, for
+ example.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ $plugin->check_post_dnsbl ( { options ... } )
+ Called after the DNSBL results have been harvested. This is a good
+ place to harvest your own asynchronously-started network lookups.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ $plugin->check_post_learn ( { options ... } )
+ Called after auto-learning may (or may not) have taken place. If you
+ wish to perform additional learning, whether or not auto-learning
+ happens, this is the place to do it.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ $plugin->check_end ( { options ... } )
+ Signals that a message check operation has just finished, and the
+ results are about to be returned to the caller.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan. The current score, names of rules that hit, etc. can be
+ retrieved using the public APIs on this object.
+
+ $plugin->finish_tests ( { options ... } )
+ Called via "Mail::SpamAssassin::finish". This should clear up any
+ tests that a plugin has added to the namespace.
+
+ In certain circumstances, plugins may find it useful to compile perl
+ functions from the ruleset, on the fly. It is important to remove
+ these once the "Mail::SpamAssassin" object is deleted, however, and
+ this API allows this.
+
+ Each plugin is responsible for its own generated perl functions.
+
+ conf
+ The "Mail::SpamAssassin::Conf" object on which the configuration
+ data should be stored.
+
+ See also the "register_generated_rule_method" helper API, below.
+
+ $plugin->extract_metadata ( { options ... } )
+ Signals that a message is being mined for metadata. Some plugins may
+ wish to add their own metadata as well.
+
+ msg The "Mail::SpamAssassin::Message" object for this message.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ $plugin->parsed_metadata ( { options ... } )
+ Signals that a message's metadata has been parsed, and can now be
+ accessed by the plugin.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ $plugin->start_rules ( { options ... } )
+ Called before testing a set of rules of a given type and priority.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ ruletype
+ The type of the rules about to be performed.
+
+ priority
+ The priority level of the rules about to be performed.
+
+ $plugin->hit_rule ( { options ... } )
+ Called when a rule fires.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ ruletype
+ The type of the rule that fired.
+
+ rulename
+ The name of the rule that fired.
+
+ score
+ The rule's score in the active scoreset.
+
+ $plugin->ran_rule ( { options ... } )
+ Called after a rule has been tested, whether or not it fired. When
+ the rule fires, the hit_rule callback is always called before this.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ ruletype
+ The type of the rule that was tested.
+
+ rulename
+ The name of the rule that was tested.
+
+ $plugin->autolearn_discriminator ( { options ... } )
+ Control whether a just-scanned message should be learned as either
+ spam or ham. This method should return one of 1 to learn the message
+ as spam, 0 to learn as ham, or "undef" to not learn from the message
+ at all.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ $plugin->autolearn ( { options ... } )
+ Signals that a message is about to be auto-learned as either ham or
+ spam.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ isspam
+ 1 if the message is spam, 0 if ham.
+
+ $plugin->per_msg_finish ( { options ... } )
+ Signals that a "Mail::SpamAssassin::PerMsgStatus" object is being
+ destroyed, and any per-scan context held on that object by this
+ plugin should be destroyed as well.
+
+ Normally, any member variables on the "PerMsgStatus" object will be
+ cleaned up automatically -- but if your plugin has made a circular
+ reference on that object, this is the place to break them so that
+ garbage collection can operate correctly.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ $plugin->have_shortcircuited ( { options ... } )
+ Has the current scan operation 'short-circuited'? In other words,
+ can further scanning be skipped, since the message is already
+ definitively classified as either spam or ham?
+
+ Plugins should return 0 to indicate that scanning should continue,
+ or 1 to indicate that short-circuiting has taken effect.
+
+ permsgstatus
+ The "Mail::SpamAssassin::PerMsgStatus" context object for this
+ scan.
+
+ $plugin->bayes_learn ( { options ... } )
+ Called at the end of a bayes learn operation.
+
+ This phase is the best place to map the raw (original) token value
+ to the SHA1 hashed value.
+
+ toksref
+ Reference to hash returned by call to tokenize. The hash takes
+ the format of:
+
+ {
+ 'SHA1 Hash Value' => 'raw (original) value',
+ ...
+ }
+
+ NOTE: This data structure has changed since it was originally
+ introduced in version 3.0.0. The values are no longer perl
+ anonymous hashes, they are a single string containing the raw
+ token value. You can test for backward compatibility by checking
+ to see if the value for a key is a reference to a perl HASH, for
+ instance:
+
+ if (ref($toksref->{$sometokenkey}) eq 'HASH') {...
+
+ If it is, then you are using the old interface, otherwise you
+ are using the current interface.
+
+ isspam
+ Boolean value stating what flavor of message the tokens
+ represent, if true then message was specified as spam, false is
+ nonspam. Note, when function is scan then isspam value is not
+ valid.
+
+ msgid
+ Generated message id of the message just learned.
+
+ msgatime
+ Received date of the current message or current time if received
+ date could not be determined. In addition, if the receive date
+ is more than 24 hrs into the future it will be reset to current
+ datetime.
+
+ $plugin->bayes_forget ( { options ... } )
+ Called at the end of a bayes forget operation.
+
+ toksref
+ Reference to hash returned by call to tokenize. See bayes_learn
+ documentation for additional information on the format.
+
+ isspam
+ Boolean value stating what flavor of message the tokens
+ represent, if true then message was specified as spam, false is
+ nonspam. Note, when function is scan then isspam value is not
+ valid.
+
+ msgid
+ Generated message id of the message just forgotten.
+
+ $plugin->bayes_scan ( { options ... } )
+ Called at the end of a bayes scan operation. NOTE: Will not be
+ called in case of error or if the message is otherwise skipped.
+
+ toksref
+ Reference to hash returned by call to tokenize. See bayes_learn
+ documentation for additional information on the format.
+
+ probsref
+ Reference to hash of calculated probabilities for tokens found
+ in the database.
+
+ {
+ 'SHA1 Hash Value' => {
+ 'prob' => 'calculated probability',
+ 'spam_count' => 'Total number of spam msgs w/ token',
+ 'ham_count' => 'Total number of ham msgs w/ token',
+ 'atime' => 'Atime value for token in database'
+ }
+ }
+
+ score
+ Score calculated for this particular message.
+
+ msgatime
+ Calculated atime of the message just learned, note it may have
+ been adjusted if it was determined to be too far into the
+ future.
+
+ significant_tokens
+ Array ref of the tokens found to be significant in determining
+ the score for this message.
+
+ $plugin->plugin_report ( { options ... } )
+ Called if the message is to be reported as spam. If the reporting
+ system is available, the variable
+ "$options->{report}->report_available}" should be set to 1; if the
+ reporting system successfully reported the message, the variable
+ "$options->{report}->report_return}" should be set to 1.
+
+ report
+ Reference to the Reporter object ("$options->{report}" in the
+ paragraph above.)
+
+ text
+ Reference to a markup removed copy of the message in scalar
+ string format.
+
+ msg Reference to the original message object.
+
+ $plugin->plugin_revoke ( { options ... } )
+ Called if the message is to be reported as ham (revokes a spam
+ report). If the reporting system is available, the variable
+ "$options->{revoke}->revoke_available}" should be set to 1; if the
+ reporting system successfully revoked the message, the variable
+ "$options->{revoke}->revoke_return}" should be set to 1.
+
+ revoke
+ Reference to the Reporter object ("$options->{revoke}" in the
+ paragraph above.)
+
+ text
+ Reference to a markup removed copy of the message in scalar
+ string format.
+
+ msg Reference to the original message object.
+
+ $plugin->whitelist_address( { options ... } )
+ Called when a request is made to add an address to a persistent
+ address list.
+
+ address
+ Address you wish to add.
+
+ cli_p
+ Indicate if the call is being made from a command line
+ interface.
+
+ $plugin->blacklist_address( { options ... } )
+ Called when a request is made to add an address to a persistent
+ address list.
+
+ address
+ Address you wish to add.
+
+ cli_p
+ Indicate if the call is being made from a command line
+ interface.
+
+ $plugin->remove_address( { options ... } )
+ Called when a request is made to remove an address to a persistent
+ address list.
+
+ address
+ Address you wish to remove.
+
+ cli_p
+ Indicate if the call is being made from a command line
+ interface.
+
+ $plugin->spamd_child_init ()
+ Called in each new child process when it starts up under spamd.
+
+ $plugin->log_scan_result ( { options ... } )
+ Called when spamd has completed scanning a message. Currently, only
+ spamd calls this API.
+
+ result
+ The 'result: ...' line for this scan. Format is as described at
+ http://wiki.apache.org/spamassassin/SpamdSyslogFormat.
+
+ $plugin->spamd_child_post_connection_close ()
+ Called when child returns from handling a connection.
+
+ If there was an accept failure, the child will die and this code
+ will not be called.
+
+ $plugin->finish ()
+ Called when the "Mail::SpamAssassin" object is destroyed.
+
+ $plugin->learner_new ()
+ Used to support human-trained probabilistic classifiers like the
+ BAYES_* ruleset. Called when a new "Mail::SpamAssassin::Bayes"
+ object has been created; typically when a new user's scan is about
+ to start.
+
+ $plugin->learn_message ()
+ Train the classifier with a training message.
+
+ isspam
+ 1 if the message is spam, 0 if it's non-spam.
+
+ msg The message's "Mail::SpamAssassin::Message" object.
+
+ id An optional message-identification string, used internally to
+ tag the message. If it is "undef", one will be generated. It
+ should be unique to that message.
+
+ $plugin->forget_message ()
+ Tell the classifier to 'forget' its training about a specific
+ message.
+
+ msg The message's "Mail::SpamAssassin::Message" object.
+
+ id An optional message-identification string, used internally to
+ tag the message. If it is "undef", one will be generated. It
+ should be unique to that message.
+
+ $plugin->learner_sync ()
+ Tell the classifier to 'sync' any pending changes against the
+ current user's training database. This is called by "sa-learn
+ --sync".
+
+ If you do not need to implement these for your classifier, create an
+ implementation that just contains "return 1".
+
+ $plugin->learner_expire_old_training ()
+ Tell the classifier to perform infrequent, time-consuming cleanup of
+ the current user's training database. This is called by "sa-learn
+ --force-expire".
+
+ If you do not need to implement these for your classifier, create an
+ implementation that just contains "return 1".
+
+ $plugin->learner_is_scan_available ()
+ Should return 1 if it is possible to use the current user's training
+ data for a message-scan operation, or 0 otherwise.
+
+ $plugin->learner_dump_database ()
+ Dump information about the current user's training data to "stdout".
+ This is called by "sa-learn --dump".
+
+ magic
+ Set to 1 if "magic" name-value metadata should be dumped.
+
+ toks
+ Set to 1 if the database of tokens should be dumped.
+
+ regex
+ Either "undef" to dump all tokens, or a value which specifies a
+ regular expression subset of the tokens to dump.
+
+ $plugin->learner_close ()
+ Close any open databases.
+
+ quiet
+ Set to 1 if warning messages should be suppressed.
+
+HELPER APIS
+ These methods provide an API for plugins to register themselves to
+ receive specific events, or control the callback chain behaviour.
+
+ $plugin->register_eval_rule ($nameofevalsub)
+ Plugins that implement an eval test will need to call this, so that
+ SpamAssassin calls into the object when that eval test is
+ encountered. See the REGISTERING EVAL RULES section for full
+ details.
+
+ $plugin->register_generated_rule_method ($nameofsub)
+ In certain circumstances, plugins may find it useful to compile perl
+ functions from the ruleset, on the fly. It is important to remove
+ these once the "Mail::SpamAssassin" object is deleted, however, and
+ this API allows this.
+
+ Once the method $nameofsub has been generated, call this API with
+ the name of the method (including full package scope). This
+ indicates that it's a temporary piece of generated code, built from
+ the SpamAssassin ruleset, and when "Mail::SpamAssassin::finish()" is
+ called, the method will be destroyed.
+
+ This API was added in SpamAssassin 3.2.0.
+
+ $plugin->register_method_priority($methodname, $priority)
+ Indicate that the method named $methodname on the current object has
+ a callback priority of $priority.
+
+ This is used by the plugin handler to determine the relative order
+ of callbacks; plugins with lower-numbered priorities are called
+ before plugins with higher-numbered priorities. Each method can have
+ a different priority value. The default value is 0. The ordering of
+ callbacks to methods with equal priority is undefined.
+
+ Typically, you only need to worry about this if you need to ensure
+ your plugin's method is called before another plugin's
+ implementation of that method. It should be called from your
+ plugin's constructor.
+
+ This API was added in SpamAssassin 3.2.0.
+
+ $plugin->inhibit_further_callbacks()
+ Tells the plugin handler to inhibit calling into other plugins in
+ the plugin chain for the current callback. Frequently used when
+ parsing configuration settings using "parse_config()".
+
+LOGGING
+ Mail::SpamAssassin::Plugin::dbg($message)
+ Output a debugging message $message, if the SpamAssassin object is
+ running with debugging turned on.
+
+ *NOTE:* This function is not available in the package namespace of
+ general plugins and can't be called via $self->dbg(). If a plugin
+ wishes to output debug information, it should call
+ "Mail::SpamAssassin::Plugin::dbg($msg)".
+
+ Mail::SpamAssassin::Plugin::info($message)
+ Output an informational message $message, if the SpamAssassin object
+ is running with informational messages turned on.
+
+ *NOTE:* This function is not available in the package namespace of
+ general plugins and can't be called via $self->info(). If a plugin
+ wishes to output debug information, it should call
+ "Mail::SpamAssassin::Plugin::info($msg)".
+
+ In general, it is better for plugins to use the
+ "Mail::SpamAssassin::Logger" module to import "dbg" and "info"
+ directly, like so:
+
+ use Mail::SpamAssassin::Logger;
+ dbg("some message");
+ info("some other message");
+
+REGISTERING EVAL RULES
+ Plugins that implement an eval test must register the methods that can
+ be called from rules in the configuration files, in the plugin class'
+ constructor.
+
+ For example,
+
+ $plugin->register_eval_rule ('check_for_foo')
+
+ will cause "$plugin->check_for_foo()" to be called for this SpamAssassin
+ rule:
+
+ header FOO_RULE eval:check_for_foo()
+
+ Note that eval rules are passed the following arguments:
+
+ - The plugin object itself
+ - The "Mail::SpamAssassin::PerMsgStatus" object calling the rule
+ - standard arguments for the rule type in use
+ - any and all arguments as specified in the configuration file
+
+ In other words, the eval test method should look something like this:
+
+ sub check_for_foo {
+ my ($self, $permsgstatus, ...arguments...) = @_;
+ ...code returning 0 or 1
+ }
+
+ Note that the headers can be accessed using the "get()" method on the
+ "Mail::SpamAssassin::PerMsgStatus" object, and the body by
+ "get_decoded_stripped_body_text_array()" and other similar methods.
+ Similarly, the "Mail::SpamAssassin::Conf" object holding the current
+ configuration may be accessed through "$permsgstatus->{main}->{conf}".
+
+ The eval rule should return 1 for a hit, or 0 if the rule is not hit.
+
+ State for a single message being scanned should be stored on the
+ $permsgstatus object, not on the $self object, since $self persists
+ between scan operations. See the 'lifecycle note' on the "check_start()"
+ method above.
+
+STANDARD ARGUMENTS FOR RULE TYPES
+ Plugins will be called with the same arguments as a standard EvalTest.
+ Different rule types receive different information by default:
+
+ - header tests: no extra arguments
+ - body tests: fully rendered message as array reference
+ - rawbody tests: fully decoded message as array reference
+ - full tests: pristine message as scalar reference
+
+ The configuration file arguments will be passed in after the standard
+ arguments.
+
+BACKWARD COMPATIBILITY
+ Note that if you write a plugin and need to determine if a particular
+ helper method is supported on "Mail::SpamAssassin::Plugin", you can do
+ this:
+
+ if ($self->can("name_of_method")) {
+ eval {
+ $self->name_of_method(); # etc.
+ }
+ } else {
+ # take fallback action
+ }
+
+ The same applies for the public APIs on objects of other types, such as
+ "Mail::SpamAssassin::PerMsgStatus".
+
+SEE ALSO
+ Mail::SpamAssassin(3)
+
+ Mail::SpamAssassin::PerMsgStatus(3)
+
+ http://wiki.apache.org/spamassassin/PluginWritingTips
+
+ http://issues.apache.org/SpamAssassin/show_bug.cgi?id=2163
+

Added: spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_PluginHandler.html
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_PluginHandler.html?rev=1871201&view=auto
==============================================================================
--- spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_PluginHandler.html (added)
+++ spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_PluginHandler.html Wed Dec 11 22:18:49 2019
@@ -0,0 +1,27 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title></title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+
+
+<ul id="index">
+ <li><a href="#NAME">NAME</a></li>
+</ul>
+
+<h1 id="NAME">NAME</h1>
+
+<p>Mail::SpamAssassin::PluginHandler - SpamAssassin plugin handler</p>
+
+
+</body>
+
+</html>
+
+

Added: spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_PluginHandler.txt
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_PluginHandler.txt?rev=1871201&view=auto
==============================================================================
--- spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_PluginHandler.txt (added)
+++ spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_PluginHandler.txt Wed Dec 11 22:18:49 2019
@@ -0,0 +1,3 @@
+NAME
+ Mail::SpamAssassin::PluginHandler - SpamAssassin plugin handler
+

Added: spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin_ASN.html
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin_ASN.html?rev=1871201&view=auto
==============================================================================
--- spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin_ASN.html (added)
+++ spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin_ASN.html Wed Dec 11 22:18:49 2019
@@ -0,0 +1,126 @@
+<?xml version="1.0" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title></title>
+<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+<link rev="made" href="mailto:root@localhost" />
+</head>
+
+<body style="background-color: white">
+
+
+
+<ul id="index">
+ <li><a href="#NAME">NAME</a></li>
+ <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
+ <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
+ <li><a href="#TEMPLATE-TAGS">TEMPLATE TAGS</a></li>
+ <li><a href="#CONFIGURATION">CONFIGURATION</a></li>
+ <li><a href="#SEE-ALSO">SEE ALSO</a></li>
+ <li><a href="#STATUS">STATUS</a></li>
+ <li><a href="#ADMINISTRATOR-SETTINGS">ADMINISTRATOR SETTINGS</a></li>
+</ul>
+
+<h1 id="NAME">NAME</h1>
+
+<p>Mail::SpamAssassin::Plugin::ASN - SpamAssassin plugin to look up the Autonomous System Number (ASN) of the connecting IP address.</p>
+
+<h1 id="SYNOPSIS">SYNOPSIS</h1>
+
+<pre><code> loadplugin Mail::SpamAssassin::Plugin::ASN
+
+ asn_lookup asn.routeviews.org _ASN_ _ASNCIDR_
+
+ asn_lookup_ipv6 origin6.asn.cymru.com _ASN_ _ASNCIDR_
+
+ add_header all ASN _ASN_ _ASNCIDR_
+
+ header TEST_AS1234 X-ASN =~ /^1234$/</code></pre>
+
+<h1 id="DESCRIPTION">DESCRIPTION</h1>
+
+<p>This plugin uses DNS lookups to the services of an external DNS zone such as at <code>http://www.routeviews.org/</code> to do the actual work. Please make sure that your use of the plugin does not overload their infrastructure - this generally means that <b>you should not use this plugin in a high-volume environment</b> or that you should use a local mirror of the zone (see <code>ftp://ftp.routeviews.org/dnszones/</code>). Other similar zones may also be used.</p>
+
+<h1 id="TEMPLATE-TAGS">TEMPLATE TAGS</h1>
+
+<p>This plugin allows you to create template tags containing the connecting IP&#39;s AS number and route info for that AS number.</p>
+
+<p>The default config will add a header field that looks like this:</p>
+
+<pre><code> X-Spam-ASN: AS24940 213.239.192.0/18</code></pre>
+
+<p>where &quot;24940&quot; is the ASN and &quot;213.239.192.0/18&quot; is the route announced by that ASN where the connecting IP address came from. If the AS announces multiple networks (more/less specific), they will all be added to the <code>_ASNCIDR_</code> tag, separated by spaces, eg:</p>
+
+<pre><code> X-Spam-ASN: AS1680 89.138.0.0/15 89.139.0.0/16</code></pre>
+
+<p>Note that the literal &quot;AS&quot; before the ASN in the _ASN_ tag is configurable through the <i>asn_prefix</i> directive and may be set to an empty string.</p>
+
+<h1 id="CONFIGURATION">CONFIGURATION</h1>
+
+<p>The standard ruleset contains a configuration that will add a header field containing ASN data to scanned messages. The bayes tokenizer will use the added header field for bayes calculations, and thus affect which BAYES_* rule will trigger for a particular message.</p>
+
+<p><b>Note</b> that in most cases you should not score on the ASN data directly. Bayes learning will probably trigger on the _ASNCIDR_ tag, but probably not very well on the _ASN_ tag alone.</p>
+
+<h1 id="SEE-ALSO">SEE ALSO</h1>
+
+<p>http://www.routeviews.org/ - all data regarding routing, ASNs, etc....</p>
+
+<p>http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4770 - SpamAssassin Issue #4770 concerning this plugin</p>
+
+<h1 id="STATUS">STATUS</h1>
+
+<p>No in-depth analysis of the usefulness of bayes tokenization of ASN data has been performed.</p>
+
+<h1 id="ADMINISTRATOR-SETTINGS">ADMINISTRATOR SETTINGS</h1>
+
+<dl>
+
+<dt id="asn_lookup-asn-zone.example.com-_ASNTAG_-_ASNCIDRTAG_">asn_lookup asn-zone.example.com [ _ASNTAG_ _ASNCIDRTAG_ ]</dt>
+<dd>
+
+<p>Use this to lookup the ASN info in the specified zone for the first external IPv4 address and add the AS number to the first specified tag and routing info to the second specified tag.</p>
+
+<p>If no tags are specified the AS number will be added to the _ASN_ tag and the routing info will be added to the _ASNCIDR_ tag. You must specify either none or both of the tag names. Tag names must start and end with an underscore.</p>
+
+<p>If two or more <i>asn_lookup</i>s use the same set of template tags, the results of their lookups will be appended to each other in the template tag values in no particular order. Duplicate results will be omitted when combining results. In a similar fashion, you can also use the same template tag for both the AS number tag and the routing info tag.</p>
+
+<p>Examples:</p>
+
+<pre><code> asn_lookup asn.routeviews.org
+
+ asn_lookup asn.routeviews.org _ASN_ _ASNCIDR_
+ asn_lookup myview.example.com _MYASN_ _MYASNCIDR_
+
+ asn_lookup asn.routeviews.org _COMBINEDASN_ _COMBINEDASNCIDR_
+ asn_lookup myview.example.com _COMBINEDASN_ _COMBINEDASNCIDR_
+
+ asn_lookup in1tag.example.net _ASNDATA_ _ASNDATA_</code></pre>
+
+</dd>
+<dt id="asn_lookup_ipv6-asn-zone6.example.com-_ASN_-_ASNCIDR_">asn_lookup_ipv6 asn-zone6.example.com [_ASN_ _ASNCIDR_]</dt>
+<dd>
+
+<p>Use specified zone for lookups of IPv6 addresses. If zone supports both IPv4 and IPv6 queries, use both asn_lookup and asn_lookup_ipv6 for the same zone.</p>
+
+</dd>
+<dt id="clear_asn_lookups">clear_asn_lookups</dt>
+<dd>
+
+<p>Removes any previously declared <i>asn_lookup</i> entries from a list of queries.</p>
+
+</dd>
+<dt id="asn_prefix-prefix_string-default:-AS">asn_prefix &#39;prefix_string&#39; (default: &#39;AS&#39;)</dt>
+<dd>
+
+<p>The string specified in the argument is prepended to each ASN when storing it as a tag. This prefix is rather redundant, but its default value &#39;AS&#39; is kept for backward compatibility with versions of SpamAssassin earlier than 3.4.0. A sensible setting is an empty string. The argument may be (but need not be) enclosed in single or double quotes for clarity.</p>
+
+</dd>
+</dl>
+
+
+</body>
+
+</html>
+
+

Added: spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin_ASN.txt
URL: http://svn.apache.org/viewvc/spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin_ASN.txt?rev=1871201&view=auto
==============================================================================
--- spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin_ASN.txt (added)
+++ spamassassin/site/full/3.4.x/doc/Mail_SpamAssassin_Plugin_ASN.txt Wed Dec 11 22:18:49 2019
@@ -0,0 +1,110 @@
+NAME
+ Mail::SpamAssassin::Plugin::ASN - SpamAssassin plugin to look up the
+ Autonomous System Number (ASN) of the connecting IP address.
+
+SYNOPSIS
+ loadplugin Mail::SpamAssassin::Plugin::ASN
+
+ asn_lookup asn.routeviews.org _ASN_ _ASNCIDR_
+
+ asn_lookup_ipv6 origin6.asn.cymru.com _ASN_ _ASNCIDR_
+
+ add_header all ASN _ASN_ _ASNCIDR_
+
+ header TEST_AS1234 X-ASN =~ /^1234$/
+
+DESCRIPTION
+ This plugin uses DNS lookups to the services of an external DNS zone
+ such as at "http://www.routeviews.org/" to do the actual work. Please
+ make sure that your use of the plugin does not overload their
+ infrastructure - this generally means that you should not use this
+ plugin in a high-volume environment or that you should use a local
+ mirror of the zone (see "ftp://ftp.routeviews.org/dnszones/"). Other
+ similar zones may also be used.
+
+TEMPLATE TAGS
+ This plugin allows you to create template tags containing the connecting
+ IP's AS number and route info for that AS number.
+
+ The default config will add a header field that looks like this:
+
+ X-Spam-ASN: AS24940 213.239.192.0/18
+
+ where "24940" is the ASN and "213.239.192.0/18" is the route announced
+ by that ASN where the connecting IP address came from. If the AS
+ announces multiple networks (more/less specific), they will all be added
+ to the "_ASNCIDR_" tag, separated by spaces, eg:
+
+ X-Spam-ASN: AS1680 89.138.0.0/15 89.139.0.0/16
+
+ Note that the literal "AS" before the ASN in the _ASN_ tag is
+ configurable through the *asn_prefix* directive and may be set to an
+ empty string.
+
+CONFIGURATION
+ The standard ruleset contains a configuration that will add a header
+ field containing ASN data to scanned messages. The bayes tokenizer will
+ use the added header field for bayes calculations, and thus affect which
+ BAYES_* rule will trigger for a particular message.
+
+ Note that in most cases you should not score on the ASN data directly.
+ Bayes learning will probably trigger on the _ASNCIDR_ tag, but probably
+ not very well on the _ASN_ tag alone.
+
+SEE ALSO
+ http://www.routeviews.org/ - all data regarding routing, ASNs, etc....
+
+ http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4770 -
+ SpamAssassin Issue #4770 concerning this plugin
+
+STATUS
+ No in-depth analysis of the usefulness of bayes tokenization of ASN data
+ has been performed.
+
+ADMINISTRATOR SETTINGS
+ asn_lookup asn-zone.example.com [ _ASNTAG_ _ASNCIDRTAG_ ]
+ Use this to lookup the ASN info in the specified zone for the first
+ external IPv4 address and add the AS number to the first specified
+ tag and routing info to the second specified tag.
+
+ If no tags are specified the AS number will be added to the _ASN_
+ tag and the routing info will be added to the _ASNCIDR_ tag. You
+ must specify either none or both of the tag names. Tag names must
+ start and end with an underscore.
+
+ If two or more *asn_lookup*s use the same set of template tags, the
+ results of their lookups will be appended to each other in the
+ template tag values in no particular order. Duplicate results will
+ be omitted when combining results. In a similar fashion, you can
+ also use the same template tag for both the AS number tag and the
+ routing info tag.
+
+ Examples:
+
+ asn_lookup asn.routeviews.org
+
+ asn_lookup asn.routeviews.org _ASN_ _ASNCIDR_
+ asn_lookup myview.example.com _MYASN_ _MYASNCIDR_
+
+ asn_lookup asn.routeviews.org _COMBINEDASN_ _COMBINEDASNCIDR_
+ asn_lookup myview.example.com _COMBINEDASN_ _COMBINEDASNCIDR_
+
+ asn_lookup in1tag.example.net _ASNDATA_ _ASNDATA_
+
+ asn_lookup_ipv6 asn-zone6.example.com [_ASN_ _ASNCIDR_]
+ Use specified zone for lookups of IPv6 addresses. If zone supports
+ both IPv4 and IPv6 queries, use both asn_lookup and asn_lookup_ipv6
+ for the same zone.
+
+ clear_asn_lookups
+ Removes any previously declared *asn_lookup* entries from a list of
+ queries.
+
+ asn_prefix 'prefix_string' (default: 'AS')
+ The string specified in the argument is prepended to each ASN when
+ storing it as a tag. This prefix is rather redundant, but its
+ default value 'AS' is kept for backward compatibility with versions
+ of SpamAssassin earlier than 3.4.0. A sensible setting is an empty
+ string. The argument may be (but need not be) enclosed in single or
+ double quotes for clarity.
+