File: pm-javac.rc

package info (click to toggle)
procmail-lib 1%3A2009.1202-4
  • links: PTS, VCS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, stretch
  • size: 2,376 kB
  • ctags: 542
  • sloc: perl: 294; makefile: 177; sh: 4
file content (144 lines) | stat: -rw-r--r-- 4,554 bytes parent folder | download | duplicates (4)
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
139
140
141
142
143
144
# pm-javac.rc -- Procmail: Vacation framework recipe (id-cache)
#
#   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
#
#       Framework for all programs that need to reply to messages only once.
#       Usually known as "vacation" feature. If you cahnge th cache file,
#       you can attach this recipe to any messages that you want to deal with
#       only once.
#
#   Required settings
#
#	PMSRC must point to source directory of procmail code. This subroutine
#       will include
#
#       o   pm-javar.rc
#
#   Call arguments (variables to set before calling)
#
#       o   JA_VAC, To activate vacation, set value to "yes"
#       o   JA_VAC_RC, When new message-id is found, run this includerc
#       o   JA_VAC_ID_CACHE, Remember to clear this file when you start
#           the vacation.
#
#   Usage example
#
#	To turn on the vacation feature, create ~/.vac file and recipe below
#	activates vacation. If the vacation is not active, then cache file
#	is removed. (automatic cleanup). The VERBOSE is also turned off
#	when you're on vacation; so that your procmail log will not get
#	filled.
#
#       So when you go to vacation, you 'touch ~/.vac' and update
#       ~/vacation.msg. When you come back, you 'rm ~/.vac'. That's it.
#
#       IMPORTANT: If you are subscribed to mailing lists, be sure to file
#       messages from those services first and put the vacation recipe
#       only after the list or bot messages. Also add sufficent "!" conditions
#       in order not to reply to other "bot" service messages.
#
#           JA_VAC_ID_CACHE = $HOME/.pm-vac.cache
#
#           :0
#           *$ ? $IS_EXIST $HOME/.vac
#           {
#               VERBOSE     = off
#               JA_VAC      = "yes"
#               JA_VAC_RC   = $PMSRC/pm-myvac.rc	# my vacation recipe
#               INCLUDERC   = $PMSRC/pm-javac.rc	# framework
#           }
#           :0 E                                        # else
#           * ? $IS_EXIST $JA_VAC_ID_CACHE
#           {
#               dummy = `$RM -f $JA_VAC_ID_CACHE`
#           }
#
#       Here is example of pm-myvac.rc recipe
#
#           #  Change subject
#
#           :0 fhw
#           * ^Subject: *\/[^ ].*
#           | $FORMAIL -I "Subject: vacation (was: $MATCH)"
#
#           :0 fb           # put message to body
#           | $CAT $HOME/.vacation.msg
#
#           :0              # Send it
#           | $SENDMAIL
#
#   Change Log (none)

dummy = "
========================================================================
pm-javac.rc: init:"

:0
* !  WSPC ?? [ ]
{
    INCLUDERC = $PMSRC/pm-javar.rc
}

# .......................................................... &public ...

JA_VAC                  = ${JA_VAC:-"no"}
JA_VAC_RC               = ${JA_VAC_RC:-""}
JA_VAC_XLOOP            = ${JA_VAC_XLOOP:-"$LOGNAME@$HOST X-loop"}
JA_VAC_ID_CACHE         = ${JA_VAC_ID_CACHE:-"$HOME/pm-vac.cache"}
JA_VAC_ID_CACHE_SIZE    = ${JA_VAC_ID_CACHE_SIZE:-8192}

# ........................................................... &do-it ...
# - The `! precedence'  match should prevent from replying to "bot"
#   messages
# - Mailing lists should use type "list"

:0
*     JA_VAC ?? yes
*$ !  $JA:FROM_DAEMON
*$ ! ^X-Loop: $JA_VAC_XLOOP
*  ! ^Precedence:.*(bulk|list|junk)
*     JA_VAC_RC ?? [a-z]
{
    dummy = "pm-javac.rc: checking."

    oldLock  = $LOCKFILE
    LOCKFILE = ${JA_VAC_ID_CACHE}${LOCKEXT}

    :0 c
    * ! ? $FORMAIL -rD $JA_VAC_ID_CACHE_SIZE $JA_VAC_ID_CACHE
    {
        # Compose reply and add some basic headers

        :0 fhw
	|   $FORMAIL -rt                                                    \
            -A "Precedence: junk"                                           \
            -A "X-Loop: $JA_VAC_XLOOP"

        :0 a    # Formail succeeded
        {
            # New user, call this rc to send a reply
            INCLUDERC   = $JA_VAC_RC
        }
    }

    LOCKFILE = $oldLock
}

dummy = "pm-javac.rc: end:"

# End of file