I have written a custom module for ejabberd 15.07 , where i am using user_send_packet hook to intercept the received packets and before processing them further i need to check they are not error packet like malformed xml , jid , privacy or auth issue that result into packet to be bounce back to its originator .
how could i validate the received packet or check this ?