]> 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:

add subject cleaner
[etc/mailfilter.git] / procmail / logging
1 LOGABSTRACT=no
2
3 MSGIDDIR=$PMVAR/msgid
4
5 :0
6 * MSGID ?? ^<\/[^>]+
7 {
8   MSGID_NAME=`echo -n $MATCH | sha224sum | cut -d' ' -f1`
9
10   :0
11   * MSGID_NAME ?? ^\/.
12   { HASH1="$MATCH" }
13
14   :0
15   * MSGID_NAME ?? ^.\/.
16   { HASH2="$MATCH" }
17
18   THISLOGFILE_REL="${HASH1}/${HASH2}/${MSGID_NAME}_${OURDATE_SHORT}"
19   LOGDIR="${MSGIDDIR}/${HASH1}/${HASH2}"
20   MKDIR=`test -d $LOGDIR || mkdir -p $LOGDIR`
21   MKDIR
22   LOGDIR
23   THISLOGFILE="${MSGIDDIR}/${THISLOGFILE_REL}"
24   HASH2
25   HASH1
26   MSGID_NAME
27 }
28
29 MASTERLOGFILE="$LOGFILE"
30 LOGFILE="$THISLOGFILE"
31
32 LOG="==============================================================================$NL"
33
34 :0
35 * LOGLATER ?? .
36 { LOG="$LOGLATER" }
37
38 LOG="msgid:       $MSGID
39 logfile:     $THISLOGFILE_REL
40 date:        $DATE (@$OURDATE)
41 sender:      $SENDER
42 from:        $FROMEMAIL ($FROM)
43 original-to: $ORIGINAL_TO
44 subject:     $SUBJECT$NL"
45
46 :0
47 * SUBJECT_ENCODED ?? .
48 { LOG="subject-enc: $SUBJECT_ENCODED$NL" }
49
50 TRAP="DESTFILE=\"\${LASTFOLDER#$BASE/}\";
51       /usr/bin/lockfile -4 -r50 -l180 $PMVAR/lock;
52       trap \"echo >> '$THISLOGFILE';
53              /bin/cat '$THISLOGFILE' >> $MASTERLOGFILE;
54              /bin/rm -f $PMVAR/lock\" 0"
55
56 THISLOGFILE_REL