Since quit's don't have a channel property, use $comchan using the nick, and N representing the Nth common channel.

i.e.
Code:
on *:QUIT: {
  var %c = 1
  while ($comchan($nick, %c)) {
    var %chan = $ifmatch
    /echo %chan This is a quit msg ( $+ $nick $+ ) $1-
  }
}

Then use %chan, not $chan >:P