added function to check if a request from server is a PING request
added automatic registration (works for freenode). TODO: remove redundant code