1 # these are the email gateway functions needed from web land. they're
2 # also available from ljemailgateway.pl (which contains the full
8 # Retreives an allowed email addr list for a given user object.
9 # Returns a hashref with addresses / flags.
10 # Used for ljemailgateway and manage/emailpost.bml
11 sub get_allowed_senders
{
15 LJ
::load_user_props
($u, 'emailpost_allowfrom');
16 @address = split(/\s*,\s*/, $u->{emailpost_allowfrom
});
17 return undef unless scalar(@address) > 0;
19 my %flag_english = ( 'E' => 'get_errors' );
21 foreach my $add (@address) {
23 $flags = $1 if $add =~ s/\((.+)\)$//;
26 $addr{$add}->{$flag_english{$_}} = 1 foreach split(//, $flags);
33 # Inserts email addresses into the database.
34 # Adds flags if needed.
35 # Used in manage/emailpost.bml
36 # $addr is hashref of { $email_address -> {$flag -> 1} } where possible values of $flag
37 # currently include only 'get_errors', to receive errors at that email address
38 sub set_allowed_senders
{
40 my %flag_letters = ( 'get_errors' => 'E' );
43 foreach (keys %$addr) {
45 my $flags = $addr->{$_};
48 foreach my $flag (keys %$flags) {
49 $email .= $flag_letters{$flag};
53 push(@addresses, $email);
55 $u->set_prop("emailpost_allowfrom", join(", ", @addresses));