[prev] [thread] [next] [lurker] [Date index for 2004/04/08]
On Mon, Apr 05, 2004 at 07:29:26PM +0100, Richard Clamp said: > I imagine we can refactor and wrap the make a digest code out, so then > we write something small like: > > # send_daily_digests > use Siesta; > for my $digest ( Siesta::Plugin->search(name => "Digest") ) { > my @send_to = grep { > $digest->member($_); > $digest->pref( 'digest' ); > } $digest->list->members; > # ... send > } And, of course, it's the '# ... send' bit that's tricky. Or at least tricky to get right if I understand it correctly. Basically we want to restart the pipeline with all the plugins after +Digest. It basically boils down to the same problem as a Deferred message which makes me wonder if we could leverage that. The other option is to make send something like (untested) for my $digest ( Siesta::Plugin->search(name => "Digest") ) { $digest->send_to($digest->make_digest()); # nuke the digest store # ... # NOTE: this should be all be rafactored in the Digest plugin my $list = Siesta::List->load( $digest->list ); my @plugins = $list->plugins( $action ); # get rid of all plugins except those before +Digest while (1) { my $plugin = shift; last if ($plugin->name eq 'Digest' && $plugin->personal); } # would one need to replace the first plugin? # $plugins[0] = $digest; $mail->plugins( [ @plugins] ); $mail->process; }There's stuff above here
Generated at 13:56 on 01 Jul 2004 by mariachi 0.52