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
|
#
# This file contains examples of a couple of userprocs. These are ways you
# can extend the functionality of TkRat in a couple of areas. You usersprocs
# should be placed in ~/.ratatosk/userproc
#
# RatUP_IsMe --
#
# Checks if a mail address really points at myself.
#
# Arguments
# mailbox Mailbox name
# domain The domain part of the mail address
# personal The personal name phrase (if any)
# adl At-domain-list source route (probably empty)
# Results
# Should return true or false (1 or 0) depending on if the indicated
# address points at the user or not.
proc RatUP_IsMe {mailbox domain personal adl} {
# Here we do it easy for ourselves. Since regexp already returns a
# boolean value we can use that as the return value directly.
return [regexp {(maf|ratatosk.+)@.+.chalmers.se} $mailbox@$domain]
# This expression matches everything that is sent to maf or
# ratatosk(plus something) at a domain under chalmers.se.
# That means that it will match maf@dtek.chalmers.se,
# maf@math.chalmers.se, raratosk-request@dtek.chalmers.se
# and even maf@no_such_domain.chalmers.se. The latter is an
# unfortunate side effect of the expression but I do not care.
# Note that the expression will not match ratatosk@dtek.chalmers.se
# since there must be something between ratatosk and the '@'.
}
# RatUP_Translate --
#
# Translate outgoing addresses
#
# Arguments
# mailbox Mailbox name
# domain The domain part of the mail address
# personal The personal name phrase (if any)
# adl At-domain-list source route (probably empty)
# Results
# Should return a list with four elemnts {mailbox domain personal adl}
proc RatUP_Translate {mailbox domain personal adl} {
# Set up a list of addresses we consider local
set isLocal {root foo driftavd}
# Here we do the test, check if the mailbox is one of the local ones
# and if the domain is under chalmers.se. If so is the case then we
# skip the domain part. This is really just another way of doing a
# similar test as we did in RatUP_IsMe above.
if {-1 != [lsearch $isLocal $mailbox] &&
[regexp {[^.]+.chalmers.se} $domain]} {
return [list $mailbox {} $personal $adl]
}
# If the above cause did not match we should return the address
# unharmed.
return [list $mailbox $domain $personal $adl]
}
|