From dc6297d5df43f87d1ed2ea1b5c1f5a5193ec235a Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Mon, 2 Mar 2026 22:03:10 -0500 Subject: Fix "nick already in use" and permutation. --- README.txt | 69 ++++++++++++++++++++++++++++++++++++-------------------- commands.txt | 13 +++++++---- editing_keys.txt | 3 +++ memsetup.asm | 3 +++ src/cmd.c | 4 ++-- src/edbox.c | 5 +++- src/irc.c | 29 +++++++++++++++++++----- ui_keys.txt | 6 +++-- 8 files changed, 93 insertions(+), 39 deletions(-) diff --git a/README.txt b/README.txt index 3e27daf..a1bc0d1 100644 --- a/README.txt +++ b/README.txt @@ -1,33 +1,54 @@ FujiNetChat - an IRC client for the Atari 8-bit with FujiNET. -For now, this is very rudimentary. It can currently: - -- connect to an IRC server -- complete the user/nick registrations process [*] -- respond to server PINGs -- join a channel (but only one!) -- send/receive channel messages -- receive private messages +For now, this is pretty rudimentary. It can currently: + +- connect to an IRC server. + +- complete the user/nick registration process, including handling the + "nickname already in use" error (by adding _, 1, 2, etc to the + user nick). + +- respond to server PINGs. + +- handles nick changes. + +- multi-window display, with one screens' worth of scrollback per + window. + +- join up to 5 channels, each in its own window. more than 5 channels + can be joined, but the extra ones get multiplexed together in the + server window. + +- send/receive channel messages. + +- "highlights" channel text that contains the user's nick. + +- receive private messages (in a dedicated private messages window). + +- server window to keep the chatty server messages from cluttering up + the channel windows. + - if you use raw IRC protocol, you can send private messages: /PRIVMSG :this is the message text. -[*] almost: it doesn't recover gracefully from "nick already in use" - or "invalid nick", and if the server truncates the nick, it doesn't - notice. +- input box at the bottom of the screen, allows editing and can + handle up to 239 characters of input. + +- status bar, shows the current window's number, name or channel, + and which other windows have new text in them. disappears (replaced + by the input box) when the user starts typing, and reappears when + the user presses Enter to send the message/command, or Shift-Clear + to abort it. + +Differences from FujiChat: -I have great plans for the future: +- FujiChat does its own TCP/IP and DNS, using SLIP. FujiNetChat offloads + the network stuff to the FujiNet device, freeing up memory for more + client features (e.g. the multi-window display). -- custom display. it will support multiple screens (like linux virtual - consoles), one per channel or query (PM conversation). of course due - to limited RAM, there won't be many windows supported. On a 48K - machine, probably 8 windows, each with a screens' worth of scrollback, - which means 16K of video memory... +- FujiChat only supports joining one channel, and has no multi-window display. -- an 'input box' at the bottom of the screen, so we don't have to keep - redrawing the user's input as data comes in. this will require a - custom display list. +- FujiChat can be used with software 80x25 or 64x32 text modes. FujiNetChat + is (currently) 40 columns, using GR.0 style text mode. -- a status bar that appears in place of the input box, until the user - starts typing (and reappears when he hits Return). it will show the - current window's channel or nick, and activity status for the other - windows. +- FujiNetChat allows you to type the { } ` ~ characters. diff --git a/commands.txt b/commands.txt index 44ab6c5..0443623 100644 --- a/commands.txt +++ b/commands.txt @@ -7,7 +7,7 @@ reply "/etc/passwd", that would be considered a command. You type "//etc/passwd" and the string "/etc/passwd" gets sent to the channel. Anything that starts with / that isn't listed here gets sent to the -IRC server as-is, minus the /. That's why /who and /whois arent't +IRC server as-is, minus the /. That's why /nick, /who, /whois aren't listed here, for instance. /j @@ -16,8 +16,8 @@ Joins a channel, creates a new screen if possible. If a screen can't be created, channel text will be sent to the [server] screen, and "/m #channel" must be used, to send to the channel. -/m -/msg +/m +/msg PRIVMSG to nick or channel. /q [] @@ -34,10 +34,15 @@ Parts (leaves) a channel. If no #chan is given, the current screen's channel is parted (if you're in a channel screen). If there's a screen for the channel, it gets closed. +/k [] +/kick [] +Kicks a user out of the channel. If no channel given, uses the current +screen's channel. Requires op privilege (+o) on the channel. + /ping [] With no argument: ping the server. With arg: CTCP ping the nick. -/me +/me CTCP ACTION. /ver diff --git a/editing_keys.txt b/editing_keys.txt index a653e6d..4279605 100644 --- a/editing_keys.txt +++ b/editing_keys.txt @@ -11,3 +11,6 @@ Up/Down arrows - move up/down by one line (40 chars) ^Y, Shift-Insert - paste (^U and ^W fill a paste buffer) Ctrl-Insert - toggle insert/typeover Atari key - compose? we don't really have the font for it :( +^U should be "delete to start of buffer", not delete whole line. +^K - kill (delete) to end of buffer. +Ctrl + Shift + Left/Right - move back/forward one word (space-separated). diff --git a/memsetup.asm b/memsetup.asm index 314a7df..fa81ae6 100644 --- a/memsetup.asm +++ b/memsetup.asm @@ -1,5 +1,8 @@ *= $2000 memsetup + lda $d301 ; PORTB + ora #$02 ; disable BASIC (XL/XE only) + sta $d301 lda #$80 sta $6a ; RAMTOP sta $02e6 ; MEMTOP high diff --git a/src/cmd.c b/src/cmd.c index d9abc87..7c757b7 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -25,9 +25,8 @@ static void cmd_chan_text(void) { scr_print_active("/"); scr_print_active(target); } - scr_print_active(" "); + scr_print_active("> "); scr_print_active(command); - scr_print_active(">"); scr_eol_active(); txbuf_set_str("PRIVMSG "); @@ -54,5 +53,6 @@ void cmd_command(const char *cmd) { } void cmd_execute(void) { + if(!*edit_box) return; cmd_command(edit_box); } diff --git a/src/edbox.c b/src/edbox.c index 0903cb9..167bdc2 100644 --- a/src/edbox.c +++ b/src/edbox.c @@ -200,6 +200,8 @@ void edbox_keystroke(void) { case 0x3c: /* caps */ OS.shflok ^= 0x40; keyclick(); + OS.ch = 0xff; + return; break; case 0x7c: /* shift-caps */ case 0xbc: /* ctrl-caps */ @@ -207,7 +209,8 @@ void edbox_keystroke(void) { case 0x67: /* ...w/shift */ case 0x97: /* ...w/ctrl */ case 0x9a: /* ctrl-3 (crash if cgetc() reads it!) */ - return; /* ignore it! */ + OS.ch = 0xff; /* ignore it! */ + return; break; default: break; diff --git a/src/irc.c b/src/irc.c index 9f1a280..460b4d0 100644 --- a/src/irc.c +++ b/src/irc.c @@ -7,6 +7,7 @@ #include "screen.h" #include "edbox.h" #include "numerics.h" +#include "keyclick.h" #include #include @@ -31,6 +32,11 @@ static void join_channel(void) { } */ +static void send_nick(void) { + txbuf_set_str2("NICK ", usernick); + txbuf_send(); +} + static void print_reason(void) { if(msg_text) { scr_print_active(": "); @@ -60,8 +66,9 @@ static void do_chan_nick(void) { scr_print_active(msg_dest); } hilite_bold(); - scr_print_active("> "); + scr_print_active(">"); hilite_bold(); + scr_print_active(" "); } static void do_priv_nick(void) { @@ -258,7 +265,7 @@ static void do_numeric(void) { do_catchall(0); if(!regged) { permute_nick(); - irc_register(); + send_nick(); } break; @@ -363,7 +370,7 @@ static void parse_msg(void) { } if(*p == ':') { - msg_src = p; /* generally :irc.example.com or :nick!user@host */ + msg_src = p + 1; /* generally :irc.example.com or :nick!user@host */ msg_cmd = strtok(0, " "); } else { msg_src = 0; /* no source supplied */ @@ -395,7 +402,6 @@ static void parse_msg(void) { if(msg_src) { if((p = strstr(msg_src, "!"))) { - msg_src++; *p = '\0'; } else if(strstr(msg_src, ".")) { msg_src = 0; @@ -486,8 +492,17 @@ void irc_register(void) { txbuf_set_str3("USER ", usernick, " 0 * :FujiNetChat User"); txbuf_send(); - txbuf_set_str2("NICK ", usernick); - txbuf_send(); + send_nick(); +} + +static void scrollback() { + OS.ch = 0xff; + scr_scrollback(); + while(OS.ch == 0xff) + /* NOP */ ; + keyclick(); + OS.ch = 0xff; + scr_end_scrollback(); } static void start_keystroke(void) { @@ -498,6 +513,8 @@ static void start_keystroke(void) { s = i - '1'; if(scr_status[s] != SCR_UNUSED) scr_display(s); + } else if(i == CH_CURS_UP || i == '-') { + scrollback(); } } diff --git a/ui_keys.txt b/ui_keys.txt index 07d2f72..ddc467d 100644 --- a/ui_keys.txt +++ b/ui_keys.txt @@ -1,11 +1,13 @@ Hold down Start and: 1-7 - switch screens +Up Arrow or "-" - scroll current screen up Future plans: A - switch to active screen Tab - switch to previous screen -S - show status (hide edit box). shows edit box again when Start released. +S - show status (hide edit box) Escape - close screen (end query, or part channel). needs confirmation! -Up/down arrows - scroll current screen +Left/Right - previous/next screen. +? - Show help (also the Help key by itself will do this). -- cgit v1.2.3