diff -c5 -d -w mf-mail.old mf-mail *** mf-mail.old Mon Nov 19 02:29:26 2001 --- mf-mail Fri Feb 8 14:35:40 2002 *************** *** 10,22 **** use IPC::Run; use MF qw( &listconf &configure &listlists &compose &sendmsg &getfile &get_header &getaddress &issub &genconf &listsubs &log $version ! &subscribe &unsubscribe $configfile ); my onfig = %{&configure($configfile, ())}; my $message = ''; while(<STDIN>) { $message .= $_; } --- 10,23 ---- use IPC::Run; use MF qw( &listconf &configure &listlists &compose &sendmsg &getfile &get_header &getaddress &issub &genconf &listsubs &log $version ! &subscribe &unsubscribe $configfile &attach_mime ); my onfig = %{&configure($configfile, ())}; + my %args=@ARGV; my $message = ''; while(<STDIN>) { $message .= $_; } *************** *** 24,37 **** $who = lc(&getaddress($who)); my $subj = lc &get_header ($message, 'subject'); $subj =~ s/\s/ /gs; $subj =~ s/ +/ /g; ! $subj =~ s/^re: //gi; ! my ($action, $list, $address) = split (/ /, $subj); $list ||= ''; $address ||= $who; onfig = %{&listconf ($list, \onfig)}; # perform housekeeping on the confirm directory if (-d "$config{libdir}/.confirm") { --- 25,94 ---- $who = lc(&getaddress($who)); my $subj = lc &get_header ($message, 'subject'); $subj =~ s/\s/ /gs; $subj =~ s/ +/ /g; ! $subj =~ s/^(re|aw|fwd?): //gi; # also clean 'antwort/forward' madness sent by germanized outlook ! my ($action, $list, $address); ! ! # ! # look if we were invoked from special setup'd alias (postfix/regex, et.al.) ! # ! # Example(Postfix): ! # ! # in postfix-etc/main.cf: ! # alias_map = pcre:postfix-etc/maillist.aliases ! # ! # in postfix-etc/maillist.aliases: ! # /^(.+)\-([a-z]+)$/ |"/minorfish-dir/mf-mail -mode explicit -list '$1' -action '$2'" ! # /^(.+)\-subscribe$/ |"/minorfish-dir/mf-mail -mode explicit -list '$1' -action subscribe" ! # /^(.+)\-unsubscribe$/ |"/minorfish-dir/mf-mail -mode explicit -list '$1' -action unsubscribe" ! # /^(.+)\-owner$/ |"/minorfish-dir/mf-mail -mode explicit -list '$1' -action owner" ! # ! # /^.+\-(owner|subscribe|unsubscribe)$/ |"/minorfish-dir/mf-mail -mode implicit" ! # ! # /^minorfish\-(info|listlists)$/ |"/minorfish-dir/mf-mail -mode explicit -list '' -action '$1'" ! # ! # ! # Example(aliases): ! # ! # in /etc/aliases: ! # mailist-subscribe |"/minorfish-dir/mf-mail -mode explicit -list mailist -action subscribe" ! # mailist-unsubscribe |"/minorfish-dir/mf-mail -mode implicit" ! # ! # ! # ! ! if( (scalar @ARGV > 0) && ($args{-mode} eq 'explicit')) { ! # ! # either especially setup in /etc/aliases* or ! # created on-the-fly thru a postfix regular-expression ! # so list and action are given by "-action XXX -list YYY" ! # ! $action = $args{-action}; ! $list = $args{-list}; ! $address = $who; ! # adjusting subject to be minorfish conform ! $subj="$action $list "; ! } elsif( (scalar @ARGV > 0) && ($args{-mode} eq 'implicit') ) { ! # ! # especially setup in /etc/aliases* ! # of the form "listname-action" and ! # read from the mails "To:" field ! # ! my $to = lc &get_header ($message, 'to'); ! $to=lc(&getaddress($to)); ! ($list,$action) = ($to=~/^(.+)\-([a-z]+)\@/); ! $address = $who; ! # adjusting subject to be minorfish conform ! $subj="$action $list "; ! } else { ! ($action, $list, $address) = split (/ /, $subj); $list ||= ''; $address ||= $who; + } + onfig = %{&listconf ($list, \onfig)}; # perform housekeeping on the confirm directory if (-d "$config{libdir}/.confirm") { *************** *** 262,274 **** &sendmsg($config{server}, $mail, "$config{self}\@$config{domain}", ($address)); &log("event", "List listing sent to $address", "", \onfig); exit 0; } ! else ! { my $msg = &getfile ($list, 'invalid-cmd', \onfig); my $mail = &compose ("$config{self}\@$config{domain}", "Re: $subj", $msg, ($address)); &sendmsg($config{server}, $mail, "$config{self}\@$config{domain}", ($address)); --- 319,352 ---- &sendmsg($config{server}, $mail, "$config{self}\@$config{domain}", ($address)); &log("event", "List listing sent to $address", "", \onfig); exit 0; } + elsif ( $list && ($action eq 'owner') || ($action eq 'moderator') ) { + # + # forward the message to moderator/owner + # + my $msg = "The following mail has been requested to be forwarded to you\n\n"; + + if($config{moderator} eq "") { + &log("h_error", "List '$list' has no moderator set", $list, \onfig); + exit 1; + } ! my $mail = &compose( ! "$address", "Fwd: $subj (by $config{self}\@$config{domain})", ! $msg, ($config{moderator}) ! ); ! ! $mail=&attach_mime($mail,$message); ! ! &sendmsg($config{server}, $mail, "$address",($config{moderator}); ! ! &log("event", "Mail forwarded to $config{moderator} of list $list", "", \onfig); ! exit 0; ! } ! else { my $msg = &getfile ($list, 'invalid-cmd', \onfig); my $mail = &compose ("$config{self}\@$config{domain}", "Re: $subj", $msg, ($address)); &sendmsg($config{server}, $mail, "$config{self}\@$config{domain}", ($address));