autoscroll 1
autowrap 1
capture 1
+ showsockname 0
msg ""
fixed {}
fixedbold {}
state(time)
state(timeFormat)
state(fontSize)
+ state(showsockname)
extract(client)
extract(server)
extract(meta2)
.m.view add checkbutton -label " Capture" -underline 5 \
-variable state(capture) -command ToggleCapture
.m.view add separator
+ .m.view add checkbutton -label " Socket names" \
+ -variable state(showsockname) -command togglesockname
.m.view add checkbutton -label " Time" \
-variable state(time) -command redraw
.m.view add command -label " Time Format ..." -command timestampWindow
.out tag configure time_$t -background $colors($t) -borderwidth 1 \
-relief raised -lmargin1 5 -lmargin2 5 -font $state(fixedbold)
}
+ .out tag configure sockname -elide 1
.out tag configure client2 -font $state(fixedbold)
.out tag raise sel ;# Selection is most prominent
}
set state(autoscroll) $save_as
}
+
+proc togglesockname {} {
+ global state
+ .out tag configure sockname -elide [expr {!$state(showsockname)}]
+}
+
##+##########################################################################
#
# saveOutput -- Saves the content of the output window.
#
proc insertData {who data {time {}} {force 0}} {
global state
+ foreach {who sockname} $who break
array set prefix {meta = meta2 = client > server <}
if {$time == ""} { ;# If not set, then set to now
lappend tag client2
}
if {$state(gui)} {
- .out insert end "$timestamp" time_$tag "$line\n" $tag
+ .out insert end "$timestamp" time_$tag \
+ "$sockname " [concat $tag sockname] \
+ "$line\n" $tag
} else {
puts "$timestamp$prefix($who)$line"
}
regsub -all {([0-9a-f][0-9a-f])} $hex {\1 } hex
set line [format "%-48.48s %-16.16s\n" $hex [printable $line 1]]
if {$state(gui)} {
- .out insert end "$timestamp" time_$who "$line" $who
+ .out insert end "$timestamp" time_$who \
+ "$sockname " [list $who sockname] \
+ "$line" $who
} else {
puts "$timestamp$prefix(who)$line"
}
} else {
catch { puts -nonewline $toSock $data } ;# Forward if we have a socket
}
- insertData $who $data
+ insertData [list $who $fromSock] $data
update idletasks
}
##+##########################################################################