/*
 * follow, 1993
 * You guessed it -- this requires EPIC.
 */
alias clrit {
   ^on ^314 -"% % *"
   ^on ^406 -"% % *"
   ^on ^401 -"% % *"
   ^on ^312 -"% % *"
   ^on ^311 -"% % *"
}
alias followuh {
   ^on ^311 "% % *" {@ function_return [$2];clrit}
   ^on ^314 "% % *" {@ function_return [$2];clrit}
   ^on ^406 "% % *" {@ function_return [NONE@NONE.NONE];clrit}
   ^on ^401 "% % *" :
   ^on ^312 "% % *" :
   @ tmpfoo = AUTO_WHOWAS
   ^set AUTO_WHOWAS ON
   whois $0
   wait
   wait		/* Requires TWO waits in case a WHOWAS is done */
   ^set AUTO_WHOWAS $tmpfoo
}
alias follow {
	@ nicks = []
	@ whatis = show_end_of_msgs
	^set show_end_of_msgs OFF
	@ followed = followuh($0)
	if (followed == [NONE@NONE.NONE])
	{   echo No luck.  Cannot follow }
	{
		^on ^who "% % % % % % *" push nicks $$1
		eval who $followed
		wait
		^on ^who -"% % % % % % *"
	}
	@ function_return = nicks
	^set show_end_of_msgs $WHATIS
}

alias ffollow {
        @ nicks = []
        @ followstuff = followuh($0)
        @ tchannel = [$1]?[$1]:[$C]
        @ user_hosts = uh($onchannel($tchannel))
        @ nicks = copattern($followstuff $user_hosts $onchannel($tchannel))
        @ function_return = nicks
}
