@@ 2,7 2,7 @@
[nanochat][src] utils
-see also [neauoire's client][100r] and probably other things
+see also [neauoire's client][100r], [olive's client][olive], and probably other things
## `ntalk.sh`: simple nanotalk server
@@ 18,11 18,18 @@ implemented with tail and head and wc. :P
requires you have wish(1) installed.
-boots to a config file, in which you can set fonts and stuff
+the config is just a tcl script.
+ntalk boots to a config file editor, in which you can set fonts and stuff
the connection is done entirely over $sok, so set that to whatever.
-if you want to include e.g. ssl, go ahead. the config file is saved
+if you want to include e.g. tcltls, go ahead. the config file is saved
to/read from ~/.config/ntalk/cscript.tcl.
+right click on any sixel in the chatlog, and you can save it under a custom name.
+saved sixels can be accessed through the "sixels" option in the top menu.
+slashes are interpreted, so naming one e.g. "faces / :D" will create a submenu called "faces".
+sixels are saved to/read from ~/.config/ntalk/cscript.tcl.
+each non-empty line stores one sixel, with the first '=' separating the name and the data.
+
if $cmds is set, it will be used for command parsing. it is inserted
into the body of a switch statement, with globbing enabled. you do
not need to start your commands with /. if $server is set, it'll be
@@ 32,6 39,7 @@ to see the builtin commands, read the source code. they're torwards
the bottom.
if tklib is installed, history will be setup on the main input box.
+if Thread is installed, netcode will run on a second thread (recommended!!!).
Ctrl-Shift-R will restart the client, allowing you to test config
changes rapidly. Ctrl-Q exits.
@@ 45,3 53,4 @@ when it was generated and from what server
[src]: https://git.phial.org/d6/nanochat
[100r]: https://git.sr.ht/~rabbits/nanotalk
+[olive]: https://git.sr.ht/~olive/moonchat
@@ 14,7 14,10 @@ proc restart {} {
exit 0
}
-wm title . ". o ( ntalk ) o ."
+proc settitle {title} {
+ wm title . ". o ( $title ) o ."
+}
+settitle ntalk
tk appname ntalk
@@ 467,7 470,7 @@ fconfigure $sok -translation lf; # dammit
set user [string trim $user]
.foot.name configure -text "${user}:"
-wm title . ". o ( nanochatting on $server ) o ."
+settitle "nanochatting on $server"
### NETCODE ###
@@ 564,13 567,19 @@ proc stat {} {
setclients $clients
}
-proc pollmsgs {} {
+set pmid {}
+proc pollmsgs {delay} {
+ global inrecv pmid
+ after cancel $pmid
+ set pmid [after $delay doskip $delay]
+}
+proc doskip {delay} {
global inrecv
if !$inrecv {
stat
skip
}
- after 10000 pollmsgs
+ set pmid [after $delay doskip $delay]
}
}
@@ 596,8 605,8 @@ if {[catch {package require Thread}] == 0} { # threading supported!
}] ";" $netcode]
- interp alias {} pollmsgs {} thread::send -async $nett pollmsgs
interp alias {} hist {} thread::send -async $nett hist
+ proc pollmsgs {n} [subst -nocommands { thread::send $nett [list pollmsgs [set n]] }]
proc send {line} [subst -nocommands { thread::send $nett [list send [set line]] }]
proc last {n} [subst -nocommands { thread::send -async $nett [list last [set n]] }]
} else {
@@ 677,7 686,15 @@ proc n64k_date {} {
### BOOT ###
last 64
-pollmsgs
+pollmsgs 15000
+
+set typingid {}
+bind .foot.input <KeyPress> {
+ after cancel $typingid
+ pollmsgs 3000
+ set typingid [after 15000 pollmsgs 15000]
+}
+
bind .foot.input <Return> [concat [bind .foot.input <Return>] ";" {
set line [.foot.input get]
@@ 731,3 748,4 @@ bind .foot.input <Return> [concat [bind .foot.input <Return>] ";" {
focus .foot.input
+