Well you could do something like this, but other than that I have no idea how else I could do it, sorry.
On *:Quit: {
if ($query($nick)) {
notify $nick
echo 7 -at $nick has logged out.
}
}
On *:Notify: {
if ($query($nick)) {
notify -r $nick
echo 7 -t $nick $nick has logged in.
}
}