commit 2cc8b815ff7bd69c213256c32f8788ba85f13bd9
parent b9ba86872d2e419117a7e04acf1a27bde92a8350
Author: Claudio Alessi <smoppy@gmail.com>
Date: Wed, 24 Aug 2022 22:12:38 +0200
Manage multiple NAMES messages in a row.
Diffstat:
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/circo.c b/circo.c
@@ -108,6 +108,7 @@ struct Buffer {
int need_redraw;
int notify;
int totnames;
+ int recvnames;
Nick *names;
Buffer *next;
};
@@ -1144,8 +1145,6 @@ void
nicklist(Buffer *b, char *list) {
char *p, *np;
- freenames(&b->names);
- b->totnames = 0;
for(p = list, np = skip(list, ' '); *p; p = np, np = skip(np, ' ')) {
/* skip nick flags */
switch(*p) {
@@ -1329,6 +1328,11 @@ recv_names(char *host, char *par, char *names) {
if(!b)
b = status;
bprintf(sel, "NAMES in %s: %s\n", chan, names);
+ if(!b->recvnames) {
+ freenames(&b->names);
+ b->totnames = 0;
+ b->recvnames = 1;
+ }
nicklist(b, names); /* keep as last since names is altered by skip() */
}
@@ -1346,6 +1350,7 @@ recv_namesend(char *host, char *par, char *names) {
/* we don't actually need these on the status */
if(b == status)
freenames(&b->names);
+ b->recvnames = 0;
}
void