aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-03-13 01:33:21 -0400
committerB. Watson <urchlay@slackware.uk>2026-03-13 01:33:21 -0400
commit8b76e79585aa1ed0a3bc4c1708f2d270aac239fc (patch)
tree55634e671f71fff34b2965f20c050f14da2dd319 /src/main.c
parent6e91705c7beffe86aa92e315b98427c480b6453a (diff)
downloadfujinet-chat-8b76e79585aa1ed0a3bc4c1708f2d270aac239fc.tar.gz
"Connection failed" waits for a keypress before reconnect.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c48
1 files changed, 30 insertions, 18 deletions
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();
}
}
}