]> git.madduck.net Git - etc/mailfilter.git/blob - procmail/logging

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

improve fromemail parsing
[etc/mailfilter.git] / procmail / logging
1 LOGABSTRACT=no
2
3 MSGIDDIR=$PMVAR/msgid
4
5 :0
6 * MSGID ?? ^<\/[^>]+
7 {
8   MSGID_NAME=`echo $MATCH | tr -d "'\"?[:cntrl:]" | tr ' /*$' '__+S'`
9
10   #VERBOSE=yes
11   # check if filename > 228 characters and if so, then shorten it to prevent
12   # hitting filesystem limit after we append the timestamp
13   :0
14   * MSGID_NAME ?? ^.....................................................................................................................................................................................................................................
15   {
16     HASH=`echo $MSGID_NAME | md5sum | cut -d' ' -f1`
17     MSGID_NAME=`echo $MSGID_NAME | cut -c-196`$HASH
18   }
19
20   THISLOGFILE_REL=$MSGID_NAME%$OURDATE_SHORT
21   THISLOGFILE="$MSGIDDIR/$THISLOGFILE_REL"
22
23   MSGID_NAME
24   #VERBOSE=no
25 }
26
27 MASTERLOGFILE="$LOGFILE"
28 LOGFILE="$THISLOGFILE"
29
30 LOG="==============================================================================$NL"
31
32 :0
33 * LOGLATER ?? .
34 { LOG="$LOGLATER" }
35
36 LOG="msgid:       $MSGID
37 logfile:     $THISLOGFILE_REL
38 date:        $DATE (@$OURDATE)
39 sender:      $SENDER
40 from:        $FROMEMAIL ($FROM)
41 original-to: $ORIGINAL_TO
42 subject:     $SUBJECT$NL"
43
44 TRAP="DESTFILE=\"\${LASTFOLDER#$BASE/}\";
45       /usr/bin/lockfile -4 -r50 -l180 $PMVAR/lock;
46       trap \"echo >> '$THISLOGFILE';
47              /bin/cat '$THISLOGFILE' >> $MASTERLOGFILE;
48              /bin/rm -f $PMVAR/lock\" 0"
49
50 THISLOGFILE_REL