1 # Id: mailprocs.tcl,v 8.3 1996/04/29 12:31:35 bostic Exp (Berkeley) Date: 1996/04/29 12:31:35
5 set line
[viGetLine
$viScreenId [lindex [viGetCursor
$viScreenId] 0]]
6 if {[string compare
[lindex [split $line :] 0] "To"] == 0} {
7 set addrs
[lindex [split $line :] 1]
8 foreach name
[split $addrs ,] {
9 isValid
[string trim
$name]
16 set aliasFile
[open "~/Mail/aliases" r
]
17 while {[gets $aliasFile line
] >= 0} {
18 set name
[lindex [split $line :] 0]
19 set address
[lindex [split $line :] 1]
20 if {[string compare
$target $name] == 0} {
33 proc isValid
{target
} {
35 set address
[valid
$target]
37 viMsg
$viScreenId "$target is [string trim $address]"
39 viMsg
$viScreenId "$target not found"
43 proc isAliasedLine
{} {
45 set line
[viGetLine
$viScreenId [lindex [viGetCursor
$viScreenId] 0]]
46 if {[string match
[lindex [split $line :] 0] "*To"] == 0} {
47 set addrs
[lindex [split $line :] 1]
48 foreach name
[split $addrs ,] {
49 isAliased
[string trim
$name]
54 proc aliased
{target
} {
56 set aliasFile
[open "~/Mail/aliases" r
]
57 while {[gets $aliasFile line
] >= 0} {
58 set name
[lindex [split $line :] 0]
59 set address
[lindex [split $line :] 1]
60 if {[string compare
$target [string trim
$address]] == 0} {
70 proc isAliased
{target
} {
72 set found
[aliased
$target]
75 viMsg
$viScreenId "$target is aliased to [string trim $name]"
77 viMsg
$viScreenId "$target not aliased"
81 proc appendAlias
{target address
} {
82 if {![aliased
$target]} {
83 set aliasFile
[open "~/Mail/aliases" a
]
84 puts $aliasFile "$target: $address"
91 set row
[lindex [viGetCursor
$viScreenId] 0]]
92 set column
[lindex [viGetCursor
$viScreenId] 1]]
93 set line
[viGetLine
$viScreenId $row]
94 while {$column < [string length
$line] && \
95 [string index
$line $column] != ' '
} {
96 append $target [string index
$line $column]
99 set found
[isValid
$target]
106 for {set i
$viStartLine} {$i <= $viStopLine} {incr i
} {
108 append newLine
[viGetLine
$viScreenId $i]
109 viSetLine
$viScreenId $i $newLine
114 viMapKey
$viScreenId \x01 isAliasedLine
115 viMapKey
$viScreenId \x02 validLine