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 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
|
# An example ~/.tkmailrc file
# WARNING! many of the settings here might not work at your site
# DO NOT just copy this as your own ~/.tkmailrc file without modification
# Do NOT delete the following line
global env mf mfp mfuser
# Here is how to change the default settings. See the
# User Settings section of in the popup Help for other options.
# * spaces inclosed in {}'s are not just white-space and
# can cause errors in evaluation.
# * use of the $mf or $env arrays require you to replace
# the surrounding {}'s with ""'s
# DO NOT put anything but supported mf() settings inside the
# following USER SETTINGS section or you will lose them!
# For your personally invented settings, use mfuser()
# USER SETTINGS
set mf(viewer-print) {enscript -q -b"%S"}
set mf(mail-directory) $env(HOME)/Mail
set mf(mail-auto-incorp) {1}
set mf(menu-quick-send) {griff judith rpw ilyak}
# set mf(insert-headers) {Reply-To: raines@slac.stanford.edu}
set mf(menu-folders-max) {25}
set mf(viewer-state) {normal}
set mf(compose-alt-editor) {emacs %F}
set mf(menu-folders-ignore) {tandem out.box.old SGI}
# set mf(compose-alternates) {raines@[a-zA-Z\.]*}
set mf(mail-archive-folder) {@mfv:sender-hook-example}
set mf(compose-fcc-folder) {@mfv:fcc-hook-example}
set mf(insert-signature) {@mfv:signature-hook-example}
set mf(compose-fcc-swap) {1}
set mf(compose-show-cc) {0}
set mf(mail-read-ask) {1}
set mf(mail-read-max) {10000}
set mf(viewer-beep-new) {blt_bell 80}
set mf(header-strip) {Received Status Message-Id}
# The following are user defined settings using the special
# array variable mfuser()
set mfuser(menu-sender-full) 0
set mfuser(menu-sender-list) { {griff@.* griff_in} {.*sun.com SUN} }
set mfuser(compose-fcc-directory) $mf(mail-directory)
set mfuser(compose-fcc-default) $mf(mail-directory)/out.box
set mfuser(compose-fcc-bysender) 1
set mfuser(compose-fcc-list) { {griff@.* griff_out} {.*sgi.com SGI} }
# END OF USER SETTINGS
# WIDGET RESOURCE CONFIGURATION
# see each widget class's man page for resource choices
option add *Text.font -adobe-courier-medium-r-normal--12-*
option add *Text.foreground black
option add *MailView*Text.background seashell2
option add *MailCompose*Text.background mistyrose
# PERSONAL BINDINGS
proc mfv:bind-hook {} {
# Nothing yet
}
# PERSONAL HOOKS
# This procedure is called right after the viewer window is created
# Any command that references a widget on the viewer should go inside
# The argument 'mf' is the toplevel widget of the viewer. Browsing the
# mfv:new-viewer procedure in viewer.tcl will be necessary for discovering
# the widget structure of the viewer until a complete doc is written
proc mfv:viewer-hook { mft } {
global env mf mfp
# The following lines show how to add new buttons to the button bar
button $mft.bb.arc -text "Archive" \
-command "mfv:mesg-move $mft $mf(mail-directory)/received"
pack after $mft.bb.newm $mft.bb.arc {left expand fill}
# The following lines show how to add extra menu items
$mft.menu.edit.m add separator
$mft.menu.edit.m add command -label {MetaMail . . .} \
-command "mfv:xterm-command $mft metamail"
$mft.menu.edit.m add command -label {PGP Decrypt . . .} \
-command "mfv:xterm-command $mft {pgp -m}"
# the following line make Replace the default instead
# of Discard for UNIX Pipes
$mft.menu.edit.m entryconfigure {UNIX Pipe*} \
-command "mfv:pipe $mft xsel $mft.mesg.txt 0 {} 1"
}
# This procedure is called by each compose window you create The
# arguement 'mfc' is the toplevel widget of the compose window.
# Browsing the mfv:copose procedure in compose.tk will be necessary
# for discovering the widget structure of the viewer until a complete
# doc is written
proc mfv:compose-hook { mfc } {
global mf mfp
# The next few lines show how to add a menu item to insert
# aliases into the To: entry field
menubutton $mfc.menu.alias -text {Alias} -menu $mfc.menu.alias.m
menu $mfc.menu.alias.m
for {set ndx 0} {$ndx < [llength $mfp(aliasaddr)]} {incr ndx} {
$mfc.menu.alias.m add command -label [lindex $mfp(aliasnames) $ndx] \
-command "mfv:my-alias-hook $mfc {[lindex $mfp(aliasaddr) $ndx]}"
}
pack append $mfc.menu $mfc.menu.alias {left}
button $mfc.bb.pgp -text {PGP Sign} \
-command "mfv:xterm-command $mfc {pgp -sta %F; mv %F.asc %F.out}"
pack after $mfc.bb.sign $mfc.bb.pgp {left expand fill}
}
# used by the mfv:compose-hook above
proc mfv:my-alias-hook { mfc addr } {
set entry [focus]
if {[winfo class $entry] != "Entry"} return
if {[string length [$entry get]]} {
$entry insert end {, }
}
$entry insert end [mfv:expand-aliases $addr ]
mfv:reset-fcc $mfc
}
# This procedure is called after selecting Send in compose widget
# right before the actual contents are record to the FCC: and sent.
# The arguement 'tw' is a text widget containing the mesg to be sent
# proc mfv:send-hook { tw subject to cc bcc fcc mesgid } {
# global mf mfp
#
# }
# This procedure is called after a message is displayed in a viewer
# The argument 'mft' is the pathname of the viewer toplevel.
# The arguement 'tw' is a text widget containing the mesg text
# proc mfv:display-mesg-hook { mft tw } {
# global mf mfp
#
# }
# Examples of using a hook for mf() settings which can have
# values with '@' prepended in which case the rest of the setting is
# interpreted as a Tcl command hook and called with the name of the
# appropriate toplevel appended as an argument. For example, the
# setting
# set mf(mail-archive-folder) {@mfv:sender-hook-example}
# will cause the procedure mfv:sender-hook-example (defined below)
# to be called whenever TkMail needs to determine a default archive
# file for a message it is displaying.
proc mfv:sender-hook-example {top} {
global mf mfp mfuser
set fromname [mfv:viewer-get-field $top \
{reply-to from return-path sm-from}]
set fromname [mfv:extract-address $fromname 0]
if {$mfuser(menu-sender-full)} {
set ret [string tolower $fromname]
} else {
set ret [string tolower [lindex [split $fromname "@"] 0]]
}
foreach pair $mfuser(menu-sender-list) {
if {[regexp [lindex $pair 0] $fromname]} {
set ret [lindex $pair 1]
break
}
}
return $ret
}
proc mfv:fcc-hook-example { mfc } {
global mf mfuser
set val $mf(mail-directory)/out.box
# get first address from To: entry
set sendto [mfv:compose-get-field $mfc to]
set sendto [mfv:extract-address $sendto 0]
if {[string length $sendto]} {
# if a <Sender> file exists, use that
if {$mfuser(compose-fcc-bysender)} {
if {$mfuser(menu-sender-full)} {
set val [string tolower $sendto]
} else {
set val [string tolower [lindex [split $sendto "@"] 0] ]
}
if {![file exists $val] && [string length $mfuser(compose-fcc-default)]} {
set val $mfuser(compose-fcc-default)
}
foreach pair $mfuser(menu-sender-list) {
if {[regexp [lindex $pair 0] $sendto]} {
set val [lindex $pair 1]
break
}
}
}
# a match in the fcc-list overrides all others
foreach pair $mfuser(compose-fcc-list) {
if {[regexp [lindex $pair 0] $sendto]} {
set val [lindex $pair 1]
break
}
}
}
# make sure we have an absolute pathname
if {![string length $mfuser(compose-fcc-directory)]} {
set mfuser(compose-fcc-directory) $mf(mail-directory)
}
if {!([regexp {^/} $val] || [regexp {^\./} $val])} {
set val $mfuser(compose-fcc-directory)/$val
}
return $val
}
proc mfv:signature-hook-example { mfc } {
global mf env
# get first address from To: entry
set sendto [mfv:compose-get-field $mfc to]
set sendto [mfv:extract-address $sendto 0]
if {[regexp {slac.stanford.edu$} $sendto] ||
[string first @ $sendto] == -1} {
return $env(HOME)/.lsignature
} else {
return $env(HOME)/.rsignature
}
}
# Local Variables: ***
# mode:tcl ***
# End: ***
|