public static IQ createErrorResponse ( final IQ request , final String message , Condition condition , Type type ) { final IQ result = request . createCopy ( ) ; result . setID ( request . getID ( ) ) ; result . setFrom ( request . getTo ( ) ) ; result . setTo ( request . getFrom ( ) ) ; PacketError e = new PacketError ( condition , type ) ; if ( message != null ) { e . setText ( message ) ; } result . setError ( e ) ; return result ; }
Creates an error response for a given IQ request .