This file is indexed.

/usr/share/tkrat2.2/firstwizard.tcl is in tkrat 1:2.2cvs20100105-true-dfsg-6ubuntu1.

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
 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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
# firstwizard.tcl -
#
#  TkRat software and its included text is Copyright 1996-2010 by
#  Martin Forssén
#
#  The full text of the legal notice is contained in the file called
#  COPYRIGHT, included with this distribution.
#
#
# Functions which implements the first use wizard

proc FirstUseWizard {} {
    global t propBigFont idCnt env

    set id firstusewizard[incr idCnt]
    set w .$id
    upvar \#0 $id hd
    set hd(history) {}
    set hd(top) $w

    # Create toplevel and insert infrastructure
    toplevel $w -class TkRat
    wm title $w $t(first_use_wizard)
    label $w.title -textvariable ${id}(title) -font $propBigFont
    set hd(scrollbody) $w.body
    set hd(body) [rat_scrollframe::create $w.body -bd 10]
    frame $w.buttons
    button $w.buttons.prev -text "< $t(wiz_previous)" -state disabled \
	-command "set cmd \[lindex \$${id}(history) end-1\]; \
                  set ${id}(history) \[lreplace \$${id}(history) end-1 end\]; \
                  \$cmd $id"
    button $w.buttons.next -text "$t(wiz_next) >" -state disabled 
    button $w.buttons.cancel -text $t(cancel) -command "destroy $w"
    pack $w.buttons.cancel -side right -padx 20 -pady 5
    pack $w.buttons.next $w.buttons.prev -side right
    pack $w.title -side top -fill x
    pack $w.buttons -side bottom -fill x
    pack $w.body -fill both -expand 1
    set hd(next) $w.buttons.next
    set hd(prev) $w.buttons.prev
    set hd(cancel) $w.buttons.cancel
    set hd(bodym) $w.body

    bind $w <Return> "$hd(next) invoke"
    bind $w <Escape> "$w.buttons.cancel invoke"

    grid propagate $w.body 0
    grid columnconfigure $w.body 0 -weight 1
    grid rowconfigure $hd(body) 20 -weight 1
    bind $w.body <Destroy> "if {\"%W\" == \"$w.body\"} {FirstUseWizardClose $id}"
    ::tkrat::winctl::SetGeometry firstUseWizard $w $w.body

    # Initialize values
    set hd(fullname) "$env(GECOS)"
    if {[string match *.* [info hostname]]} {
	set guess [join [lrange [split [info hostname] .] 1 end] .]
    } else {
	set guess [info hostname]
    }
    set hd(email_address) "$env(USER)@$guess"
    set hd(sendprot) smtp
    set hd(smtp_hosts) localhost
    set hd(imap_host) localhost
    set hd(imap_user) $env(USER)
    set hd(pop3_host) localhost
    set hd(pop3_user) $env(USER)
    if {[catch {exec which sendmail} hd(sendprog)]} {
	if {[file executable /usr/lib/sendmail]} {
	    set hd(sendprog) /usr/lib/sendmail
	}
    }
    set hd(inproto) file
    set hd(filename) $env(MAIL)

    FirstUseWizardIdent $id

    tkwait window $hd(top)
}

proc FirstUseWizardClose {id} {
    upvar \#0 $id hd

    ::tkrat::winctl::RecordGeometry $hd(top) $hd(top).body
    unset hd
}

proc FirstUseWizardReset {id} {
    upvar \#0 $id hd
    global t

    eval destroy [winfo children $hd(body)]
    grid columnconfigure $hd(body) 0 -weight 0
    grid columnconfigure $hd(body) 1 -weight 0
    $hd(next) configure -text "$t(wiz_next) >"
    # Work around bug in grid (reported and fixed 200210??)
    grid size $hd(body)
}

proc FirstUseWizardIdent {id} {
    upvar \#0 $id hd
    global t

    # Setup the first step
    FirstUseWizardReset $id
    lappend hd(history) FirstUseWizardIdent
    set hd(title) $t(identity)

    rat_flowmsg::create $hd(body).message1 -text "$t(firstuse_info)"
    grid $hd(body).message1 - -sticky w -pady 10

    rat_flowmsg::create $hd(body).message2 -text "$t(why_identity)"
    grid $hd(body).message2 - -sticky w

    frame $hd(body).space1 -height 20
    grid $hd(body).space1

    label $hd(body).name_l -text $t(fullname): -anchor e
    entry $hd(body).name_e -textvariable ${id}(fullname)
    grid $hd(body).name_l $hd(body).name_e -sticky we

    frame $hd(body).space2 -height 20
    grid $hd(body).space2

    label $hd(body).email_l -text $t(email_address): -anchor e
    entry $hd(body).email_e -textvariable ${id}(email_address)
    grid $hd(body).email_l $hd(body).email_e -sticky we

    $hd(prev) configure -state disabled
    $hd(next) configure -command "FirstUseWizardSend $id" -state normal
    grid columnconfigure $hd(body) 1 -weight 1
    SetupShortcuts [list $hd(next) $hd(prev)]

    focus $hd(body).email_e
    $hd(body).email_e selection range 0 end
    rat_scrollframe::recalc $hd(scrollbody)
}

proc FirstUseWizardSend {id} {
    upvar \#0 $id hd
    global t

    # Setup the first step
    FirstUseWizardReset $id
    lappend hd(history) FirstUseWizardSend
    set hd(title) $t(sending)

    set a [list $hd(next) $hd(prev)]

    rat_flowmsg::create $hd(body).message -text "$t(why_sending)"
    grid $hd(body).message - -sticky w

    frame $hd(body).space1 -height 20
    grid $hd(body).space1

    radiobutton $hd(body).smtp -text $t(use_mail_server) \
	-variable ${id}(sendprot) -value smtp \
	-command "FirstUseWizardSendSetup $id"
    grid $hd(body).smtp - -sticky w
    lappend a $hd(body).smtp

    label $hd(body).smtpserver_l -text $t(smtp_hosts): -anchor e
    entry $hd(body).smtpserver_e -textvariable ${id}(smtp_hosts)
    grid $hd(body).smtpserver_l $hd(body).smtpserver_e -sticky we

    frame $hd(body).space2 -height 20
    grid $hd(body).space2

    radiobutton $hd(body).prog -text $t(use_prog) \
	-variable ${id}(sendprot) -value prog \
	-command "FirstUseWizardSendSetup $id"
    grid $hd(body).prog - -sticky w
    lappend a $hd(body).prog

    label $hd(body).prog_l -text $t(sendprog): -anchor e
    entry $hd(body).prog_e -textvariable ${id}(sendprog)
    grid $hd(body).prog_l $hd(body).prog_e -sticky we

    button $hd(body).file_browse -text $t(browse)... \
	-command "Browse $hd(top) ${id}(sendprog) any"
    grid x $hd(body).file_browse -sticky e

    $hd(prev) configure -state normal
    $hd(next) configure -command "FirstUseWizardInbox $id" -state normal
    grid columnconfigure $hd(body) 1 -weight 1
    SetupShortcuts $a
    FirstUseWizardSendSetup $id
    rat_scrollframe::recalc $hd(scrollbody)
}

proc FirstUseWizardSendSetup {id} {
    upvar \#0 $id hd

    switch $hd(sendprot) {
	"smtp" {set s 1; set p 0; set fw $hd(body).smtpserver_e}
	"prog" {set s 0; set p 1; set fw $hd(body).prog_e}
    }
    rat_ed::enabledisable $s [list $hd(body).smtpserver_l \
				  $hd(body).smtpserver_e]
    rat_ed::enabledisable $p [list $hd(body).prog_l $hd(body).prog_e]
    if {[focus] != $fw} {
	focus $fw
	$fw selection range 0 end
    }
}

proc FirstUseWizardInbox {id} {
    upvar \#0 $id hd
    global t

    # Setup the first step
    FirstUseWizardReset $id
    lappend hd(history) FirstUseWizardInbox
    set hd(title) $t(incom_mbox)

    set a [list $hd(next) $hd(prev)]

    rat_flowmsg::create $hd(body).message -text "$t(why_inbox)"
    grid $hd(body).message - -sticky w

    frame $hd(body).space1 -height 10
    grid $hd(body).space1

    radiobutton $hd(body).file -text $t(file) \
	-variable ${id}(inproto) -value file \
	-command "FirstUseWizardInboxSetup $id"
    grid $hd(body).file - -sticky w
    lappend a $hd(body).file

    label $hd(body).file_l -text $t(pathname): -anchor e
    entry $hd(body).file_e -textvariable ${id}(filename)
    grid $hd(body).file_l $hd(body).file_e -sticky we

    button $hd(body).file_browse -text $t(browse)... \
	-command "Browse $hd(top) ${id}(filename) any"
    grid x $hd(body).file_browse -sticky e

    radiobutton $hd(body).imap -text $t(imap) \
	-variable ${id}(inproto) -value imap \
	-command "FirstUseWizardInboxSetup $id"
    grid $hd(body).imap - -sticky w
    lappend a $hd(body).imap

    label $hd(body).imap_l -text $t(host): -anchor e
    entry $hd(body).imap_e -textvariable ${id}(imap_host)
    grid $hd(body).imap_l $hd(body).imap_e -sticky we

    label $hd(body).iuser_l -text $t(user): -anchor e
    entry $hd(body).iuser_e -textvariable ${id}(imap_user)
    grid $hd(body).iuser_l $hd(body).iuser_e -sticky we

    button $hd(body).imap_adv -text $t(advanced_imap_conf)... \
	-command "FirstUseWizardInboxAdv $id imap"
    grid x $hd(body).imap_adv -sticky e

    radiobutton $hd(body).pop -text $t(pop3) \
	-variable ${id}(inproto) -value pop3 \
	-command "FirstUseWizardInboxSetup $id"
    grid $hd(body).pop - -sticky w
    lappend a $hd(body).pop

    label $hd(body).pop_l -text $t(host): -anchor e
    entry $hd(body).pop_e -textvariable ${id}(pop3_host)
    grid $hd(body).pop_l $hd(body).pop_e -sticky we

    label $hd(body).puser_l -text $t(user): -anchor e
    entry $hd(body).puser_e -textvariable ${id}(pop3_user)
    grid $hd(body).puser_l $hd(body).puser_e -sticky we

    button $hd(body).pop_adv -text $t(advanced_pop_conf)... \
	-command "FirstUseWizardInboxAdv $id pop3"
    grid x $hd(body).pop_adv -sticky e

    $hd(prev) configure -state normal
    $hd(next) configure -command "FirstUseWizardImport $id" -state normal
    grid columnconfigure $hd(body) 1 -weight 1
    SetupShortcuts $a
    FirstUseWizardInboxSetup $id
    rat_scrollframe::recalc $hd(scrollbody)
}

proc FirstUseWizardInboxSetup {id} {
    upvar \#0 $id hd

    switch $hd(inproto) {
	"imap" {set i 1; set p 0; set f 0; set fw $hd(body).imap_e}
	"pop3" {set i 0; set p 1; set f 0; set fw $hd(body).pop_e}
	"file" {set i 0; set p 0; set f 1; set fw $hd(body).file_e}
    }
    rat_ed::enabledisable $i [list $hd(body).imap_l $hd(body).imap_e \
				  $hd(body).iuser_l $hd(body).iuser_e \
				  $hd(body).imap_adv]
    rat_ed::enabledisable $p [list $hd(body).pop_l $hd(body).pop_e \
				  $hd(body).puser_l $hd(body).puser_e \
				  $hd(body).pop_adv]
    rat_ed::enabledisable $f [list $hd(body).file_l $hd(body).file_e \
				  $hd(body).file_browse]
    if {[focus] != $fw} {
	focus $fw
	$fw selection range 0 end
    }
}

proc FirstUseWizardInboxAdv {id prot} {
    upvar \#0 $id hd
    global idCnt t propBigFont

    set id2 imapadv[incr idCnt]
    set w .$id2
    upvar \#0 $id2 hd2
    set hd2(host) $hd(${prot}_host)
    set hd2(name) Dummy

    toplevel $w -class TkRat
    wm title $w $t(first_use_wizard)
    label $w.title -textvariable ${id}(title) -font $propBigFont
    
    set hd2(body) [frame $w.body -bd 10]
    frame $w.buttons
    button $w.buttons.done -text "$t(done)" -state disabled \
	-command "set ${id}(action) done; destroy $w"
    button $w.buttons.cancel -text "$t(cancel)" -state disabled \
	-command "set ${id}(action) cancel; destroy $w"
    set hd2(next) $w.buttons.done
    pack $w.buttons.done -pady 10
    pack $w.title -side top -fill x
    pack $w.buttons -side bottom -fill x
    pack $w.body -fill both -expand 1

    bind $w <Escape> "destroy $w"
    wm protocol $w WM_DELETE_WINDOW "destroy $w"

    if {"imap" == $prot} {
	set hd2(user) $hd(imap_user)
	VFolderWizardIMAPServer $id2 standalone
    } else {
	set hd2(user) $hd(pop3_user)
	VFolderWizardPOP $id2 standalone
    }

    ::tkrat::winctl::SetGeometry firstUseAdv $w $w

    tkwait window $w

    if {"done" == $hd(action)} {
	set hd(mailServer) [VFolderWizardBuildNewServer $id2 $prot]
        set hd(${prot}_host) $hd2(host)
        set hd(${prot}_user) $hd2(user)
    }
    unset hd2
}

proc FirstUseWizardImport {id} {
    upvar \#0 $id hd
    global t

    FirstUseWizardReset $id
    lappend hd(history) FirstUseWizardImport
    set hd(title) $t(import_info)

    rat_flowmsg::create $hd(body).message -text "$t(import_info_text)"
    grid $hd(body).message - -sticky w -pady 10

    $hd(prev) configure -state normal
    $hd(next) configure -command "FirstUseWizardDone $id" -text $t(finish) \
	-state normal
    grid columnconfigure $hd(body) 1 -weight 1
    SetupShortcuts [list $hd(next) $hd(prev)]

    rat_scrollframe::recalc $hd(scrollbody)
}

proc FirstUseWizardDone {id} {
    upvar \#0 $id hd
    global option mailServer vFolderDef vFolderInbox t

    set r $option(default_role)
    set option($r,from) "$hd(fullname) <$hd(email_address)>"
    set option($r,sendprot) $hd(sendprot)
    set option($r,sendprog) $hd(sendprog)
    set option($r,smtp_hosts) $hd(smtp_hosts)

    # Setup incoming mailbox
    if {"pop3" == $hd(inproto) || "imap" == $hd(inproto)} {
	if {"pop3" == [lindex $vFolderDef($vFolderInbox) 1]
	    || "imap" == [lindex $vFolderDef($vFolderInbox) 1]} {
	    set si [lindex $vFolderDef($vFolderInbox) 3]
	} else {
	    if {"imap" == $hd(inproto)} {
		set si $hd(imap_host)
		set i 1		
		while {[info exists mailServer($si)]} {
		    set si "$hd(imap_host)-[incr i]"
		}
	    } else {
		set si 0
		foreach ms [array names mailServer] {
		    if { -1 != [lsearch -exact \
				    [lindex $mailServer($ms) 2] pop3]
			 && [string is integer $ms] && $ms > $si} {
			set si $ms
		    }
		}
		incr si
	    }
	}
	if {![info exists hd(mailServer)]} {
	    if {"pop3" == $hd(inproto)} {
		set hd(mailServer) \
		    [list $hd(pop3_host) 110 {pop3} $hd(pop3_user)]
	    } else {
		set hd(mailServer) [list $hd(imap_host) 143 {} $hd(imap_user)]
	    }
	}
	set mailServer($si) $hd(mailServer)
    }
    switch $hd(inproto) {
	"pop3" {
	    set def [list $t(inbox) pop3 {} $si]
	}
	"imap" {
	    set def [list $t(inbox) imap {} $si INBOX]
	}
	"file" {
	    set def [list $t(inbox) file {} $hd(filename)]
	}
    }
    set vFolderDef($vFolderInbox) $def

    SaveOptions
    VFolderWrite

    destroy $hd(top)
}