1
0
mirror of https://git.lain.church/emil/moontalk.git synced 2025-05-20 02:16:45 +00:00
moontalk/moontalk.tcl
Emil Williams 90f617dcf0
init
2024-02-03 17:27:55 +00:00

35 lines
685 B
Tcl
Executable File

#!/usr/bin/tclsh
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