circo

claudio's IRC oasis
git clone git://git.bitsmanent.org/circo
Log | Files | Refs | README | LICENSE

commit c0b3d85c9865e1be78aa2cab4f22cce4febd9513
parent 8ae29b85be214ea545dd68e4dadf131d4ea5b3c0
Author: Claudio Alessi <smoppy@gmail.com>
Date:   Thu, 19 Apr 2018 19:34:00 +0200

Reuse already opened buffers.

This allow to rejoin channels after reconnecting to a server (or change
server), without create a new buffer with the same name. Since circo is
single-server we can recycle the buffers with the same name.

Diffstat:
Mcirco.c | 10++++++----
1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/circo.c b/circo.c @@ -593,6 +593,7 @@ void focusprev(const Arg *arg) { Buffer *b, *nb; + nb = sel; if(sel == buffers) { for(b = buffers; b; b = b->next) nb = b; @@ -811,10 +812,11 @@ recv_join(char *who, char *chan, char *txt) { if(!*chan) chan = txt; - if(!strcmp(who, nick)) - b = sel = newbuf(chan); - else { - b = getbuf(chan); + b = getbuf(chan); + if(!b) { + if(strcmp(who, nick)) /* this should never happen here */ + return; + b = newbuf(chan); if(!b) /* malformed message */ return; }