You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by qu...@apache.org on 2005/08/14 04:14:51 UTC

svn commit: r232569 - in /spamassassin/trunk/lib/Mail: SpamAssassin.pm SpamAssassin/Plugin.pm

Author: quinlan
Date: Sat Aug 13 19:14:49 2005
New Revision: 232569

URL: http://svn.apache.org/viewcvs?rev=232569&view=rev
Log:
add two compile_now plugin hooks

the compile_start_finish hook will definitely be needed when Bayes is
turned into a plugin so the Bayes hash can be untied before the children
are forked (and it is generally useful or I wouldn't be adding it here)

note that this is low impact since it is only called when starting a
multi-process spamd or mass-check -j

Modified:
    spamassassin/trunk/lib/Mail/SpamAssassin.pm
    spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm

Modified: spamassassin/trunk/lib/Mail/SpamAssassin.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin.pm?rev=232569&r1=232568&r2=232569&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin.pm Sat Aug 13 19:14:49 2005
@@ -1124,6 +1124,11 @@
 sub compile_now {
   my ($self, $use_user_prefs, $deal_with_userstate) = @_;
 
+  # tell plugins we are here
+  $self->call_plugins("compile_now_start",
+		      { use_user_prefs => $use_user_prefs,
+			keep_userstate => $deal_with_userstate});
+
   # note: this may incur network access. Good.  We want to make sure
   # as much as possible is preloaded!
   my @testmsg = ("From: ignore\@compiling.spamassassin.taint.org\n", 
@@ -1180,7 +1185,11 @@
     }
   }
 
+  # make sure things are ready for scanning
   $self->{bayes_scanner}->sanity_check_is_untied();
+  $self->call_plugins("compile_now_finish",
+		      { use_user_prefs => $use_user_prefs,
+			keep_userstate => $deal_with_userstate});
 
   # Reset any non-default values to the post-init() version.
   while(my($k,$v) = each %backup) {

Modified: spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm
URL: http://svn.apache.org/viewcvs/spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm?rev=232569&r1=232568&r2=232569&view=diff
==============================================================================
--- spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm (original)
+++ spamassassin/trunk/lib/Mail/SpamAssassin/Plugin.pm Sat Aug 13 19:14:49 2005
@@ -272,6 +272,42 @@
 
 =back
 
+=item $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).
+
+=over 4
+
+=item use_user_prefs
+
+The value of $use_user_prefs option in compile_now().
+
+=item keep_userstate
+
+The value of $keep_userstate option in compile_now().
+
+=back
+
+=item $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).
+
+=over 4
+
+=item use_user_prefs
+
+The value of $use_user_prefs option in compile_now().
+
+=item keep_userstate
+
+The value of $keep_userstate option in compile_now().
+
+=back
+
 =item $plugin->check_start ( { options ... } )
 
 Signals that a message check operation is starting.