From 8b76e79585aa1ed0a3bc4c1708f2d270aac239fc Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 13 Mar 2026 01:33:21 -0400 Subject: "Connection failed" waits for a keypress before reconnect. --- Makefile | 12 ++++++++++++ TODO | 18 +++++++++++------- src/irc.c | 7 ++----- src/irc.h | 2 ++ src/main.c | 48 ++++++++++++++++++++++++++++++------------------ 5 files changed, 57 insertions(+), 30 deletions(-) diff --git a/Makefile b/Makefile index 6377c1e..fc33866 100644 --- a/Makefile +++ b/Makefile @@ -38,3 +38,15 @@ install: all cp fnchat.xex $(TESTXEX) sluk $(TESTXEX) scp $(TESTXEX) zapp:/var/tnfs/ + +atr: all + cp atr/dos_20s.atr atr/fnchat-dos2.atr + cp atr/dos25_sd.atr atr/fnchat-dos25.atr + cp atr/mydos_sd.atr atr/fnchat-mydos.atr + cp fnchat.xex atr/autorun.sys + cp fnchat.xex atr/fnchat.ar0 + cd atr ; \ + axe -w autorun.sys fnchat-dos2.atr ; \ + axe -w autorun.sys fnchat-dos25.atr ; \ + axe -w fnchat.ar0 fnchat-mydos.atr ; \ + cp fnchat-dos2.atr fnchat-dos25.atr fnchat-mydos.atr /var/tnfs diff --git a/TODO b/TODO index efaf391..3d43096 100644 --- a/TODO +++ b/TODO @@ -12,12 +12,19 @@ FujiChat features, we're almost at parity! Other stuff: +- Bug: if you're in screen 7, and you press start+7, the character + at position (16,0) gets overwritten with a space (which might + be 0x20 or 0x00, they're both "spaces"). +- Bug: when you're typing in the editbox and text comes in on + another screen, the editbox gets hidden (not harmful, pressing + a key lets you continue typing, but it's annoying). - In the config, under SDX, saying "N" to "Settings OK" and then reloading the config causes screen corruption (reported by TheDoctor, not tried it myself). - /ping nick works, but /ctcp ping nick doesn't put the timestamp in the request. -- KICK isn't being parsed/formatted correctly. +- "User has kicked from #channel", the name should be + replaced by "you". - Gracefully handle nicks/channels whose lengths are stupid long. At least we shouldn't overflow any buffers. - Channel tab completion for the [server] screen. @@ -26,17 +33,14 @@ Other stuff: - At least one keyboard macro (for ChanServ auth). More would be nice, if we can afford the RAM. - Error numerics should go to the current screen (?). -- Autojoin on startup (see config file section below). +- Autojoin on startup (see config file section below). Partially done. - Add an optional key parameter to /join (key). spec calls for it, I've never seen it used. -- Decide whether to allow mass joins: /join #chan1,#chan2,#chan3 - not sure how widely supported it is on various networks. right - now, it's explicitly not allowed. - better to do it client-side, /join #chan1 #chan2 #chan3, - accept lots of arguments (but don't support keys). +- Allow mass joins as "/join #chan1 #chan2 #chan3" (without commas). If someone does need channel keys, we can support that with a 2-arg /join whose 2nd arg doesn't start with #... unless the key starts with #! Give this further thought. +- Allow creating multiple queries as "/query jim bob joe". - /join also supports "/join 0", which parts all channels. don't have to do anything special for it, but do document it. - 'Dead' screens (channels we've parted, or failed to join) should diff --git a/src/irc.c b/src/irc.c index 1d2907d..95ab584 100644 --- a/src/irc.c +++ b/src/irc.c @@ -16,8 +16,6 @@ #define MAX_MSG 512 -extern void __fastcall__ bell(void); /* see src/bell.s */ - char *msg_src, *msg_cmd, *msg_dest, *msg_text; char *msg_args[MAX_MSG_ARGS]; int msg_argcount; @@ -622,7 +620,6 @@ void print_errnum(void) { scr_print_current("Error #"); itoa(err, numbuf, 10); scr_print_current(numbuf); - scr_print_current(", press any key...\n"); } int irc_read(void) { @@ -633,13 +630,13 @@ int irc_read(void) { if(err != 1) { regged = 0; if(err == 136) { - scr_print_current("Disconnected, press any key...\n"); + scr_print_current("Disconnected"); } else { print_errnum(); } + scr_print_current(", press any key...\n"); bell(); cgetc(); - scr_display(0); return 0; } diff --git a/src/irc.h b/src/irc.h index d513604..203f4dc 100644 --- a/src/irc.h +++ b/src/irc.h @@ -59,6 +59,8 @@ void irc_loop(void); void print_errnum(void); +void __fastcall__ bell(void); /* see src/bell.s */ + /**** cmd.c */ void cmd_command(char *cmd); void cmd_execute(void); diff --git a/src/main.c b/src/main.c index a701324..59f751e 100644 --- a/src/main.c +++ b/src/main.c @@ -23,6 +23,7 @@ void *old_vprced; // old PROCEED vector, restored on exit. unsigned short rxbuflen; // RX buffer length unsigned int txbuflen; // TX buffer length char hz; /* 50 for PAL, 60 for NSTC */ +char reconnect_timeout; /* TODO: user modes (default +iw), fg/bg color... */ @@ -83,26 +84,32 @@ void txbuf_send_str(const char *str) { } int fn_connect(void) { - scr_print(SCR_SERVER, "Connecting to: "); - scr_print(SCR_SERVER, conf->url); - scr_print(SCR_SERVER, "\n"); + scr_display(SCR_SERVER); + scr_print_current("Connecting to: "); + scr_print_current(conf->url); + scr_eol_current(); + + err = nopen(conf->url, FNET_TRANSLATION); + + if(err != SUCCESS) { + bell(); + scr_print_current("Connection failed: "); + print_errnum(); + scr_eol_current(); + cgetc(); + return 0; + } - err = nopen(conf->url, FNET_TRANSLATION); + // Open successful, set up interrupt + old_vprced = OS.vprced; // save the old interrupt vector + old_enabled = PIA.pactl & 1; // keep track of old interrupt state + PIA.pactl &= (~1); // Turn off interrupts before changing vector + OS.vprced = ih; // Set PROCEED interrupt vector to our interrupt handler. + PIA.pactl |= 1; // Indicate to PIA we are ready for PROCEED interrupt. - if(err != SUCCESS) { - scr_print(SCR_SERVER, "Connection failed: "); - print_errnum(); - return 0; - } - - // Open successful, set up interrupt - old_vprced = OS.vprced; // save the old interrupt vector - old_enabled = PIA.pactl & 1; // keep track of old interrupt state - PIA.pactl &= (~1); // Turn off interrupts before changing vector - OS.vprced = ih; // Set PROCEED interrupt vector to our interrupt handler. - PIA.pactl |= 1; // Indicate to PIA we are ready for PROCEED interrupt. - - return 1; + reconnect_timeout = 1; + + return 1; } void fn_disconnect(void) { @@ -123,6 +130,9 @@ void init_channels(void) { } } +void reconnect_wait(void) { +} + void main(void) { bell_type = conf->alert_type; /* TODO: have bell.s read staight from the struct */ OS.shflok = 0; // turn off shift-lock. @@ -143,6 +153,8 @@ void main(void) { irc_register(); irc_loop(); fn_disconnect(); + } else { + reconnect_wait(); } } } -- cgit v1.2.3