complete function of sharing and deleting message