Re: [siesta-dev] First cut at digests

[prev] [thread] [next] [lurker] [Date index for 2004/04/05]

From: Richard Clamp
Subject: Re: [siesta-dev] First cut at digests
Date: 19:29 on 05 Apr 2004
On Mon, Apr 05, 2004 at 06:54:03PM +0100, Simon Wistow wrote:
> Bit icky but it's a stab
> 
> Simon


> Index: lib/Siesta/Plugin/Digest.pm
> +# TODO do this on a time basis?

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
}


As either a nacho component, or in a module somewhere.


> +            # we should probably lock this
> +            if (-f $path) {
> +                unlink($path) || die "Couldn't unlink '$path'\n";
> +            } else { 
> +                chdir($path)  || die "Couldn't chdir to '$path'\n";
> +                unlink(<*>)   || die "Couldn't unlink '$path/*'\n";
> +            }

Urgh.  Let's just always use an mbox for this - it preserves the
arrival order, and is easier to clean up.


> +# get the number of digests and the body of the digest
> +sub get_digest {
> +}

This does too much work, and I'd sooner just use something like
MIME::Lite so we can send the digested messages as a set of
message/rfc-822 chunks (hidden surprise toy - people with suitable
MUAs can reply to just the message they meant and appear in the right
place in the thread).


> +sub options {
> +    my $self = shift;
> +    my $name = $self->list->name;
> +    +{
> +        path => {
> +            description => "where to spool the digest",
> +            type        => "string",
> +            default     => "$Siesta::Config::DIGEST/$name/",
> +        },
> +        messages => {
> +            description => "how many messages to spool before sending the digest",
> +            type        => "number",
> +            default     => "20",
> +        }        
> +    };
> +}


Okay, one small problem - where does the user get to say "I want this
digested".  Also did we invent a way for listadmin and user prefs to
co-exist yet?  I disremember, but it seems pretty vital for here.


Asides from those comments, I'd say it looks pretty much there.

-- 
Richard Clamp <richardc@xxxxxxxxx.xxx>

Generated at 13:56 on 01 Jul 2004 by mariachi 0.52