diff options
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 31 |
1 files changed, 25 insertions, 6 deletions
@@ -23,7 +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; +char reconnect_timeout = 1; /* TODO: user modes (default +iw), fg/bg color... */ @@ -92,11 +92,10 @@ int fn_connect(void) { err = nopen(conf->url, FNET_TRANSLATION); if(err != SUCCESS) { - bell(); scr_print_current("Connection failed: "); print_errnum(); scr_eol_current(); - cgetc(); + bell(); return 0; } @@ -131,6 +130,27 @@ void init_channels(void) { } void reconnect_wait(void) { + scr_display(SCR_SERVER); + scr_print_current("Press a key"); + + /* IMO, 0xff is easier to understand than KEY_NONE, here */ + OS.cdtmf3 = OS.ch = 0xff; + + if(reconnect_timeout) { + OS.cdtmv3 = reconnect_timeout * hz; + scr_print_current(" or wait "); + itoa(reconnect_timeout, numbuf, 10); + scr_print_current(numbuf); + scr_print_current(" sec"); + if(reconnect_timeout < 64) + reconnect_timeout <<= 1; + } + scr_print_current(" to reconnect.\n"); + + while(OS.cdtmf3 == 0xff && OS.ch == 0xff) + /* NOP */; + + OS.ch = 0xff; } void main(void) { @@ -152,9 +172,8 @@ void main(void) { if(fn_connect()) { irc_register(); irc_loop(); - fn_disconnect(); - } else { - reconnect_wait(); } + fn_disconnect(); + reconnect_wait(); } } |
