I think this is what you're looking for, however, if it's not, and you wouldn't mind telling me what the purpose of the dialog is, then I may be able to write up something better.
Code:
on *:dialog:nicklist:*:*:{
  if ($devent == init) {
    didtok $dname 1 44 %nicks
  }
  if $devent == sclick {
    if $did == 6 {
      set $+(%,nick,.,$iif($did(5),$v1,$did(1).seltext)) $address($iif($did(5),$v1,$did(1).seltext),2)
    }
    elseif $did == 7 {
      unset $+(%,nick,.,$iif($did(5),$v1,$did(1).seltext))
    }
  }
}