Quick look shows a problem with
Code:
on *:TEXT:*:?:{ 
  if ($active != $nick) && (%Notify. [ $+ [ $+($server $+ $chan) ] ] != On) {
    set %Notify. [ $+ [ $+($server $+ $nick) ] ] On
    switchbar
  }
}
in that this is for a pm/query text, thus $chan will always return $null