The dialog event for that part reads as follows
Code:
 on *:dialog:whois:*:14:{
  var %chan = $+($chr(35),$gettok($did($dname,$did).seltext,-1,35))
  if $devent == dclick {
    $iif($me !ison %chan,.join %chan,echo -a 4You're already in $v2)
  }
  elseif $devent == sclick {
    did -rva $dname 28 $iif($me !ison %chan,N/A,$idle($nick(%chan,$name).idle))
  }
}
 


Dialog ID 14 contains the list of channels that the person that was whois'd is currently on.