What function to hook for changes made in status and visibility of a post

What I was looking for was transition_post_status. The documentation can be found here.

What I did was to add one more filter add_filter('transition_post_status','myFunction');