~rcr/rirc

3d6c2892dae8a23a7eaf366d37744918dcf73ada — Richard Robbins 11 months ago 3a12bfd
fix 353 handling when nick is valid PREFIX char
2 files changed, 10 insertions(+), 2 deletions(-)

M src/handlers/irc_recv.c
M test/handlers/irc_recv.c
M src/handlers/irc_recv.c => src/handlers/irc_recv.c +2 -2
@@ 565,8 565,8 @@ irc_numeric_353(struct server *s, struct irc_message *m)

		struct mode prfxmode = {0};

		while (!mode_prfxmode_set(&prfxmode, &(s->mode_cfg), *nick, 1))
			nick++;
		while (*nick && strchr(s->mode_cfg.PREFIX.T, *nick))
			(void) mode_prfxmode_set(&prfxmode, &(s->mode_cfg), *nick++, 1);

		if (*nick == 0)
			failf(s, "RPL_NAMEREPLY: invalid nick: '%s'", prefix);

M test/handlers/irc_recv.c => test/handlers/irc_recv.c +8 -0
@@ 258,12 258,20 @@ test_irc_numeric_353(void)
	if (user_list_get(&(c1->users), s->casemapping, "n1", 0) == NULL)
		test_fail("Failed to retrieve user n1");

	/* test single nick with prefix */
	channel_reset(c1);
	CHECK_RECV("353 me = #c1 :@n1", 0, 0, 0);

	if (user_list_get(&(c1->users), s->casemapping, "n1", 0) == NULL)
		test_fail("Failed to retrieve user n1");

	/* test single nickwith prefix, contains mode characters */
	channel_reset(c1);
	CHECK_RECV("353 me = #c1 @v", 0, 0, 0);

	if (user_list_get(&(c1->users), s->casemapping, "v", 0) == NULL)
		test_fail("Failed to retrieve user v");

	/* test multiple nicks */
	channel_reset(c1);
	CHECK_RECV("353 me = #c1 :@n1 +n2 n3", 0, 0, 0);