/usr/lib/exmh/pop.tcl is in exmh 1:2.8.0-7.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | # pop.tcl
# POP3 support for exmh
proc Pop_GetPassword {host} {
global pop
if {[info exist pop($host,password)]} {
set pop(password) $pop($host,password)
return
}
if {[file exists ~/.netrc]} {
if {[catch {open ~/.netrc} in]} {
Exmh_Status "Warning - can't read ~/.netrc: $in"
} else {
set X [read $in]
set tokens {}
foreach token [split $X] {
if {[string length $token] == 0} {
continue
}
lappend tokens $token
}
set state nohost
foreach {key value} $tokens {
switch $state {
nohost {
if {[string compare $key machine] == 0 &&
[string compare $value $host] == 0} {
set state gothost
}
}
gothost {
if {[string compare $key machine] == 0} {
break ;# Done with this host
}
set pop($host,$key) $value
}
}
}
}
# See if the .netrc has values already
if {[info exist pop($host,password)]} {
set pop(password) $pop($host,password)
return
}
}
# Nothing in .netrc - prompt the user, and save the info if desired
Pop_Dialog $host
}
proc Pop_Dialog {host} {
global pop
set t .pop
set but .pop.but
if {[Exwin_Toplevel $t "POP3 Mail Login [tk appname]" Pop]} {
label $t.label -text "Enter your user ID and password for\nMail server $host"
pack $t.label -side top -fill x
Widget_BeginEntries
Widget_LabeledEntry $t.user UserID pop($host,login)
Widget_LabeledEntry $t.pass Password pop($host,password)
$t.pass.entry config -show *
# Focus on password as the common case, unless we don't know login
if {[string length $pop($host,login)] == 0} {
focus $t.user.entry
} else {
focus $t.pass.entry
}
Widget_AddBut $but ok "OK" {PopOK} {left padx 1 filly}
bind $t <Destroy> {set pop(done) 0}
bind $t.user.entry <Return> "focus $t.pass.entry ; break"
bind $t.pass.entry <Return> "PopOK"
}
set pop(done) 0
vwait pop(done)
# Destroy this out because it is specific to a host, and they
# might have multiple hosts.
destroy $t
set pop(password) $pop($host,password)
}
proc PopOK {} {
global pop
set pop(done) 1
wm withdraw .pop
}
|