Dave Brondsema writes: > Justin Mason wrote: > > Dave Brondsema writes: > >> I'm working on a plugin and need some advice for hooks. > >> $plugin->check_post_dnsbl says "This is a good place to harvest your own > >> asynchronously-started network lookups". I'm using > >> Mail::SpamAssassin::Plugin::Karmasphere as a reference, and it uses > >> parsed_metadata() and check_post_dnsbl() to start and retrieve some > >> network queries. My plugin will do something very similar, but it > >> relies on another plugin running first and it needs to only do the query > >> if the first plugin sets a certain field on permsgstatus. My problem is > >> that the first plugin has not run when my parsed_metadata() executes, so > >> I'm not sure the best place to initiate my network query. Any suggestions? > > > > In SpamAssassin 3.2.x, you can use register_method_priority() to set > > the second plugin to always run after the first one (if it's loaded): > > > > > > =item $plugin->register_method_priority($methodname, $priority) > > > > Indicate that the method named C<$methodname> on the current object > > has a callback priority of C<$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 C<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. > > > > > > > > Does that do the trick? > > > > That definitely helps, I will have to look in to that. Currently, I'm > ordering the plugins by the naming of the config files that have the > eval rules (26_openpgp.cf and 61_konfidi.cf). And the first plugin only > has eval rules, it doesn't implement any hook methods. > > Is there source or docs for a main lifecycle method that goes through > all the plugins and the hooks, so I can understand the main phases used > to handle each email? I haven't been able to find one yet.
no -- good point, there should be. I've added an RFE at bug 5581. http://issues.apache.org/SpamAssassin/show_bug.cgi?id=5581 --j.
