aboutsummaryrefslogtreecommitdiff
path: root/src/irc.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2026-03-08 04:03:03 -0400
committerB. Watson <urchlay@slackware.uk>2026-03-08 04:03:03 -0400
commit1815d26c7042d3d592e624d8edf73805c7b3bc6d (patch)
tree29bb6e9f7d15714ad799ca290d5e03fa9846af09 /src/irc.c
parentff02ca89a0b0bae712c6bbc1de6bc50be13010a8 (diff)
downloadfujinet-chat-1815d26c7042d3d592e624d8edf73805c7b3bc6d.tar.gz
Send PMs to the correct window, more protocol stuff, add start+esc hotkey.HEADmaster
Diffstat (limited to 'src/irc.c')
-rw-r--r--src/irc.c81
1 files changed, 40 insertions, 41 deletions
diff --git a/src/irc.c b/src/irc.c
index 6a66f24..1f7aad3 100644
--- a/src/irc.c
+++ b/src/irc.c
@@ -95,16 +95,14 @@ static void do_privmsg(void) {
static void do_join(void) {
if(streq_i(usernick, msg_src)) {
- /* if our nick is the source, create the screen if needed. if a
- screen can't be created, no harm done. */
- if(scr_active == SCR_SERVER)
- scr_create(msg_dest, 1);
+ scr_print_active("You have ");
} else {
scr_print_active(msg_src);
- scr_print_active(" has joined ");
- scr_print_active(msg_dest);
- scr_eol_active();
+ scr_print_active(" has ");
}
+ scr_print_active("joined ");
+ scr_print_active(msg_dest);
+ scr_eol_active();
}
static void do_nick(void) {
@@ -158,11 +156,14 @@ static void do_kick(void) {
static void do_mode(void) {
int i;
- scr_print_active(msg_src);
+ if(msg_src)
+ scr_print_active(msg_src);
+ else
+ scr_print_active("Server");
scr_print_active(" sets mode: ");
for(i = 0; i < msg_argcount; i++) {
- scr_print_active(" ");
scr_print_active(msg_args[i]);
+ scr_print_active(" ");
}
if(msg_text) scr_print_active(msg_text);
scr_eol_active();
@@ -227,16 +228,6 @@ static void do_numeric(void) {
break;
/*
- case RPL_NAMREPLY:
- "Users in ##channel", msg_text
-
- case RPL_TOPIC:
- case RPL_NOTOPIC:
- set the topic for the screen, if there is one
-
- case RPL_TOPICWHOTIME:
- "Topic was set by <nick>", don't try to parse the UNIX timestamp.
-
case RPL_WHOISCERTFP:
case RPL_WHOISREGNICK:
case RPL_WHOISUSER:
@@ -252,16 +243,8 @@ static void do_numeric(void) {
case RPL_WHOISSECURE:
case RPL_WHOWASUSER:
These always go to the server window.
-
- case RPL_ENDOFWHOIS:
- case RPL_ENDOFWHOWAS:
- Don't print.
*/
- case RPL_ENDOFNAMES:
- /* don't print, just noise */
- break;
-
case ERR_NICKNAMEINUSE:
do_catchall(0);
if(!regged) {
@@ -276,20 +259,29 @@ static void do_numeric(void) {
case ERR_NOMOTD:
break;
+ case RPL_NAMREPLY:
+ scr_print_active(msg_args[2]);
+ scr_print_active(" users: ");
+ scr_print_active(msg_text);
+ scr_print_active("\n");
+ break;
+
+ case RPL_ENDOFNAMES:
+ /* don't print, just noise */
+ break;
+
case RPL_TOPIC:
- s = scr_getbyname(msg_args[1]);
- scr_print(s, "Topic for ");
- scr_print(s, msg_args[1]);
- scr_print(s, ": ");
- scr_print(s, msg_text);
- scr_putc(s, '\n');
+ scr_print_active("Topic for ");
+ scr_print_active(msg_args[1]);
+ scr_print_active(": ");
+ scr_print_active(msg_text);
+ scr_print_active("\n");
break;
case RPL_TOPICWHOTIME:
- s = scr_getbyname(msg_args[1]);
- scr_print(s, "Topic set by: ");
- scr_print(s, msg_args[1]);
- scr_putc(s, '\n');
+ scr_print_active("Topic set by ");
+ scr_print_active(msg_args[2]);
+ scr_print_active("\n");
break;
default:
@@ -306,12 +298,19 @@ static void invalid_msg(char type) {
void select_screen(void) {
char s;
- if(!msg_src || !msg_dest) {
+ if(!msg_dest) {
s = SCR_SERVER;
- } else {
+ } else if(*msg_dest == '#') {
s = scr_getbyname(msg_dest);
- if(!s && msg_dest[0] != '#')
- s = SCR_PRIV;
+ if(!s) s = SCR_SERVER;
+ } else {
+ s = scr_getbyname(msg_src);
+ if(!s) {
+ if(streq_i(msg_cmd, "PRIVMSG")) /* or maybe NOTICE? */
+ s = SCR_PRIV;
+ else
+ s = SCR_SERVER;
+ }
}
scr_activate(s);
}