diff options
| author | B. Watson <urchlay@slackware.uk> | 2026-02-18 18:09:11 -0500 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2026-02-18 18:09:11 -0500 |
| commit | d8c844c0320f816d5f7235fdc171c3e4d964a737 (patch) | |
| tree | b173c05bb622d8c6089dafb9427be99a6339f36e | |
| parent | e05376aefc6b342859e8cddf9eca647dc61c3336 (diff) | |
| download | fujinet-chat-d8c844c0320f816d5f7235fdc171c3e4d964a737.tar.gz | |
Getting closer to working.
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | src/cmd.c | 17 | ||||
| -rw-r--r-- | src/main.c | 49 |
3 files changed, 27 insertions, 41 deletions
@@ -3,7 +3,7 @@ PARTS=memsetup.xex font_dl.xex client.xex # remove the -a if using older versions of atasm ATASM=atasm -s -a -all: fnchat.xex +all: clean fnchat.xex fnchat.xex: $(PARTS) cat $(PARTS) > fnchat.xex @@ -4,7 +4,24 @@ #include "addrs.h" #include "screen.h" +/* A "command" is actually anything the user types, whether or + not it starts with a /character. */ + void cmd_chan_text(const char *cmd) { + char s; + + s = scr_getbyname(channel); + scr_activate(s); + + /* 0x02 = ^B = enable bold */ + scr_print_active("\x02<"); + scr_print_active(usernick); + if(!s) { + scr_print_active("/"); + scr_print_active(channel); + } + scr_print_active(">\x02 "); + txbuf_set_str("PRIVMSG "); txbuf_append_str(channel); txbuf_append_str(" :"); @@ -33,54 +33,23 @@ unsigned char rx_buf[MAX_IRC_MSG_LEN]; // RX buffer. unsigned char tx_buf[MAX_IRC_MSG_LEN]; // TX buffer. unsigned int txbuflen; // TX buffer length char channel[32] = DEF_CHANNEL; -static char got_line; /* TODO: user modes (default +iw), fg/bg color... */ extern void ih(); // defined in intr.s -static void strcpy_to_eol(char *dst, const char *src) { - while(*src && (*src != CH_EOL)) { - *dst++ = *src++; - } - *dst = '\0'; -} - -static void return_pressed(void) { - got_line = 1; -} - -static void get_line(void) { - got_line = 0; - edbox_callback = return_pressed; - while(!got_line) - edbox_keystroke(); - scr_print(SCR_SERVER, edit_box); -} - void get_config(void) { - scr_print(SCR_SERVER, BANNER); + scr_print_current(BANNER); while(1) { - scr_print(SCR_SERVER, "\nURL ["); - scr_print(SCR_SERVER, url); - scr_print(SCR_SERVER, "]?\n"); - get_line(); - if(edit_box[0] != CH_EOL) strcpy_to_eol(url, edit_box); - - scr_print(SCR_SERVER, "Nick ["); - scr_print(SCR_SERVER, usernick); - scr_print(SCR_SERVER, "]?\n"); - get_line(); - if(edit_box[0] != CH_EOL) strcpy_to_eol(usernick, edit_box); - - scr_print(SCR_SERVER, "Channel ["); - scr_print(SCR_SERVER, channel); - scr_print(SCR_SERVER, "]?\n"); - get_line(); - if(edit_box[0] != CH_EOL) strcpy_to_eol(channel, edit_box); - - scr_print(SCR_SERVER, "\n\nAre these settings OK [Y/n]?\n"); + scr_print_current("URL?\n"); + edbox_readline(url, sizeof(url)); + scr_print_current("Nick?\n"); + edbox_readline(usernick, sizeof(usernick)); + scr_print_current("Channel?\n"); + edbox_readline(channel, sizeof(channel)); + + scr_print_current("Are these settings OK [Y/n]?\n"); if(tolower(cgetc()) != 'n') break; } } |
