procmail
[Top] [All Lists]

Re: Sig length scoring (was Re: subscribe)

1997-05-31 11:15:00
Mike Stone wrote,

| I was intrigued when I read this; I thought about the possibility of 
| stripping those long  gratutitous sigs that some people put at the 
| end of their email (like I want to read it). Is there some way I could 
| set an arbitrary max sig-length and replace big sigs with some string 
| (like "I deleted this dope's 8 line sig!"). Am I dreaming?

Here's something, untested.  If we assume that everything after a "^-- ?$" is
signature and that the signature fits into $LINEBUF,

 :0B # "-- " + four lines + trailing blank are forgivable
 * ^-- ?$\/.*$.*$.*$.*$(.*$)+$^^
 {
  SIG=$MATCH

  :0 # do not count closing blank line
  * 1^1 SIG ?? ^.*$
  * -1^0
  { SIGLINES = $= }

  savemetas=$SHELLMETAS
  SHELLMETAS=";"
  :0bfw # without `r', procmail will restore trailing blank line automatically
  | sed "/^-- *$/$c\\
I deleted this dope's $SIGLINES-line sig!\\
"

  SHELLMETAS=$savemetas

# If you cannot get procmail and sed to work together on multi-line syntax,
# do NOT clear SHELLMETAS; and use this recipe instead:
#  :0bfw
#  | sed '/^-- *$/q' ; echo "I deleted this dope\'s $SIGLINES-line sig!"

 }

<Prev in Thread] Current Thread [Next in Thread>