|
NICK overwrote the nick with whatever was asked for, so two clients could
both be "alice": /NAMES listed her twice and a private message only ever
reached whichever slot came first in the table.
- A nick already held by another client is refused with 433
ERR_NICKNAMEINUSE and the client keeps the one it had. Unregistered
clients simply stay unregistered until they pick a free one, which is what
every client already expects.
- A NICK from a registered client is a rename: it is announced to the client
and to its channel, so nobody's user list goes stale.
- IRC names fold case, so "Alice" is "alice" - for the uniqueness check, for
PRIVMSG by nick, and for channels ("#GB" is "#gb"). One irceq() replaces
the exact-match compare that was used for all three.
gbos's own irc(1) already retries 433 by appending '_', so two Game Boys with
the default nick now sort themselves out: verified with a GB running ircd, a
laptop client holding "sl0pboy", and a second GB arriving as "sl0pboy_" -
both in #gbos, messages crossing both ways.
|
|
/# ircd &
host$ irssi -c 10.0.0.2 /join #gbos
other GB$ irc 10.0.0.2 gb2 /join #gbos
Implements the subset a real client needs to get in and talk: NICK, USER,
PING/PONG, JOIN, PART, PRIVMSG/NOTICE (to a channel or to a nick), NAMES and
QUIT, with the 001/004/375/372/376 numerics clients wait for on registration,
353/366 on join, and 421 for anything else. One channel per client keeps the
bookkeeping in fixed-size tables; this is a handheld with 8 KiB of task RAM.
MAXCL is 3, bounded by the kernel socket table (listener + client each take a
slot, the rest left for other programs). A fourth client is refused and the
daemon keeps serving - which is how the ~30s close() stall turned up.
Every event is logged to the LCD, so the Game Boy shows its own server
traffic: "+ alice", "alice joined", "<alice> hello".
Verified with real clients over the hub: two and three simultaneous hosts
registering, joining, channel relay (sender not echoed to itself), private
messages by nick, PING/PONG, unknown-command numerics, QUIT propagation, the
overflow refusal, and a second Game Boy running gbos's own irc(1) in the same
channel as a laptop client - messages crossing both ways between them.
|