moontalk/client/moontalk.tcl
2024-02-03 17:38:35 +00:00

38 lines
739 B
Tcl
Executable File

#!/usr/bin/tclsh
# Originally written by an Anon. Slightly modified.
package require Tk
set ::name anonymous
set ::usernu x
set ::host 7ks473deh6ggtwqsvbqdurepv5i6iblpbkx33b6cydon3ajph73sssad.onion
pack [text .msgs] -fill both -expand 1
pack [entry .entry] -fill x
proc add_msg { msg } {
.msgs insert end "$msg\n"
.msgs yview end
}
proc get_msg {} {
set curdate [clock format [clock seconds] -format "%Y/%m/%d %T"]
return "<$curdate $::name:$::usernu> [.entry get]"
}
bind .entry <Return> {
set msg [get_msg]
puts $::fd $msg
flush $::fd
add_msg $msg
.entry delete 0 end
}
fileevent [set fd [socket $::host 50000]] readable {
add_msg [gets $::fd]
}
chan configure $::fd -translation binary