Re:sub/unsub behavior

Zhiliang Hu <[email protected]> Tue, 23 Aug 2005 00:04:15 -0500 (CDT)
Newsgroups gmane.mail.smartlist.user
Message-ID <Pine.OSF.4.02.10508222351500.25396-100000@genome.ansci.iastate.edu>
Good to confirm... I checked "confirm" add-on at the Smartlist FAQ but
it does not load to my browser.  So I came up a simple 'rc.local.r10'
to do the verifications, attached beblow.

I tried some simple tests and it worked for me.  May need more tests
to improve.

Zhiliang
ps:
when I copied to the mail window there are some added line breaks. I
hope one can restore these breaks for tests..


#$Id: rc.local.r10,v 0.01
#
# 2005/08/22 19:28:16 Zhiliang Hu
##############################################################

tmpreqloc='admin/subcktmp'

:0 w
* ^Subject:.*\@
{
 FROMADDR =`formail -rtzxTo:`
 SUBJADDR =`formail -xSubject: |perl -pe
's/.*sub.*\s+([^\s]+\@[^\s]+)/$1/sg;s/^\s+//g;s/\s+$//g;'`
 SUBJCOMD =`formail -xSubject: |perl -pe
's/(.*sub.*)\s+[^\s]+\@[^\s]+/$1/sg;s/^\s+//g;s/\s+$//g;'`
 DATEMARK = `date +"%s"`

 :0 ic            # "i" -- supress "writing errors" ('header/body
passed to nothing' error)
 * ^Subject:.*sub
 | echo "$SUBJADDR $SUBJCOMD" > $tmpreqloc/$DATEMARK

 # If the same address, re-formulate a subscription mail to server
 #----------------------------------------------------------------
 :0
 * ? formail -rtzxTo: | multigram -b1 -x$listreq -x$listaddr \
     -l$reject_threshold $tmpreqloc/$DATEMARK
 | (formail -I"From: $FROMADDR" -I"Subject: $SUBJCOMD") \
   | $SENDMAIL -oi $listreq

   # If different address, email the target person for confirmation
   #---------------------------------------------------------------
   :0 E
   | (formail -i"From: $listreq" -i"Subject: subscription confirmation
needed" \
      -I "To: $SUBJADDR"; \
      echo "Confirmation code: $DATEMARK"; \
      echo " "; \
      echo "This list server has received a '$SUBJCOMD' request for";
\
      echo "$SUBJADDR from $FROMADDR"; \
      echo " "; \
      echo "If this is what you wanted and wish to confirm, please reply to"; \
      echo "this mail, and copy the entire 'Confirmation code' line on
the"; \
      echo "top of this mail into the 'Subject:' field. The
confirmation must"; \
      echo "be made in 7 days. After 7 days, the request will be
dropped from"; \
      echo "the server."; \
      echo " "; \
      echo "List Daemon for ANGENMAP") | $SENDMAIL -oi $SUBJADDR
}

:0 
* ^Subject:.*Confirmation code:
{
  CONFNAM =`formail -xSubject: | perl -pe 's/Confirmation 
code:\s+([0-9]{9,})/$1/sg; s/[\s]+//g;'`
  COMMAND =`cat $tmpreqloc/$CONFNAM | perl -pe
's/^\s+//g;s/\s+$//g;s/\S+\s+(\S+)/$1/g'`
  :0 fhw
  * ? formail -rtzxTo: | multigram -b1 -x$listreq -x$listaddr \
       -l$reject_threshold $tmpreqloc/$CONFNAM
  | formail -I"Subject: $COMMAND"

      :0 E
      | formail -I"Listmarster: sub/unsub help needed" | $SENDMAIL -oi
$listmaster
}

###########
### END ###
###########