TkMail extensions

Back to my home page

Here are my viewer-hook and compose-hook procedures from my .tkmailrc. Find the matching procedures in your .tkmailrc and try putting in the things that interest you.



# 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
    #this SHOULD set the icon position
    if {$mft == ".mf0"} { wm iconposition $mft 1000 830 }
    # 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.incorp $mft.bb.arc {left expand fill}    

    # The following lines show how to bind keys in the main viewer
    #    bind $mft.mesg.txt  "$mft.menu.mesg.m invoke 0"
    #    bind $mft.mesg.txt  "$mft.menu.mesg.m invoke 1"
    
    # 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"

    # the following menu pop's mail from a remote host to your
    # local mailbox by prompting your for the remote passwd in an xterm.
    $mft.menu.mail.m add command -label {POP mail from vaxsar} \
	    -command "mfv:xterm-command $mft {popclient -u etgold vaxsar}"

    # this decodes mime messages into files
    $mft.menu.edit.m add command -label {MIME decode} \
	    -command "mfv:pipe $mft tw $mft.mesg.txt 0 {munpack -qt %F} 0"

    # this pgp decrypts the current message
    $mft.menu.edit.m add command -label {PGP Decrypt . . .} \
	    -command "mfv:xterm-command $mft {pgp -m}"
    
    # these decode base64
    $mft.menu.edit.m add command -label {base64 decode xsel text}\
	    -command "mfv:pipe $mft xsel $mft.mesg.txt 0 {mmencode -u -p %F} 1"
    $mft.menu.edit.m add command -label {base64 decode xsel to file}\
	    -command "mfv:pipe $mft xsel $mft.mesg.txt 0 {mmencode -u %F > tkmaildecode.out} 1"
    
    
    # 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

    # Here is how to bind keys in the text edit window
    #    bind $mfc.comp.txt  \
	    #	"$mfc.comp.txt insert end \"\n[exec date]\n\" "


    # 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}
    
    menubutton $mfc.menu.pgp -text {PGP} -menu $mfc.menu.pgp.m
    menu $mfc.menu.pgp.m
#    set ethannamelist ""
    $mfc.menu.pgp.m add command -label "PGP clearsign" \
	    -command "mfv:xterm-command $mfc {pgp -sta %F; mv %F.asc %F.out}"
    
    $mfc.menu.pgp.m add command -label "PGP encrypt" \
	    -command "mfv:xterm-command $mfc {pgp -eta %F; mv %F.asc %F.out}"

#	    -command "for {set ethannamelist [$mfc.to.ent get]} {} ; mfv:xterm-command $mfc {pgp -eta %F $ethannamelist; mv %F.asc %F.out}"

#	    -command "mfv:xterm-command $mfc {pgp -eta %F [$mfc.to.ent get]; mv %F.asc %F.out}"
    
    #	-command "mfv:xterm-command $mfc {pgp -eta %F; mv %F.asc %F.out}"
    
    
    
    #-command "mfv:xterm-command $mfc {pgp -eta %F; mv %F.asc %F.out}"
    
    $mfc.menu.pgp.m add command -label "PGP encrypt AND sign" \
	    -command "mfv:xterm-command $mfc {pgp -esta %F; mv %F.asc %F.out}"
    
    pack append $mfc.menu $mfc.menu.pgp {left}

#    $mfc.menu.edit.m add command -label {base64 encode xsel}\
#	-command "mfv:pipe $mfc xsel $mfc.mesg.txt 0 {mmencode %F} 1"

}



last modified 4/7/96