aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-03-16 03:06:19 -0400
committerB. Watson <urchlay@slackware.uk>2026-03-16 03:06:19 -0400
commit545db9259365913f433f21f9c33f278fe96194d2 (patch)
tree8d8a3183bace932731357a3755023279861ebe75 /src
parent6d6c44d74e113ace4709f037316a2ec80753aa3a (diff)
downloadfujinet-chat-545db9259365913f433f21f9c33f278fe96194d2.tar.gz
Move screen statuses to the right, get rid of <>, add indicators for net activity and most-recent incoming IRC activity.
Diffstat (limited to 'src')
-rw-r--r--src/edbox.c4
-rw-r--r--src/indic8.c52
-rw-r--r--src/indic8.h16
-rw-r--r--src/irc.c11
-rw-r--r--src/main.c4
-rw-r--r--src/screen.c9
6 files changed, 92 insertions, 4 deletions
diff --git a/src/edbox.c b/src/edbox.c
index de9df79..8f325c2 100644
--- a/src/edbox.c
+++ b/src/edbox.c
@@ -135,9 +135,11 @@ static void normal_keystroke(void) {
switch(c) {
case CH_EOL:
// hide_cursor(); // already done by the caller
+ edbox_hide();
if(edbox_callback)
(*edbox_callback)();
- /* fall thru */
+ edbox_clear();
+ break;
case CH_CLR:
edbox_hide();
/* fall thru */
diff --git a/src/indic8.c b/src/indic8.c
new file mode 100644
index 0000000..66b4041
--- /dev/null
+++ b/src/indic8.c
@@ -0,0 +1,52 @@
+/* "indicators" */
+
+#include "addrs.h"
+
+#define NET_TX_CHR 0x5c /* COLOR1 up-arrow */
+#define NET_RX_CHR 0x5d /* COLOR1 down-arrow */
+#define NET_ERR_CHR 0xe1 /* COLOR3 exclamation mark */
+#define NET_IDLE_CHR 0 /* null (renders as a space) */
+
+#define J_CHR 0x4a /* COLOR1 J */
+#define P_CHR 0x50 /* COLOR1 P */
+#define Q_CHR 0x51 /* COLOR1 Q */
+#define M_CHR 0xcd /* COLOR3 M */
+#define CHAN_CHR 0x54 /* COLOR1 # */
+
+char *ind_net_status; /* initialized in screen.c, scr_init() */
+
+void ind_net_rx(void) {
+ *ind_net_status = NET_RX_CHR;
+}
+
+void ind_net_tx(void) {
+ *ind_net_status = NET_TX_CHR;
+}
+
+void ind_net_down(void) {
+ *ind_net_status = NET_ERR_CHR;
+}
+
+void ind_net_idle(void) {
+ *ind_net_status = NET_IDLE_CHR;
+}
+
+void ind_act_pm(void) {
+ ind_net_status[1] = M_CHR;
+}
+
+void ind_act_chantext(void) {
+ ind_net_status[1] = CHAN_CHR;
+}
+
+void ind_act_join(void) {
+ ind_net_status[1] = J_CHR;
+}
+
+void ind_act_part(void) {
+ ind_net_status[1] = P_CHR;
+}
+
+void ind_act_quit(void) {
+ ind_net_status[1] = Q_CHR;
+}
diff --git a/src/indic8.h b/src/indic8.h
new file mode 100644
index 0000000..4600363
--- /dev/null
+++ b/src/indic8.h
@@ -0,0 +1,16 @@
+extern char *ind_net_status;
+
+void ind_net_rx(void);
+void ind_net_tx(void);
+void ind_net_down(void);
+void ind_net_idle(void);
+
+void ind_act_pm(void);
+void ind_act_chantext(void);
+void ind_act_join(void);
+void ind_act_part(void);
+void ind_act_quit(void);
+
+/*
+void ind_clear(void);
+*/
diff --git a/src/irc.c b/src/irc.c
index cd11ba8..4de51ff 100644
--- a/src/irc.c
+++ b/src/irc.c
@@ -13,6 +13,7 @@
#include <conio.h>
#include "nio.h"
#include "config.h"
+#include "indic8.h"
#ifndef VERSION
#define VERSION "?????"
@@ -234,8 +235,10 @@ static void do_privmsg(void) {
if(*msg_dest == '#') {
do_chan_nick();
+ ind_act_chantext();
} else {
do_priv_nick();
+ ind_act_pm();
}
scr_print_active(msg_text);
@@ -252,6 +255,7 @@ static void do_notice(void) {
}
static void do_join(void) {
+ ind_act_join();
if(streq_i(conf->nick, msg_src)) {
scr_print_active("You have ");
} else {
@@ -264,6 +268,7 @@ static void do_join(void) {
}
static void do_nick(void) {
+ // ind_act_none();
if(streq_i(conf->nick, msg_src)) {
scr_print_active("You are ");
strncpy(conf->nick, msg_dest, 32);
@@ -277,12 +282,14 @@ static void do_nick(void) {
}
static void do_quit(void) {
+ ind_act_quit();
scr_print_active(msg_src);
scr_print_active(" has quit IRC");
print_reason();
}
static void do_part(void) {
+ ind_act_part();
scr_print_active(msg_src);
scr_print_active(" has left ");
scr_print_active(msg_dest);
@@ -665,6 +672,7 @@ int irc_read(void) {
if(err != 1) {
scr_display(SCR_SERVER);
regged = 0;
+ ind_net_down();
if(err == 136) {
scr_print_current("Disconnected");
} else {
@@ -681,9 +689,11 @@ int irc_read(void) {
if(rxbuflen > MAX_MSG)
rxbuflen = MAX_MSG;
+ ind_net_rx();
if(rxbuflen > 0) {
err = nread(conf->url, rx_buf, rxbuflen);
if(err != 1) {
+ ind_net_down();
print_errnum();
return 0;
}
@@ -694,6 +704,7 @@ int irc_read(void) {
irc_split_Lines();
}
+ ind_net_idle();
return 1;
}
diff --git a/src/main.c b/src/main.c
index f807cb6..c844f09 100644
--- a/src/main.c
+++ b/src/main.c
@@ -18,6 +18,7 @@
#include "edbox.h"
#include "config.h"
#include "keyclick.h"
+#include "indic8.h"
unsigned char err; // error code of last operation.
unsigned char trip = 0; // if trip == 1, fujinet is asking us for attention.
@@ -76,7 +77,9 @@ void txbuf_send(void) {
if(tx_buf[txbuflen - 1] != '\n')
tx_buf[txbuflen++] = '\n';
+ ind_net_tx();
nwrite(conf->url, tx_buf, txbuflen);
+ ind_net_idle();
txbuf_init();
}
@@ -180,6 +183,7 @@ void main(void) {
while(1) {
edbox_callback = cmd_execute;
if(fn_connect()) {
+ ind_net_idle();
irc_register();
irc_loop();
}
diff --git a/src/screen.c b/src/screen.c
index e71b5e8..350a60c 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -4,6 +4,7 @@
#include "addrs.h"
#include "screen.h"
#include "edbox.h"
+#include "indic8.h"
#define SDLST ((u16 *)0x0230)
@@ -42,6 +43,8 @@ void scr_init(void) {
OS.sdmctl = 0; /* disappear the screen */
+ ind_net_status = status_box + 40;
+
scr_waitvcount(112); /* after the last GR.0 line */
*SDLST = DLIST_BOT_ADDR;
OS.chbas = FONT_ADDR_HI;
@@ -135,9 +138,9 @@ void scr_show_status(char s) {
status_box[1] = ':';
strncpy(status_box + 2, scr_names[s], 32);
- p = status_box + 45;
+ p = status_box + 53; /* up against the right border */
- *p++ = '<';
+ // *p++ = '<';
// *p++ = 0xbc; // color2, maybe use?
for(i = 0; i < MAX_SCREENS; i++) {
sc = i + '1';
@@ -155,7 +158,7 @@ void scr_show_status(char s) {
}
*p++ = sc;
}
- *p++ = '>';
+ // *p++ = '>';
// *p++ = 0xbe;
if(!edbox_visible) {