*** addr.tcl Fri Jul 25 12:15:32 1997 --- addr.tcl.new Thu Sep 11 07:38:45 1997 *************** *** 86,92 **** addr_db(enabled) addressdbEnabled ON ! "Enable address saving" "If set, From addresses are remembered and available in an address browser." } { --- 86,92 ---- addr_db(enabled) addressdbEnabled ON ! "Automatic address saving" "If set, From addresses are remembered and available in an address browser." } { *************** *** 462,468 **** } if {$addr_db(filter_regexp) != ""} { # AddrDebug "filtering $addr_db(filter_regexp)" ! if [regexp -nocase $addr_db(filter_regexp) $from] { AddrDebug " regexp filter eliminated $from" return } --- 462,468 ---- } if {$addr_db(filter_regexp) != ""} { # AddrDebug "filtering $addr_db(filter_regexp)" ! if [regexp -nocase -- $addr_db(filter_regexp) $from] { AddrDebug " regexp filter eliminated $from" return } *************** *** 583,595 **** Exmh_Status "Matching on full names with $n..." set result {} set pat {} ! append pat $n foreach i [ array names addr_list] { if {1 == [Addr_Entry_IsExcluded $i]} continue set elt $addr_list($i) set fn [lindex $elt 2] # puts stdout "matching against $fn (elt = $elt)" ! if [catch {set match [regexp -nocase $pat $fn t0]}] { Exmh_Status "Fullname expansion error: Invalid regexp \"$pat\"" return {} } --- 583,595 ---- Exmh_Status "Matching on full names with $n..." set result {} set pat {} ! append pat [string trim $n] foreach i [ array names addr_list] { if {1 == [Addr_Entry_IsExcluded $i]} continue set elt $addr_list($i) set fn [lindex $elt 2] # puts stdout "matching against $fn (elt = $elt)" ! if [catch {set match [regexp -nocase -- $pat $fn t0]}] { Exmh_Status "Fullname expansion error: Invalid regexp \"$pat\"" return {} } *************** *** 617,629 **** set result {} set pat {} ! append pat $n AddrDebug " using pattern \"$pat\"" foreach i [array names addr_list] { if {1 == [Addr_Entry_IsExcluded $i]} continue set elt $addr_list($i) ! if [catch {set match [regexp -nocase $pat $i t0]}] { Exmh_Status "Address expansion error: Invalid regexp \"$pat\"" return {} } --- 617,629 ---- set result {} set pat {} ! append pat [string trim $n] AddrDebug " using pattern \"$pat\"" foreach i [array names addr_list] { if {1 == [Addr_Entry_IsExcluded $i]} continue set elt $addr_list($i) ! if [catch {set match [regexp -nocase -- $pat $i t0]}] { Exmh_Status "Address expansion error: Invalid regexp \"$pat\"" return {} } *************** *** 751,756 **** --- 751,758 ---- set menu_sel [Widget_AddMenuB $f selmenu "Selected..." {right padx 1} ] $f.selmenu configure -takefocus {} -state disabled set addr_db(selmenu) $f.selmenu + Widget_AddMenuItem $menu_sel "Mail To" \ + { Addr_Browse_Selected MailTo } Widget_AddMenuItem $menu_sel "Edit" \ { Addr_Browse_Selected Edit } Widget_AddMenuItem $menu_sel "Delete" \ *************** *** 802,807 **** --- 804,812 ---- bind $t { if {0 != [string compare "%W" ".addr_br.find.entry"]} {Addr_Browse_Selected Exclude} } + bind $t { + if {0 != [string compare "%W" ".addr_br.find.entry"]} {Addr_Browse_Selected MailTo} + } bind $t { if {0 != [string compare "%W" ".addr_br.find.entry"]} {Addr_Browse_Selected Delete} } *************** *** 835,901 **** proc Addr_Browse_TrackSel {} { global addr_db ! if { ![info exists addr_db(win)] || ![info exists addr_db(selmenu)] } return ! ! if { 0 != [string length [$addr_db(win) curselection]] } { ! $addr_db(selmenu) configure -state normal ! } else { ! $addr_db(selmenu) configure -state disabled } } proc Addr_Browse_LoadListbox { {ldmsg ""} {state normal}} { global addr_db addr_list ! if {![info exists addr_db(win)]} return $addr_db(win) delete 0 end if {0 == [string compare "$state" "normal"]} { Exmh_Status "$ldmsg getting names..." - update idletasks } foreach i [array names addr_list] { if {$addr_db(hideexcluded) == 0 || [Addr_Entry_IsExcluded $i] == 0} { lappend l [Addr_Entry_FormatForListbox $i] } } ! if {0 == [string compare "$state" "normal"]} { ! Exmh_Status "$ldmsg sorting names..." ! update idletasks ! } ! set l [lsort $l] ! set n 0 ! set whiz [list | \\ - /] ! set w 0 ! if {[string length $addr_db(filterstring)] > 0} { ! foreach i $l { ! if [regexp -nocase -- $addr_db(filterstring) $i] { ! $addr_db(win) insert end $i ! } ! incr n ! if { 0==($n%100) } { ! if {0 == [string compare "$state" "normal"]} { ! Exmh_Status [concat $ldmsg "inserting names... [lindex $whiz $w]"] ! update idletasks ! } ! set w [expr {($w+1)%4}] ! } ! } ! } else { ! foreach i $l { $addr_db(win) insert end $i ! incr n ! if { 0==($n%100) } { ! if {0 == [string compare "$state" "normal"]} { ! Exmh_Status [concat $ldmsg "inserting names... [lindex $whiz $w]"] ! update idletasks ! } ! set w [expr {($w+1)%4}] ! } ! } } if {0 == [string compare "$state" "normal"]} { Exmh_Status "$ldmsg done" --- 840,911 ---- proc Addr_Browse_TrackSel {} { global addr_db ! catch { ;# windows may not exist ! if { 0 != [string length [$addr_db(win) curselection]] } { ! $addr_db(selmenu) configure -state normal ! } else { ! $addr_db(selmenu) configure -state disabled ! } } } proc Addr_Browse_LoadListbox { {ldmsg ""} {state normal}} { global addr_db addr_list ! if {![info exists addr_db(win)] || ! ![winfo exists $addr_db(win)]} return ! ! if {[catch {regexp -nocase -- $addr_db(filterstring) {}} err]} { ! Exmh_Status $err ;# bad pattern ! return ! } $addr_db(win) delete 0 end if {0 == [string compare "$state" "normal"]} { Exmh_Status "$ldmsg getting names..." } + set l {} foreach i [array names addr_list] { if {$addr_db(hideexcluded) == 0 || [Addr_Entry_IsExcluded $i] == 0} { lappend l [Addr_Entry_FormatForListbox $i] } } ! if {[llength $l]} { ! if {0 == [string compare "$state" "normal"]} { ! Exmh_Status "$ldmsg sorting names..." ! } ! set l [lsort $l] ! set n 0 ! set whiz [list | \\ - /] ! set w 0 ! if {[string length $addr_db(filterstring)] > 0} { ! foreach i $l { ! if [regexp -nocase -- $addr_db(filterstring) $i] { $addr_db(win) insert end $i ! } ! incr n ! if { 0==($n%100) } { ! if {0 == [string compare "$state" "normal"]} { ! Exmh_Status "$ldmsg inserting names... [lindex $whiz $w]" ! } ! set w [expr {($w+1)%4}] ! } ! } ! } else { ! foreach i $l { ! $addr_db(win) insert end $i ! incr n ! if { 0==($n%100) } { ! if {0 == [string compare "$state" "normal"]} { ! Exmh_Status "$ldmsg inserting names... [lindex $whiz $w]" ! } ! set w [expr {($w+1)%4}] ! } ! } ! } } if {0 == [string compare "$state" "normal"]} { Exmh_Status "$ldmsg done" *************** *** 907,913 **** proc Addr_Browse_Exclude_Change {name element op} { global addr_db catch {Exmh_Debug Event addr_db win is $addr_db(win)} ! Addr_Browse_LoadListbox silently return } --- 917,923 ---- proc Addr_Browse_Exclude_Change {name element op} { global addr_db catch {Exmh_Debug Event addr_db win is $addr_db(win)} ! Addr_Browse_LoadListbox {} silently return } *************** *** 921,927 **** # off the front, the message number off the end and the rest must be the folder. set pat "($mhProfile(path))/(.+)/(\[0-9\]+)\$" ! if [regexp $pat $last match path folder msg] { Msg_Clip $folder $msg } else { Exmh_Status "ViewLastMsg cannot find $last" --- 931,937 ---- # off the front, the message number off the end and the rest must be the folder. set pat "($mhProfile(path))/(.+)/(\[0-9\]+)\$" ! if [regexp -- $pat $last match path folder msg] { Msg_Clip $folder $msg } else { Exmh_Status "ViewLastMsg cannot find $last" *************** *** 983,992 **** proc Addr_Browse_Selected { { op Noop } } { global addr_db addr_list ! foreach sel [lsort -decreasing [$addr_db(win) curselection]] { switch $op { Edit { Addr_Browse_Edit $sel } --- 993,1010 ---- proc Addr_Browse_Selected { { op Noop } } { global addr_db addr_list ! set to {} ; set sep "" ! ! foreach sel [lsort -decreasing -integer [$addr_db(win) curselection]] { switch $op { + MailTo { + append to $sep[Addr_Entry_FormatForMail \ + [MsgParseFrom [$addr_db(win) get $sel]]] + set sep ", " + } + Edit { Addr_Browse_Edit $sel } *************** *** 1019,1024 **** --- 1037,1046 ---- } } + if {[string length $to] > 0} { + Msg_CompTo $to + } + Addr_Browse_TrackSel } *************** *** 1062,1071 **** Widget_AddBut $f last "ViewLastMsg" "Addr_Browse_Clip $sel" set e [Widget_AddBut $f ignore "Exclude" "Addr_Edit_Exclude $t $sel"] ! set n [Addr_LabelledTextField $t.name "Full Name" 12 "Addr_Edit_Save $t $sel" ] ! set a [Addr_LabelledTextField $t.address "Address" 12 "Addr_Edit_Save $t $sel" ] set l [Addr_LabelledTextField $t.lastMsg "Last Message" 12 "Addr_Edit_Save $t $sel" ] ! set d [Addr_LabelledTextField $t.date "Date" 12 "Addr_Edit_Save $t $sel" ] pack $t.name $t.address $t.lastMsg $t.date --- 1084,1093 ---- Widget_AddBut $f last "ViewLastMsg" "Addr_Browse_Clip $sel" set e [Widget_AddBut $f ignore "Exclude" "Addr_Edit_Exclude $t $sel"] ! set n [Addr_LabelledTextField $t.name "Full Name" 12 "Addr_Edit_Save $t $sel" ] ! set a [Addr_LabelledTextField $t.address "Address" 12 "Addr_Edit_Save $t $sel" ] set l [Addr_LabelledTextField $t.lastMsg "Last Message" 12 "Addr_Edit_Save $t $sel" ] ! set d [Addr_LabelledTextField $t.date "Date" 12 "Addr_Edit_Save $t $sel" ] pack $t.name $t.address $t.lastMsg $t.date *************** *** 1104,1110 **** set addr [$winname.address.entry get] set victim [MsgParseFrom $addr] ! Exmh_Status "Updating address \"$victim\"." Addr_Entry_ToggleExcluded $victim set exclude [Addr_Entry_IsExcluded $victim] --- 1126,1132 ---- set addr [$winname.address.entry get] set victim [MsgParseFrom $addr] ! Exmh_Status "Updating address \"$victim\"." Addr_Entry_ToggleExcluded $victim set exclude [Addr_Entry_IsExcluded $victim] *************** *** 1167,1171 **** --- 1189,1194 ---- # done loading... # if {$Addr_debug} { puts stdout "done." } +