diff options
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 36 |
1 files changed, 7 insertions, 29 deletions
@@ -4,10 +4,6 @@ #define VERSION "0.0" #define BANNER SELF " v" VERSION " (B. Watson)\n" -#define DEF_URL "N:TCP://irc.libera.chat:6667" -#define DEF_NICK "FNChatTest" -#define DEF_CHANNEL "##atari" - #include <atari.h> #include <stdlib.h> #include <stdio.h> @@ -18,9 +14,8 @@ #include "irc.h" #include "screen.h" #include "edbox.h" +#include "config.h" -char url[256] = DEF_URL; // URL. -char usernick[32] = DEF_NICK; // our current nick (can be changed by the server) unsigned char err; // error code of last operation. unsigned char trip = 0; // if trip == 1, fujinet is asking us for attention. char old_enabled = 0; // were interrupts enabled for old vector @@ -33,23 +28,6 @@ char hz; /* 50 for PAL, 60 for NSTC */ extern void ih(); // defined in intr.s -void get_config(void) { - scr_print_current(BANNER); - - while(1) { - scr_print_current("URL?\n"); - edbox_readline(url, sizeof(url)); - scr_print_current("Nick?\n"); - edbox_readline(usernick, sizeof(usernick)); - - /* - scr_print_current("Are these settings OK [Y/n]?\n"); - if(tolower(cgetc()) != 'n') - */ - break; - } -} - void txbuf_init(void) { txbuflen = tx_buf[0] = 0; } @@ -94,7 +72,7 @@ void txbuf_send(void) { if(tx_buf[txbuflen - 1] != '\n') tx_buf[txbuflen++] = '\n'; - nwrite(url, tx_buf, txbuflen); + nwrite(conf->url, tx_buf, txbuflen); txbuf_init(); } @@ -106,10 +84,10 @@ void txbuf_send_str(const char *str) { int fn_connect(void) { scr_print(SCR_SERVER, "Connecting to: "); - scr_print(SCR_SERVER, url); + scr_print(SCR_SERVER, conf->url); scr_print(SCR_SERVER, "\n"); - err = nopen(url, FNET_TRANSLATION); + err = nopen(conf->url, FNET_TRANSLATION); if(err != SUCCESS) { scr_print(SCR_SERVER, "Connection failed: "); @@ -135,10 +113,11 @@ void fn_disconnect(void) { } int main(void) { + bell_type = conf->alert_type; /* TODO: have bell.s read staight from the struct */ OS.shflok = 0; // turn off shift-lock. OS.soundr = 0; // Turn off SIO beeping sound - OS.color2 = 0xc0; /* darkest green background */ - OS.color1 = 0x0c; /* bright text */ + OS.color2 = conf->colors[0]; + OS.color1 = conf->colors[1]; hz = (GTIA_READ.pal & 0x0e) ? 60 : 50; @@ -146,7 +125,6 @@ int main(void) { scr_init(); while(1) { - get_config(); edbox_callback = cmd_execute; if(fn_connect()) { irc_register(); |
