/** * Returns a new ReportedData if the packet is used for gathering data and includes an extension * that matches the elementName and namespace "x","jabber:x:data". * * @param packet the packet used for gathering data. * @return the data form parsed from the packet or <tt>null</tt> if there was not a form in the * packet. */ public static Form getFormFrom(Packet packet) { // Check if the packet includes the DataForm extension final PacketExtension packetExtension = packet.getExtension("x", "jabber:x:data"); if (packetExtension != null) { // Check if the existing DataForm is not a result of a search final DataForm dataForm = (DataForm) packetExtension; if (dataForm.getReportedData() == null) { return new Form(dataForm); } } // Otherwise return null return null; }