/[notice-sender]/trunk/sender.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/sender.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8 by dpavlin, Sat May 14 13:12:00 2005 UTC revision 12 by dpavlin, Sat May 14 18:23:26 2005 UTC
# Line 12  sender.pl - command line notify sender u Line 12  sender.pl - command line notify sender u
12  =head1 SYNOPSYS  =head1 SYNOPSYS
13    
14   sender.pl --add=mylist members.txt   sender.pl --add=mylist members.txt
15   sender.pl --list   sender.pl --list[=mylist]
16   sender.pl --queue=mylist message.txt   sender.pl --queue=mylist message.txt
17   sender.pl --send=mylist   sender.pl --send=mylist
18    
# Line 26  Turn on debugging output from C<Class::D Line 26  Turn on debugging output from C<Class::D
26    
27  =cut  =cut
28    
29  my ($list_opt,$debug) = (0,0);  my $debug = 0;
30    my $list_opt;
31  my $add_opt;  my $add_opt;
32  my $queue_opt;  my $queue_opt;
33    
34  my $result = GetOptions(  my $result = GetOptions(
35          "list"  => \$list_opt,          "list:s" => \$list_opt,
36          "add=s" => \$add_opt,          "add=s" => \$add_opt,
37          "queue=s" => \$queue_opt,          "queue=s" => \$queue_opt,
38          "debug" => \$debug,          "debug" => \$debug,
# Line 53  my $lists = $loader->find_class('lists') Line 54  my $lists = $loader->find_class('lists')
54  my $users = $loader->find_class('users');  my $users = $loader->find_class('users');
55  my $user_list = $loader->find_class('user_list');  my $user_list = $loader->find_class('user_list');
56  my $messages = $loader->find_class('messages');  my $messages = $loader->find_class('messages');
57  my $message_list = $loader->find_class('message_list');  my $queue = $loader->find_class('queue');
58    
59  =item --list  =item --list[=list_name]
60    
61  List all available lists and users on them  List all available lists and users on them. Optional value is name of list
62    and it will produce users just on that list.
63    
64  =cut  =cut
65    
66  if ($list_opt) {  if (defined($list_opt)) {
67          foreach my $list ($lists->retrieve_all) {          my @lists;
68            if ($list_opt ne '') {
69                    @lists = $lists->search( name=> $list_opt )->first || die "can't find list $list_opt";
70            } else {
71                    @lists = $lists->retrieve_all;
72            }
73    
74            foreach my $list (@lists) {
75                  print $list->name,"\n";                  print $list->name,"\n";
76                  foreach my $user_on_list ($user_list->search(list_id => $list->id)) {                  foreach my $user_on_list ($user_list->search(list_id => $list->id)) {
77                          my $user = $users->retrieve( id => $user_on_list->user_id );                          my $user = $users->retrieve( id => $user_on_list->user_id );
# Line 136  argument) or read from C<STDIN>. Line 145  argument) or read from C<STDIN>.
145    
146          $this_message->dbi_commit();          $this_message->dbi_commit();
147    
148          $message_list->find_or_create({          $queue->find_or_create({
149                  message_id => $this_message->id,                  message_id => $this_message->id,
150                  list_id => $this_list->id,                  list_id => $this_list->id,
151          }) || die "can't add message ",$this_message->id," to list ",$this_list->id, ": ",$this_list->name;          }) || die "can't add message ",$this_message->id," to list ",$this_list->id, ": ",$this_list->name;

Legend:
Removed from v.8  
changed lines
  Added in v.12

  ViewVC Help
Powered by ViewVC 1.1.26