mirror of
https://git.lain.church/emil/moontalk.git
synced 2025-06-25 11:26:40 +00:00
update
This commit is contained in:
34
client/moontalk.tcl
Executable file
34
client/moontalk.tcl
Executable file
@ -0,0 +1,34 @@
|
||||
#!/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
|
Reference in New Issue
Block a user