commit 87603a72db06bf8385595c0e00207ccd920a9790
parent 3276a0efed9a5c22c130d0aba47e69fe5e938845
Author: Claudio Alessi <smoppy@gmail.com>
Date: Thu, 10 Feb 2022 19:52:01 +0100
Rewrite and fix focus issue in JOIN handler
Diffstat:
M | circo.c | | | 24 | ++++++++++++------------ |
1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/circo.c b/circo.c
@@ -1077,21 +1077,21 @@ recv_busynick(char *u, char *u2, char *u3) {
void
recv_join(char *who, char *chan, char *txt) {
- Buffer *b;
+ Buffer *b = getbuf(chan);
- if(!*chan)
- chan = txt;
- b = getbuf(chan);
- if(!b)
- b = newbuf(chan);
- if(sel->kicked)
- sel->kicked = 0;
- sel = b;
- bprintf(b, "%CJOIN%..0C %s\n", colors[IRCMessage], who);
- if(strcmp(who, nick))
+ if(!strcmp(who, nick)) {
+ if(!b)
+ b = newbuf(chan);
+ else
+ b->kicked = 0; /* b may only be non-NULL due to this */
+ sel = b;
+ }
+ else {
nickadd(b, who);
+ }
+ bprintf(b, "%CJOIN%..0C %s\n", colors[IRCMessage], who);
if(b == sel)
- sel->need_redraw |= REDRAW_ALL;
+ b->need_redraw |= REDRAW_ALL;
}
void