Code:
on *:open:?:*:{ %q.a = o | .raw -q whois $nick }
;
alias query { .query $1- | %q.a = o | .raw -q whois $1 |   .load.switchbar }
;
alias q.open {
  var %q.cc = $comchan($1,0), %q.c,%q.l = 1
  echo -i25 $1 query opened with ( $+ $1 $+ $iif(%q.addr != $null,$chr(32) $+ $v1) $+ ) | unset %q.addr
  while (%q.l <= %q.cc) { %q.c = %q.c $comchan($1,%q.l) $+ $iif(%q.l != %q.cc,$chr(44)) | inc %q.l }
  echo -i25 $1 you are on %q.cc common channel $+ $iif(%q.cc != 1,s) with $1 $+ $iif(%q.cc > 0,$chr(44) which $iif(%q.cc > 1,are,is) $+ : %q.c)
}
;
Raw 311:*:{ if (%q.a) { %q.addr = $3 $+ @ $+ $4 | q.open $2 | q.despool.held.text $2 | unset %q.a | halt } | else { | halt } }
;
alias -l q.despool.held.text {
  if $!window($1) {
    var %i = 1
    while ($var($+(%,q.,$1,.text.line.,%i),1)) {
      echo -itlbfmr $1 $($+(%,q.,$1,.text.line.,%i),2)
      inc %i
    }
  }
  unset $+(%,q.,$1,.lines.counter)
  unset $+(%,q.,$1,.text.line.*)
  .timer $+ $+(.q.,$1,.text.despooler) off
}
;
on ^*:text:*:?:{
  if (%q.a) {
    haltdef
    inc -u60 $+(%,q.,$nick,.lines.counter)
    set -u60 $+(%,q.,$nick,.text.line.,$($+(%,q.,$nick,.lines.counter),2)) $+(<,$nick,>) $1-
    if ($($+(%,q.,$nick,.lines.counter),2) == 1) {
      .timer $+ $+(.q.,$nick,.text.despooler) 1 1 q.despool.held.text $!( $+ $nick $+ ,)
    }
  }
}


It just stores all the lines untill (1) the whois does its biz or (2) the timer goes off (incase the whois dont come back), in either event it then displays all the stored lines.
Note the change to RAW 311 this is to get them stored lines out.