~aleteoryx/ntalk

actually update the timeout lmao
69a3bf45 — glenda 5 months ago
9talk/motd

refs

master
browse  log 

clone

read-only
https://git.amehut.dev/~aleteoryx/ntalk
read/write
git@git.amehut.dev:~aleteoryx/ntalk

You can also use your local clone with git send-email.

#ntalk

nanochat utils

see also teapot's client, olive's client, chloe's client, soxfox's client, d_m's client, zireh's client, bcntry's client, wolfdog's client, and probably other things

#ntalk.sh: simple nanotalk server

meant to be run under a connection broker like socat.

probably there's a chance of the file being clobbered. will get slower with more scrollback, cause it's just implemented with tail and head and wc. :P

#ntalk.tcl: tcl/tk nanotalk client

requires you have wish(1) installed.

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. tcltls, go ahead. the config file is saved to/read from ~/.config/ntalk/cscript.tcl.

there is a connect proc available to the config, that automatically sets up the socket with the right encoding and line endings. it is called the same as socket. it is provided to make interacting with nanobnc.py easier. its use is not mandatory, ntalk will ensure the socket is setup right later.

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, as part of a switch statement. the rhs is the command name, the lhs is the script. the contents of the line are in $line if $server is set, it'll be shown in the top bar. if $user is set, it'll be used for the username.

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.

Ctrl-Shift-R will restart the client, allowing you to test config changes rapidly. Ctrl-Q exits.

#9talk: rc client for plan 9

consists of the following scripts:

  • 9talk/log [addr]: connects to $addr, or a hard-coded default (edit it!), fetches the last 16 messages, and updates every 5 seconds
  • 9talk/cmd [addr] [nick]: connects to $addr with $nick, or hard-coded defaults (edit them!). for each input line, sends one of the following:
    • '!': sends $line.
    • '.' or ':': sends $nick $line.
    • '"' or no prefix: sends $nick: $line
  • 9talk/chat: opens a window with /log and /cmd running
  • 9talk/motd addr: checks for the most recent MOTD of $addr, and echos it. the most recent MOTD and last-seen message id are stored in $home/lib/9talk/$addr.motd and $home/lib/9talk/$addr.id, respectively.

#nanobnc.py: simple nanochat bouncer

this script should be run behind a connection broker, like socat. it assumes a client is attached to stdio. run it like:

socat TCP-LISTEN:22344,fork EXEC:'python nanobnc.py <password> [timeout]'

timeout is in seconds. it defaults to 1800, 30 minutes.

when a client connects, it should send a line of the form <addr> <port> <password>. if the password matches the one passed as an argument, the script will connect to the upstream nanochat server at addr:port. data is blindly copied between the client and the upstream, until either the client and server are idle for timeout seconds, or until the client sends QUIT, at which point the script gracefully disconnects from the upstream server, and exits

to use this with ntalk, replace the set sok ... line in your config with the following:

set sok [connect <bnc addr> <bnc port>]
puts $sok "<upstream addr> <upstream port> <password>"

as this script is essentially an open TCP proxy, be very careful with your choice of password, and with who you allow to access the server.

#scrollbackup.sh: simple backup script

just sends HIST and QUIT and logs it to a file whose name indicates when it was generated and from what server

#botlib.py: nanochat bot library

contains some functions for writing a nanochat bot. mostly netcode and code to parse input lines. it is intentionally very idiosyncratic and loose in how it parses stuff.

#dee.py: ``advanced'' AI for nanochat

a simple bot. documented at https://aleteoryx.me/deeman.md.