$server returns the value of the server you are connected to (according to the help file). Using $server wouldn't work correctly unless the server sending the notice was the one you are connected to.