From ced2f97c201def0356f0fa0601b3c7ad5fb71a6c Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 10 Mar 2026 04:20:27 -0400 Subject: Start+Q to open a screen for the last channel/nick we got a message from. --- src/irc.c | 13 +++++++++++-- src/irc.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/irc.c b/src/irc.c index ab630d3..9a5b7a9 100644 --- a/src/irc.c +++ b/src/irc.c @@ -34,6 +34,7 @@ static char scr_prev = SCR_PRIV; char numbuf[10]; char last_pm_nick[33]; +char last_chan[33]; /* without a screen */ /* static void join_channel(void) { @@ -442,7 +443,10 @@ void select_screen(void) { s = SCR_SERVER; } else if(*msg_dest == '#') { s = scr_getbyname(msg_dest); - if(!s) s = SCR_SERVER; + if(!s) { + strncpy(last_chan, msg_dest, 32); + s = SCR_SERVER; + } } else { s = scr_getbyname(msg_src); if(!s) { @@ -740,8 +744,13 @@ static void start_keystroke(void) { return; case 'q': case 'Q': - if(*last_pm_nick) + if(scr_current == SCR_PRIV && *last_pm_nick) { scr_create(last_pm_nick, 1); + *last_pm_nick = 0; + } else if(scr_current == SCR_SERVER && *last_chan) { + scr_create(last_chan, 1); + *last_chan = 0; + } return; case 'a': case 'A': diff --git a/src/irc.h b/src/irc.h index 0d91d3f..4b57df3 100644 --- a/src/irc.h +++ b/src/irc.h @@ -49,6 +49,7 @@ extern int msg_argcount; extern char irc_away; extern char bell_type; extern char last_pm_nick[33]; +extern char last_chan[33]; /* call this once, right after TCP connection is established. */ void irc_register(void); -- cgit v1.2.3