aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--src/cmd.c17
-rw-r--r--src/main.c49
3 files changed, 27 insertions, 41 deletions
diff --git a/Makefile b/Makefile
index 42d5957..e48f3c3 100644
--- a/Makefile
+++ b/Makefile
@@ -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
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;
}
}