From 0e7f232b3d5ecb484d9d91bdd7e4b6d4e7791585 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Sat, 9 Aug 2025 13:25:03 +0100 Subject: Correctly process 353 RPL_NAMREPLYs for secret and private channels. --- functions.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'functions.c') diff --git a/functions.c b/functions.c index 8ef2b21..54e2663 100644 --- a/functions.c +++ b/functions.c @@ -1596,7 +1596,7 @@ int isnickinanychannel(struct channel *channels, int maxchannelcount, char *nick return 0; } -// Populate our channels struct with all nicks in a RPL_NAMREPLY +// Populate our channels struct with all nicks in a 353 RPL_NAMREPLY // Returns 1 on success or 0 on failure int addnamereplytochannel(char *namereply, struct channel *channels, int maxchannelcount) { //:irc.tghost.co.uk 353 blabounce = #blabouncer :blabounce bbnick ~@l_bratch @l_blabnc Hughbla Bratchbot ars @@ -1609,10 +1609,12 @@ int addnamereplytochannel(char *namereply, struct channel *channels, int maxchan // Strip the leading ':' stripprefix(strcopy, 1); - // Find the start of the channel name, which comes after the first '=' followed by a space + // Find the start of the channel name, which comes after the first '=', '*', or '@', followed by a space + // From RFC 2812: + // "@" is used for secret channels, "*" for private channels, and "=" for others (public channels). int channelpos = -1; for (size_t i = 0; i < strlen(strcopy) - 2; i++) { - if (strcopy[i] == '=' && strcopy[i + 1] == ' ' && strcopy[i + 2] != '\0') { + if ((strcopy[i] == '=' || strcopy[i] == '*' || strcopy[i] == '@') && strcopy[i + 1] == ' ' && strcopy[i + 2] != '\0') { // Name found channelpos = i + 2; break; -- cgit v1.2.3