1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
|
# pm-jadup.rc -- Procmail: Handle duplicates; store to separate folder
#
# File id
#
# Copyright (C) 1997-2010 Jari Aalto
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later version
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details at
# <http://www.gnu.org/copyleft/gpl.html>.
#
# Description
#
# This recipe stores duplicate messages to separate folder
#
# Required settings
#
# PMSRC must point to source directory of procmail code. This subroutine
# will include
#
# o pm-javar.rc
# o pm-jastore.rc
#
# Call arguments (variables to set before calling)
#
# o JA_ID_CACHE, Where to keep the Message-Id cache.
# o JA_ID_CACHE_SIZE, how big cache, defualt is 8192
# o JA_ID_MBOX, where to store duplicate messages
# when delivering message to duplicate mbox.
# o JA_ID_IGNORE, if set to "yes", then ignore duplicate check
#
# Return values
#
# o Variable ERROR is set to "yes" if duplicate message was trapped,
# otherwise value is "no"
#
# Usage Example
#
# For simple usage, just put this somewhere after backup recipes
#
# RC_DUP = $PMSRC/pm-jadup.rc
# ...
# INCLUDERC = $RC_DUP
#
# When you are testing messages, you send them over and over to
# .procmailrc; which means that same message should not be trapped by
# duplicate check. You can call `procmail' with option "-a test" which will
# set pseudo variable `$1'. The recipe below sets flag `JA_ID_IGNORE'
# to "yes" if test is on going and the duplicate filter should be
# bypassed.
#
# RC_DUP = $PMSRC/pm-jadup.rc
# ARG = $1 # Copy pseudo variable to $ARG
#
# :0
# * ARG ?? test
# {
# JA_ID_IGNORE = "yes"
# }
#
# # Some microsoft product is known to send same message ids
# # over and over. If we detect one, tunr off the duplicate test,
# # because it would trash every message.
# # <MAPI.Id.0016.00666479202020203030303430303034@MAPI.to.RFC822>
#
# :0
# * ! ^X-msmail
# * ! ^Message-ID: *<MAPI.*@MAPI.to.RFC822>
# {
# JA_ID_IGNORE = "yes"
# }
#
# # Run this command every time a duplicate message is found.
# # It writes a small log entry to MY_LOG
#
# INCLUDERC = $RC_DUP
#
# :0 hwic:
# * ERROR ?? yes
# | echo " [duplicate]" >> $BIFF
#
# Change Log: (none)
# ............................................................ &code ...
id = "pm-jadup.rc"
dummy = "
========================================================================
$id: init:
"
:0
* ! WSPC ?? ( )
{
INCLUDERC = $PMSRC/pm-javar.rc
}
# ..................................................... &output-vars ...
# output variables
ERROR = "no"
# .......................................................... &public ...
JA_ID_CACHE = ${JA_ID_CACHE:-"$HOME/pm-msgid.cache"}
JA_ID_CACHE_SIZE = ${JA_ID_CACHE_SIZE:-8192}
JA_ID_MBOX = ${JA_ID_MBOX:-"junk.duplicates"}
JA_ID_IGNORE = ${JA_ID_IGNORE:-"no"}
# ........................................................... &do-it ...
# We need regional lock, because `formail' is run in condition statement.
jaDupLOCKFILE = $LOCKFILE # save old lockfile
LOCKFILE = ${JA_ID_CACHE}.lock
:0
* ^Message-Id:
* JA_ID_IGNORE ?? no
* ? $FORMAIL -D $JA_ID_CACHE_SIZE $JA_ID_CACHE
{
ERROR = "yes" # Flag duplicate to caller
MBOX = $JA_ID_MBOX
INCLUDERC = $PMSRC/pm-jastore.rc
}
LOCKFILE = $jaDupLOCKFILE # restore value
dummy = "$id: end: (DUPLICATE status = $ERROR)"
# end of file
|