diff options
author | Luke Bratch <luke@bratch.co.uk> | 2025-08-09 13:25:03 +0100 |
---|---|---|
committer | Luke Bratch <luke@bratch.co.uk> | 2025-08-09 13:25:03 +0100 |
commit | 0e7f232b3d5ecb484d9d91bdd7e4b6d4e7791585 (patch) | |
tree | 0525be83c0dba635293abbf99d951c4cad4ef0e1 /functions.c | |
parent | 5d52ed923b122a4e6998ae9a3501f41ff4c06bc3 (diff) |
Correctly process 353 RPL_NAMREPLYs for secret and private channels.
Diffstat (limited to 'functions.c')
-rw-r--r-- | functions.c | 8 |
1 files changed, 5 insertions, 3 deletions
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; |