4 @lists = &list_lists($conf);
6 # useradmin_create_user(&details)
7 # Add a user to the mailing list
8 sub useradmin_create_user
11 if ($config{"sync_$l"}) {
12 local $dom = $config{"shost_$l"};
13 $dom = &get_system_hostname() if (!$dom);
14 local $list = &get_list($l, $conf);
15 local $pass = &find_value("admin_passwd",
16 &get_list_config($list->{'config'}));
17 &lock_file($list->{'members'});
18 open(WRAPPER, "|$config{'program_dir'}/wrapper majordomo");
19 print WRAPPER "From: $_[0]->{'user'}\@$dom\n\n";
20 print WRAPPER "approve $pass subscribe $l ",
21 "$_[0]->{'user'}\@$dom\n\n";
24 &unlock_file($list->{'members'});
29 # useradmin_delete_user(&details)
30 # Delete a user from the mailing list
31 sub useradmin_delete_user
34 if ($config{"sync_$l"}) {
35 local $dom = $config{"shost_$l"};
36 $dom = &get_system_hostname() if (!$dom);
37 local $list = &get_list($l, $conf);
38 local $pass = &find_value("admin_passwd",
39 &get_list_config($list->{'config'}));
40 &lock_file($list->{'members'});
41 open(WRAPPER, "|$config{'program_dir'}/wrapper majordomo");
42 print WRAPPER "From: $_[0]->{'user'}\@$dom\n\n";
43 print WRAPPER "approve $pass unsubscribe $l ",
44 "$_[0]->{'user'}\@$dom\n\n";
47 &unlock_file($list->{'members'});
52 # useradmin_modify_user(&details)
54 sub useradmin_modify_user
56 return if ($_[0]->{'user'} eq $_[0]->{'olduser'} || !$_[0]->{'olduser'});
58 if ($config{"sync_$l"}) {
59 # Directly update the subscription list, if the user is on it
60 local $dom = $config{"shost_$l"};
61 $dom = &get_system_hostname() if (!$dom);
62 local $list = &get_list($l, $conf);
63 &lock_file($list->{'members'});
64 local $lref = &read_file_lines($list->{'members'});
66 for($i=0; $i<@$lref; $i++) {
67 if ($lref->[$i] eq "$_[0]->{'olduser'}\@$dom") {
68 $lref->[$i] = "$_[0]->{'user'}\@$dom";
72 &flush_file_lines() if ($found);
73 &unlock_file($list->{'members'});