On Wed, Oct 01, 2003 at 10:32:19PM -0400, Sam Varshavchik wrote:
> Eduardo Roldan writes:
>
> >I think that the conditional functions (the ones you only use in the IF
> >statement) proposed by [EMAIL PROTECTED] shold be in maildrop because
> >in a tyipical filter these are evaluated each time a message is
> >delivered.
>
> Define "typical filter". To me a typical filter means: depending on the
> message's contents, deliver to this folder, or that folder. Or, perhaps,
> discard the message; or maybe forward it.
>
> These things can be accomplished entirely by the existing facilities in
> maildrop. When you start doing things like checking if an external file
> exists, creating or removing directories, I think you're getting beyond
> what a typical mail filter does.
Well, I'm running a system where some users use TMDA and others
don't. Currently, I have the following recipe in my etc/maildroprc
(see below) to decide whether or not to do TMDA filtering for a
given user. For every message that comes into my system, I could
get rid of a fork/exec to the shell and all the overhead for
redirecting the ignored output back to mailfilter, if I could do
something like this:
exception {
# Both ~/.tmda/config and ~/.tmda/crypt_key must both exist before
# it's recommended to run TMDA.
if ( isfile($HOME/.tmda/config) && isfile($HOME/.tmda/crypt_key) )
{
# do the rest of the stuff to filter through TMDA (see below)
}
}
This is perfectly valid mail filtering, and I'm sure that similar
things are done at lots of sites. The suggested functions are much
more efficient in terms of system resources than the all the
fork/exec/redirect stuff that has to be done today.
And the maildrop code is lot clearer and therefore more maintainable
with the use of functions such as these.
Here's the code I currently have in etc/maildroprc. Note the
ugliness in the top 10 or so lines:
DOTMDA=0
exception {
# Do a double check: ~/.tmda/config and ~/.tmda/crypt_key must
# both exist before it's recommended to run TMDA.
INVOKE=`/bin/test -f $HOME/.tmda/config 2>/dev/null`
if ( $RETURNCODE == 0 )
{
INVOKE=`/bin/test -f $HOME/.tmda/crypt_key 2>/dev/null`
if ( $RETURNCODE == 0 )
{
DOTMDA=1
}
}
}
if ( $DOTMDA != 0 )
{
EXITCODE=0
if ( "X$SENDER" eq "X" )
{
# Needed to keep tmda from barfing
SENDER=""
}
exception {
xfilter "/usr/local/tmda/bin/tmda-filter -p"
}
if ( $RETURNCODE != 0 )
{
EXITCODE=$RETURNCODE
exit
}
}
--
Courier User
[EMAIL PROTECTED]
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
courier-users mailing list
[EMAIL PROTECTED]
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users