aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-03-28 06:35:19 -0400
committerB. Watson <urchlay@slackware.uk>2026-03-28 06:35:19 -0400
commitf8d11de72ddbefd87532102f04cf182a3f122529 (patch)
tree3e71fc341357d2908be3f5b7b63bc9e472be408b /src
parentb6a51ea52ab2b58e9b6687170547be7536c0fa9c (diff)
downloadfujinet-chat-f8d11de72ddbefd87532102f04cf182a3f122529.tar.gz
Save a few bytes...
Diffstat (limited to 'src')
-rw-r--r--src/cmd.c37
-rw-r--r--src/irc.c36
-rw-r--r--src/screen.c8
-rw-r--r--src/screen.h8
4 files changed, 35 insertions, 54 deletions
diff --git a/src/cmd.c b/src/cmd.c
index e0481c5..b7d9e68 100644
--- a/src/cmd.c
+++ b/src/cmd.c
@@ -9,7 +9,7 @@
#include "config.h"
/* A "command" is actually anything the user types, whether or
- not it starts with a /character. */
+ not it starts with a / character. */
char *command, *arg1, *arg2, *arg3;
static char *target;
@@ -88,14 +88,7 @@ static void cmd_chan_text(void) {
/* 0x02 = ^B = enable bold */
scr_print_active("<\x02");
scr_print_active(conf->nick);
- scr_print_active("\x02");
-
- /*
- if(!scr_current) {
- scr_print_active("/");
- scr_print_active(target);
- }
- */
+ scr_putc_active('\x02');
scr_print_active("> ");
scr_print_active(command);
@@ -314,16 +307,18 @@ void cmd_ctcp_ping(char *nick) {
do_ctcp_ping();
}
-static void do_ctcp_info(void) {
- arg2 = "CLIENTINFO";
+static void do_no_arg_ctcp(char *type) {
+ arg2 = type;
arg3 = 0;
send_ctcp();
}
+static void do_ctcp_info(void) {
+ do_no_arg_ctcp("CLIENTINFO");
+}
+
static void do_ctcp_ver(void) {
- arg2 = "VERSION";
- arg3 = 0;
- send_ctcp();
+ do_no_arg_ctcp("VERSION");
}
static void do_ctcp(void) {
@@ -486,29 +481,25 @@ static void cmd_slash(void) {
cmd_remote();
}
-void cmd_command(char *cmd) {
- command = cmd;
+void cmd_execute(void) {
+ if(!*edit_box) return;
+ command = edit_box;
if(scr_current > 1)
target = scr_get_cur_name();
else
target = 0;
- if(cmd[0] == '/' && cmd[1] && cmd[1] != '/')
+ if(command[0] == '/' && command[1] && command[1] != '/')
cmd_slash();
else if(target)
cmd_chan_text();
else if(scr_current == SCR_PRIV || scr_current == SCR_SERVER)
- cmd_send_pm(cmd);
+ cmd_send_pm(command);
else
err_no_scr_target();
}
-void cmd_execute(void) {
- if(!*edit_box) return;
- cmd_command(edit_box);
-}
-
void cmd_rejoin_chans(void) {
char i;
diff --git a/src/irc.c b/src/irc.c
index e4c0184..6b2b599 100644
--- a/src/irc.c
+++ b/src/irc.c
@@ -78,7 +78,7 @@ static void do_pong(void) {
}
static void bold(void) {
- scr_print_active("\x02");
+ scr_putc_active('\x02');
}
static void hilite_bold(void) {
@@ -88,30 +88,28 @@ static void hilite_bold(void) {
static void do_chan_nick(void) {
if(hilite) {
bell();
- // scr_hilite_active();
new_scr_status = SCR_HILITE;
}
hilite_bold();
- scr_print_active("<");
+ scr_putc_active('<');
hilite_bold();
scr_print_active(msg_src);
if(scr_active == SCR_SERVER) {
/* if we don't have a window for it */
- scr_print_active("/");
+ scr_putc_active('/');
scr_print_active(msg_dest);
}
hilite_bold();
- scr_print_active(">");
+ scr_putc_active('>');
hilite_bold();
- scr_print_active(" ");
+ scr_putc_active(' ');
}
static void do_priv_nick(void) {
if(msg_src) {
- scr_print_active("*");
+ scr_putc_active('*');
scr_print_active(msg_src);
scr_print_active("* ");
- // scr_hilite_active();
new_scr_status = SCR_HILITE;
bell();
}
@@ -147,14 +145,14 @@ static void print_ping_time(char *p) {
scr_print_active(" lag: ");
itoa(sec, numbuf, 10);
scr_print_active(numbuf);
- scr_print_active(".");
+ scr_putc_active('.');
itoa(frac, numbuf, 10);
scr_print_active(numbuf);
- scr_print_active(" sec");
+ scr_putc_active('s');
/*
// for debugging:
- scr_print_active(" ");
+ scr_putc_active(' ');
itoa(pingtime, numbuf, 10);
scr_print_active(numbuf);
*/
@@ -203,7 +201,7 @@ static void do_ctcp(int is_notice) {
if(streq_i(ctcp_type, "ACTION")) {
scr_print_active("* ");
scr_print_active(msg_src);
- scr_print_active(" ");
+ scr_putc_active(' ');
scr_print_active(p);
scr_eol_active();
return;
@@ -355,7 +353,7 @@ static void do_mode(void) {
scr_print_active(" sets mode: ");
for(i = 0; i < msg_argcount; i++) {
scr_print_active(msg_args[i]);
- scr_print_active(" ");
+ scr_putc_active(' ');
}
if(msg_text) scr_print_active(msg_text);
scr_eol_active();
@@ -367,18 +365,18 @@ static void do_mode(void) {
static void do_catchall(int arg) {
if(msg_src) {
scr_print_active(msg_src);
- scr_print_active(" ");
+ scr_putc_active(' ');
}
scr_print_active(msg_cmd);
for(; arg < msg_argcount; arg++) {
- scr_print_active(" ");
+ scr_putc_active(' ');
scr_print_active(msg_args[arg]);
}
if(msg_text) {
- scr_print_active(" ");
+ scr_putc_active(' ');
scr_print_active(msg_text);
}
scr_eol_active();
@@ -586,8 +584,10 @@ static void dispatch_msg(void) {
}
if(scr_active != scr_current) {
- scr_status[scr_active] = new_scr_status;
- scr_show_status(scr_current);
+ if(scr_status[scr_active] < new_scr_status) {
+ scr_status[scr_active] = new_scr_status;
+ scr_show_status(scr_current);
+ }
}
}
diff --git a/src/screen.c b/src/screen.c
index 2645515..258a4a7 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -188,14 +188,6 @@ void scr_show_status(char s) {
}
}
-/*
-void scr_hilite_active(void) {
- if(scr_active == scr_current) return;
- scr_status[scr_active] = SCR_HILITE;
- scr_show_status(scr_current);
-}
-*/
-
void scr_refresh(void) {
scr_display(scr_current);
}
diff --git a/src/screen.h b/src/screen.h
index 0d3e268..af95690 100644
--- a/src/screen.h
+++ b/src/screen.h
@@ -7,9 +7,9 @@
#define SCR_UNUSED 0
#define SCR_INACTIVE 1
-#define SCR_ACTIVE 2
-#define SCR_HILITE 3
-#define SCR_OTHER 4
+#define SCR_OTHER 2
+#define SCR_ACTIVE 3
+#define SCR_HILITE 4
#define SCR_SERVER 0
#define SCR_PRIV 1
@@ -102,8 +102,6 @@ void scr_print_priv(const char *text);
will have to call this. */
void scr_activate(char s);
-void scr_hilite_active(void);
-
char *scr_get_cur_name(void);
/* XXX: this really should be in a utils.c or common.c... */