[IRCServices Coding] coding... (svcs 5)

v13 at priest.com v13 at priest.com
Fri Dec 14 12:12:44 PST 2001


For services 5:

I believe code like this (from operserv/main.c: do_killclones() )

            if (match_usermask(clonemask, user) != 0) {
                char killreason[32];
                count++;
                snprintf(killreason, sizeof(killreason),
                         "Cloning [%d]", count);
                kill_user(NULL, user->nick, killreason);
            }

should exist in seperate functions like:

int kill_mask(const char *mask, const char *reason)
{
	int	count=0;
	User	*user;

        for (user = first_user(); user; user = next_user())
	{
		if (match_usermask(mask, user) != 0)
		{
			char	killreason[512];

			count++;
			snprintf(killreason, sizeof(killreason),
				(reason == NULL ? "Cloning [%d]" : reason),
				count);
			kill_user(NULL, user->nick, killreason);
		}
	}

	return(count);
}

3rd party modules should not use their own code for things like this, since
it exists allready.

<<V13>>