/[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 69 by dpavlin, Tue Aug 2 18:28:57 2005 UTC revision 72 by dpavlin, Mon Aug 22 20:24:04 2005 UTC
# Line 2  Line 2 
2    
3  use strict;  use strict;
4  use blib;  use blib;
5  use Nos;  use Nos 0.7;
6  use Getopt::Long;  use Getopt::Long;
7    
8  =head1 NAME  =head1 NAME
# Line 11  sender.pl - command line notify sender u Line 11  sender.pl - command line notify sender u
11    
12  =head1 SYNOPSYS  =head1 SYNOPSYS
13    
14   sender.pl --new=mylist   sender.pl --create=mylist
15     sender.pl --drop=mylist
16   sender.pl --add=mylist members.txt   sender.pl --add=mylist members.txt
17   sender.pl --delete=mylist members.txt   sender.pl --delete=mylist members.txt
18   sender.pl --list[=mylist]   sender.pl --list[=mylist]
# Line 33  my $verbose = 0; Line 34  my $verbose = 0;
34  my $opt;  my $opt;
35    
36  my $result = GetOptions(  my $result = GetOptions(
37          "new=s" => \$opt->{'new'},          "create=s" => \$opt->{'create'},
38            "drop=s" => \$opt->{'drop'},
39          "list:s" => \$opt->{'list'},          "list:s" => \$opt->{'list'},
40          "add=s" => \$opt->{'add'},          "add=s" => \$opt->{'add'},
41          "delete=s" => \$opt->{'delete'},          "delete=s" => \$opt->{'delete'},
# Line 74  $queue->set_sql( list_queue => qq{ Line 76  $queue->set_sql( list_queue => qq{
76    
77  my $list_name;  my $list_name;
78    
79    =item --aliases=/full/path/to/aliases
80    
81  =item --new=list_name my-list@example.com  Optional parametar C<--aliases> can be used to specify aliases file other
82    than default C</etc/aliases>.
83    
84    =cut
85    
86    my $aliases = $opt->{'aliases'} || '/etc/aliases';
87    
88    
89    =item --create=list_name my-list@example.com
90    
91  Adds new list. You can also feed list name as first line to C<STDIN>.  Adds new list. You can also feed list name as first line to C<STDIN>.
92    
93  You can also add C<--from='Full name of list'> to specify full name (comment)  You can also add C<--from='Full name of list'> to specify full name (comment)
94  in outgoing e-mail.  in outgoing e-mail.
95    
 Optional parametar C<--aliases='/full/path/to/aliases'> can be used to  
 specify aliases file other than C</etc/aliases>.  
   
96  =cut  =cut
97    
98  if ($list_name = $opt->{'new'}) {  if ($list_name = $opt->{'create'}) {
99    
100          my $email = shift @ARGV || <>;          my $email = shift @ARGV || <>;
101          chomp($email);          chomp($email);
102    
103          die "need e-mail address for list (as argument or on STDIN)\n" unless ($email);          die "need e-mail address for list (as argument or on STDIN)\n" unless ($email);
104    
105          my $aliases = $opt->{'aliases'} || '/etc/aliases';          my $id = $nos->create_list(
   
         my $id = $nos->new_list(  
106                  list => $list_name,                  list => $list_name,
107                  from => ($opt->{'from'} || ''),                  from => ($opt->{'from'} || ''),
108                  email => $email,                  email => $email,
# Line 106  if ($list_name = $opt->{'new'}) { Line 112  if ($list_name = $opt->{'new'}) {
112          print "added list $list_name with ID $id\n";          print "added list $list_name with ID $id\n";
113    
114    
115    =item --drop=list_name
116    
117    Remove list.
118    
119    Optional parametar C<--aliases='/full/path/to/aliases'> can be used to
120    specify aliases file other than C</etc/aliases>.
121    
122    =cut
123    
124    } elsif ($list_name = $opt->{'drop'}) {
125    
126            my $id = $nos->drop_list(
127                    list => $list_name,
128                    aliases => $aliases,
129            ) || die "can't remove list $list_name\n";
130    
131            print "drop list $list_name with ID $id\n";
132    
133    
134  =item --list[=list_name]  =item --list[=list_name]
135    
136  List all available lists and users on them.  List all available lists and users on them.

Legend:
Removed from v.69  
changed lines
  Added in v.72

  ViewVC Help
Powered by ViewVC 1.1.26