#
# This is a simple alias that allows matching users
# on a channel.
# You specify a mask and all the users matching are
# printed in the channel window
#


alias(match)
{
	if($window.type != "channel")
	{
		echo "This is not a channel window"
		halt
	}

	if(!$0)
	{
		echo "Usage: match <mask>"
		halt
	}

	%users[] = $chan.users(,$0)

	if(%users[]# > 0)
	{
		echo "$b%users[]# users matching on $chan.name"
		%i = 1
		foreach(%user,%users[])
		{
			# Here we format the nice KVIrc builtin links
			echo $b%i$b: $cr!n$cr%user$cr!$username(%user)@$cr!h$cr$hostname(%user)$cr
			%i++;
		}
	} else {
		echo "$b\No users matching on $chan.name"
	}
}

