[prev] [thread] [next] [lurker] [Date index for 2003/08/11]
Author: richardc Date: 2003-08-11 10:24:32 +0100 (Mon, 11 Aug 2003) New Revision: 1306 Modified: trunk/siesta/bin/nacho trunk/siesta/lib/Siesta/Plugin/Archive.pm Log: make archive->path a property of Plugin::Archive Modified: trunk/siesta/bin/nacho =================================================================== --- trunk/siesta/bin/nacho 2003-08-11 09:23:11 UTC (rev 1305) +++ trunk/siesta/bin/nacho 2003-08-11 09:24:32 UTC (rev 1306) @@ -621,29 +621,29 @@ $commands{'show-deferred'} = sub { - my $user_id = shift || die "You must pass a user name\n"; - my $mess_id = shift; + my $user_id = shift || die "You must pass a user name\n"; + my $mess_id = shift; - my $user = Siesta::Member->load($user_id) - or die "No such user $user_id\n"; + my $user = Siesta::Member->load($user_id) + or die "No such user $user_id\n"; - if (defined $mess_id) { + if (defined $mess_id) { - my $deferred = Siesta::Deferred->search( who => $user, id => $mess_id ); - if (defined $deferred) { - print $deferred->message->as_string; - } else { - print "No such deferred message\n"; - } - - } else { - - foreach my $deferred (Siesta::Deferred->search( who => $user )) - { - print $deferred->id(),") ",$deferred->message->subject(),"\n"; - } - } + my $deferred = Siesta::Deferred->search( who => $user, id => $mess_id ); + if (defined $deferred) { + print $deferred->message->as_string; + } else { + print "No such deferred message\n"; + } + } else { + + foreach my $deferred (Siesta::Deferred->search( who => $user )) + { + print $deferred->id(),") ",$deferred->message->subject(),"\n"; + } + } + }; @@ -659,13 +659,13 @@ my $mess_id = shift; - my $message = Siesta::Deferred->retrieve($mess_id) - or die "No such deferred message\n"; + my $message = Siesta::Deferred->retrieve($mess_id) + or die "No such deferred message\n"; return unless $user_id == $message->who; Siesta::Message->resume( $message->id ); - print "Sucessfully resumed message $mess_id\n"; + print "Sucessfully resumed message $mess_id\n"; }; @@ -685,12 +685,13 @@ =cut $commands{'run-mariachi'} = sub { - for my $list ( map { $_->name } Siesta::List->retrieve_all ) { - my $input = $Siesta::Config::ARCHIVE . "/$list"; - my $output = $Siesta::Config::ROOT . "/mariachi-html/$list"; - mkpath($output); - print "invoking mariachi for $list\n"; - system 'mariachi', '-i', $input, '-o', $output, '-n', $list; + for my $archive (Siesta::Plugin->search( name => 'Archive' )) { + $archive = $archive->promote; + my $input = $archive->pref('path'); + my $name = $archive->list->name; + my $output = $Siesta::Config::ROOT . "/mariachi-html/$name"; + print "invoking mariachi for $name\n"; + system 'mariachi', '-i', $input, '-o', $output, '-n', $name; } }; Modified: trunk/siesta/lib/Siesta/Plugin/Archive.pm =================================================================== --- trunk/siesta/lib/Siesta/Plugin/Archive.pm 2003-08-11 09:23:11 UTC (rev 1305) +++ trunk/siesta/lib/Siesta/Plugin/Archive.pm 2003-08-11 09:24:32 UTC (rev 1306) @@ -7,18 +7,30 @@ use Email::LocalDelivery; sub description { - "save messages to maildirs"; + "save a copy of the message to an archive." } sub process { my $self = shift; my $mail = shift; - my $name = $self->list->name; - my $path = "$Siesta::Config::ARCHIVE/$name/"; + my $path = $self->pref('path'); Email::LocalDelivery->deliver( $mail->as_string, $path ) or die "local delivery into '$path' failed"; return; } +sub options { + my $self = shift; + my $name = $self->list->name; + + +{ + path => { + description => "where to drop the archives", + type => "string", + default => "$Siesta::Config::ARCHIVE/$name/", + }, + }; +} + 1;
Generated at 13:57 on 01 Jul 2004 by mariachi 0.52