aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-02-18 18:09:11 -0500
committerB. Watson <urchlay@slackware.uk>2026-02-18 18:09:11 -0500
commitd8c844c0320f816d5f7235fdc171c3e4d964a737 (patch)
treeb173c05bb622d8c6089dafb9427be99a6339f36e /src
parente05376aefc6b342859e8cddf9eca647dc61c3336 (diff)
downloadfujinet-chat-d8c844c0320f816d5f7235fdc171c3e4d964a737.tar.gz
Getting closer to working.
Diffstat (limited to 'src')
-rw-r--r--src/cmd.c17
-rw-r--r--src/main.c49
2 files changed, 26 insertions, 40 deletions
diff --git a/src/cmd.c b/src/cmd.c
index 89d8c4c..c187bb9 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -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(" :");
diff --git a/src/main.c b/src/main.c
index d15a7be..85404a2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -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;
}
}