org.jivesoftware.smackx.xdata.packet.DataForm Java Examples
The following examples show how to use
org.jivesoftware.smackx.xdata.packet.DataForm.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XMPPSession.java From mangosta-android with Apache License 2.0 | 7 votes |
public void createNodeToAllowComments(String blogPostId) { String nodeName = PublishCommentExtension.NODE + "/" + blogPostId; PubSubManager pubSubManager = PubSubManager.getInstance(XMPPSession.getInstance().getXMPPConnection()); try { // create node ConfigureForm configureForm = new ConfigureForm(DataForm.Type.submit); configureForm.setPublishModel(PublishModel.open); configureForm.setAccessModel(AccessModel.open); Node node = pubSubManager.createNode(nodeName, configureForm); // subscribe to comments String myJIDString = getUser().toString(); node.subscribe(myJIDString); } catch (SmackException.NoResponseException | XMPPException.XMPPErrorException | SmackException.NotConnectedException | InterruptedException e) { e.printStackTrace(); } }
Example #2
Source File: FillableForm.java From Smack with Apache License 2.0 | 6 votes |
public FillableForm(DataForm dataForm) { super(dataForm); if (dataForm.getType() != DataForm.Type.form) { throw new IllegalArgumentException(); } Set<String> requiredFields = new HashSet<>(); for (FormField formField : dataForm.getFields()) { if (formField.isRequired()) { String fieldName = formField.getFieldName(); requiredFields.add(fieldName); missingRequiredFields.add(fieldName); } } this.requiredFields = Collections.unmodifiableSet(requiredFields); }
Example #3
Source File: RoomInfoTest.java From Smack with Apache License 2.0 | 6 votes |
@Test public void validateRoomWithForm() { DataForm.Builder dataForm = DataForm.builder(DataForm.Type.result); TextSingleFormField.Builder desc = FormField.builder("muc#roominfo_description"); desc.setValue("The place for all good witches!"); dataForm.addField(desc.build()); TextSingleFormField.Builder subject = FormField.builder("muc#roominfo_subject"); subject.setValue("Spells"); dataForm.addField(subject.build()); TextSingleFormField.Builder occupants = FormField.builder("muc#roominfo_occupants"); occupants.setValue("3"); dataForm.addField(occupants.build()); DiscoverInfo discoInfo = DiscoverInfo.builder("disco1") .addExtension(dataForm.build()) .build(); RoomInfo roomInfo = new RoomInfo(discoInfo); assertEquals("The place for all good witches!", roomInfo.getDescription()); assertEquals("Spells", roomInfo.getSubject()); assertEquals(3, roomInfo.getOccupantsCount()); }
Example #4
Source File: RetrieveFormFieldsTest.java From Smack with Apache License 2.0 | 6 votes |
@Test public void checkAddAdditionalFieldsStanza() throws Exception { FormField field1 = FormField.builder("urn:example:xmpp:free-text-search") .setValue("Hi") .build(); FormField field2 = FormField.jidSingleBuilder("urn:example:xmpp:stanza-content") .setValue(JidTestUtil.BARE_JID_1) .build(); MamQueryArgs mamQueryArgs = MamQueryArgs.builder() .withAdditionalFormField(field1) .withAdditionalFormField(field2) .build(); DataForm dataForm = mamQueryArgs.getDataForm(); String dataFormResult = dataForm.toXML().toString(); assertXmlSimilar(additionalFieldsStanza, dataFormResult); }
Example #5
Source File: StreamNegotiator.java From Smack with Apache License 2.0 | 6 votes |
/** * Creates the initiation acceptance stanza to forward to the stream * initiator. * * @param streamInitiationOffer The offer from the stream initiator to connect for a stream. * @param namespace The namespace that relates to the accepted means of transfer. * @return The response to be forwarded to the initiator. */ protected static StreamInitiation createInitiationAccept( StreamInitiation streamInitiationOffer, String namespace) { StreamInitiation response = new StreamInitiation(); response.setTo(streamInitiationOffer.getFrom()); response.setFrom(streamInitiationOffer.getTo()); response.setType(IQ.Type.result); response.setStanzaId(streamInitiationOffer.getStanzaId()); DataForm.Builder form = DataForm.builder(); ListSingleFormField.Builder field = FormField.listSingleBuilder( FileTransferNegotiator.STREAM_DATA_FIELD_NAME); field.setValue(namespace); form.addField(field.build()); response.setFeatureNegotiationForm(form.build()); return response; }
Example #6
Source File: SoftwareInfoManagerTest.java From Smack with Apache License 2.0 | 6 votes |
public static SoftwareInfoForm buildSoftwareInfoFromDataForm() throws URISyntaxException { DataForm.Builder dataFormBuilder = DataForm.builder(Type.result); dataFormBuilder.addField(FormField.buildHiddenFormType(SoftwareInfoForm.FORM_TYPE)); dataFormBuilder.addField(FormField.builder("icon") .addFormFieldChildElement(createMediaElement()) .build()); dataFormBuilder.addField(FormField.builder("os") .setValue("Windows") .build()); dataFormBuilder.addField(FormField.builder("os_version") .setValue("XP") .build()); dataFormBuilder.addField(FormField.builder("software") .setValue("Exodus") .build()); dataFormBuilder.addField(FormField.builder("software_version") .setValue("0.9.1") .build()); SoftwareInfoForm softwareInfoForm = SoftwareInfoForm.getBuilder() .setDataForm(dataFormBuilder.build()) .build(); return softwareInfoForm; }
Example #7
Source File: SoftwareInfoFormTest.java From Smack with Apache License 2.0 | 6 votes |
public static SoftwareInfoForm createSoftwareInfoFormUsingDataForm() throws URISyntaxException { DataForm.Builder dataFormBuilder = DataForm.builder(Type.result); TextSingleFormField formField = FormField.buildHiddenFormType(SoftwareInfoForm.FORM_TYPE); dataFormBuilder.addField(formField); dataFormBuilder.addField(FormField.builder("icon") .addFormFieldChildElement(createMediaElement()) .build()); dataFormBuilder.addField(FormField.builder("os") .setValue("Windows") .build()); dataFormBuilder.addField(FormField.builder("os_version") .setValue("XP") .build()); dataFormBuilder.addField(FormField.builder("software") .setValue("Exodus") .build()); dataFormBuilder.addField(FormField.builder("software_version") .setValue("0.9.1") .build()); SoftwareInfoForm softwareInfoForm = SoftwareInfoForm.getBuilder().setDataForm(dataFormBuilder.build()).build(); return softwareInfoForm; }
Example #8
Source File: MultiUserChat.java From Smack with Apache License 2.0 | 6 votes |
/** * Sends the completed configuration form to the server. The room will be configured * with the new settings defined in the form. * * @param form the form with the new settings. * @throws XMPPErrorException if an error occurs setting the new rooms' configuration. * @throws NoResponseException if there was no response from the server. * @throws NotConnectedException if the XMPP connection is not connected. * @throws InterruptedException if the calling thread was interrupted. */ public void sendConfigurationForm(FillableForm form) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { final DataForm dataForm; if (form != null) { dataForm = form.getDataFormToSubmit(); } else { // Instant room, cf. XEP-0045 § 10.1.2 dataForm = DataForm.builder().build(); } MUCOwner iq = new MUCOwner(); iq.setTo(room); iq.setType(IQ.Type.set); iq.addExtension(dataForm); connection.createStanzaCollectorAndSend(iq).nextResultOrThrow(); }
Example #9
Source File: MultiUserChat.java From Smack with Apache License 2.0 | 6 votes |
/** * Sends a voice request to the MUC. The room moderators usually need to approve this request. * * @throws NotConnectedException if the XMPP connection is not connected. * @throws InterruptedException if the calling thread was interrupted. * @see <a href="http://xmpp.org/extensions/xep-0045.html#requestvoice">XEP-45 § 7.13 Requesting * Voice</a> * @since 4.1 */ public void requestVoice() throws NotConnectedException, InterruptedException { DataForm.Builder form = DataForm.builder() .setFormType(MUCInitialPresence.NAMESPACE + "#request"); TextSingleFormField.Builder requestVoiceField = FormField.textSingleBuilder("muc#role"); requestVoiceField.setLabel("Requested role"); requestVoiceField.setValue("participant"); form.addField(requestVoiceField.build()); Message message = connection.getStanzaFactory().buildMessageStanza() .to(room) .addExtension(form.build()) .build(); connection.sendStanza(message); }
Example #10
Source File: MamQueryIQ.java From Smack with Apache License 2.0 | 6 votes |
/** * MAM query IQ constructor. * * @param queryId TODO javadoc me please * @param node TODO javadoc me please * @param dataForm TODO javadoc me please */ public MamQueryIQ(String queryId, String node, DataForm dataForm) { super(ELEMENT, NAMESPACE); this.queryId = queryId; this.node = node; this.dataForm = dataForm; if (dataForm != null) { String formType = dataForm.getFormType(); if (formType == null) { throw new IllegalArgumentException("If a data form is given it must posses a hidden form type field"); } if (!formType.equals(MamElements.NAMESPACE)) { throw new IllegalArgumentException( "Value of the hidden form type field must be '" + MamElements.NAMESPACE + "'"); } addExtension(dataForm); } }
Example #11
Source File: FormFieldRegistry.java From Smack with Apache License 2.0 | 6 votes |
@SuppressWarnings("ReferenceEquality") public static synchronized void register(DataForm dataForm) { // TODO: Also allow forms of type 'result'? if (dataForm.getType() != DataForm.Type.form) { throw new IllegalArgumentException(); } String formType = null; TextSingleFormField hiddenFormTypeField = dataForm.getHiddenFormTypeField(); if (hiddenFormTypeField != null) { formType = hiddenFormTypeField.getValue(); } for (FormField formField : dataForm.getFields()) { // Note that we can compare here by reference equality to skip the hidden form type field. if (formField == hiddenFormTypeField) { continue; } String fieldName = formField.getFieldName(); FormField.Type type = formField.getType(); register(formType, fieldName, type); } }
Example #12
Source File: DataFormProvider.java From Smack with Apache License 2.0 | 6 votes |
private static DataForm.Item parseItem(XmlPullParser parser, XmlEnvironment xmlEnvironment, String formType, DataForm.Type dataFormType) throws XmlPullParserException, IOException, SmackParsingException { final int initialDepth = parser.getDepth(); List<FormField> fields = new ArrayList<>(); outerloop: while (true) { XmlPullParser.TagEvent eventType = parser.nextTag(); switch (eventType) { case START_ELEMENT: String name = parser.getName(); switch (name) { case "field": FormField field = parseField(parser, XmlEnvironment.from(parser, xmlEnvironment), formType, dataFormType); fields.add(field); break; } break; case END_ELEMENT: if (parser.getDepth() == initialDepth) { break outerloop; } break; } } return new DataForm.Item(fields); }
Example #13
Source File: EntityCapsManagerTest.java From Smack with Apache License 2.0 | 6 votes |
private static DiscoverInfo createComplexSamplePacket() throws XmppStringprepException { DiscoverInfoBuilder di = DiscoverInfo.builder("disco1"); di.from(JidCreate.from("[email protected]/230193")); di.to(JidCreate.from("[email protected]/chamber")); di.ofType(IQ.Type.result); Collection<DiscoverInfo.Identity> identities = new LinkedList<DiscoverInfo.Identity>(); DiscoverInfo.Identity i = new DiscoverInfo.Identity("client", "pc", "Psi 0.11", "en"); identities.add(i); i = new DiscoverInfo.Identity("client", "pc", "Ψ 0.11", "el"); identities.add(i); di.addIdentities(identities); di.addFeature("http://jabber.org/protocol/disco#items"); di.addFeature(EntityCapsManager.NAMESPACE); di.addFeature("http://jabber.org/protocol/muc"); di.addFeature("http://jabber.org/protocol/disco#info"); DataForm softwareInfoDataForm = createSampleSoftwareInfoDataForm(); di.addExtension(softwareInfoDataForm); return di.build(); }
Example #14
Source File: SoftwareInfoForm.java From Smack with Apache License 2.0 | 6 votes |
/** * Include {@link DataForm} to be encapsulated under SoftwareInfoForm. * <br> * @param dataForm The dataform containing Software Information * @return Builder */ public Builder setDataForm(DataForm dataForm) { if (dataForm.getTitle() != null || !dataForm.getItems().isEmpty() || dataForm.getReportedData() != null || !dataForm.getInstructions().isEmpty()) { throw new IllegalArgumentException("Illegal Arguements for SoftwareInformation"); } String formTypeValue = dataForm.getFormType(); if (formTypeValue == null) { throw new IllegalArgumentException("FORM_TYPE Formfield missing"); } if (!formTypeValue.equals(SoftwareInfoForm.FORM_TYPE)) { throw new IllegalArgumentException("Malformed FORM_TYPE Formfield encountered"); } this.dataFormBuilder = dataForm.asBuilder(); return this; }
Example #15
Source File: EntityCapsManager.java From Smack with Apache License 2.0 | 6 votes |
/** * Verify that the given discovery info is not ill-formed. * * @param info the discovery info to verify. * @return true if the stanza extensions is not ill-formed */ private static boolean verifyPacketExtensions(DiscoverInfo info) { Set<String> foundFormTypes = new HashSet<>(); List<DataForm> dataForms = info.getExtensions(DataForm.class); for (DataForm dataForm : dataForms) { FormField formFieldTypeField = dataForm.getHiddenFormTypeField(); if (formFieldTypeField == null) { continue; } String type = formFieldTypeField.getFirstValue(); boolean noDuplicate = foundFormTypes.add(type); if (!noDuplicate) { // Ill-formed extension: duplicate forms (by form field type string). return false; } } return true; }
Example #16
Source File: FillableForm.java From Smack with Apache License 2.0 | 5 votes |
public DataForm getDataFormToSubmit() { if (!missingRequiredFields.isEmpty()) { throw new IllegalStateException("Not all required fields filled. Missing: " + missingRequiredFields); } DataForm dataFormToSend = DataForm.builder() .addField(formTypeFormField) .addFields(filledFields.values()) .build(); return dataFormToSend; }
Example #17
Source File: EnablePushNotificationsIQ.java From Smack with Apache License 2.0 | 5 votes |
@Override protected IQChildElementXmlStringBuilder getIQChildElementBuilder(IQChildElementXmlStringBuilder xml) { xml.attribute("jid", jid); xml.attribute("node", node); xml.rightAngleBracket(); if (publishOptions != null) { DataForm.Builder dataForm = DataForm.builder(); // TODO: Shouldn't this use some potentially existing PubSub API? Also FORM_TYPE fields are usually of type // 'hidden', but the examples in XEP-0357 do also not set the value to hidden and FORM_TYPE itself appears // to be more convention than specification. FormField formTypeField = FormField.buildHiddenFormType(PubSub.NAMESPACE + "#publish-options"); dataForm.addField(formTypeField); Iterator<Map.Entry<String, String>> publishOptionsIterator = publishOptions.entrySet().iterator(); while (publishOptionsIterator.hasNext()) { Map.Entry<String, String> pairVariableValue = publishOptionsIterator.next(); TextSingleFormField.Builder field = FormField.builder(pairVariableValue.getKey()); field.setValue(pairVariableValue.getValue()); dataForm.addField(field.build()); } xml.append(dataForm.build()); } return xml; }
Example #18
Source File: MamQueryIQProvider.java From Smack with Apache License 2.0 | 5 votes |
@Override public MamQueryIQ parse(XmlPullParser parser, int initialDepth, XmlEnvironment xmlEnvironment) throws XmlPullParserException, IOException, SmackParsingException { DataForm dataForm = null; String queryId = parser.getAttributeValue("", "queryid"); String node = parser.getAttributeValue("", "node"); outerloop: while (true) { final XmlPullParser.Event eventType = parser.next(); final String name = parser.getName(); switch (eventType) { case START_ELEMENT: switch (name) { case DataForm.ELEMENT: dataForm = DataFormProvider.INSTANCE.parse(parser); break; } break; case END_ELEMENT: if (parser.getDepth() == initialDepth) { break outerloop; } break; default: // Catch all for incomplete switch (MissingCasesInEnumSwitch) statement. break; } } return new MamQueryIQ(queryId, node, dataForm); }
Example #19
Source File: FilledForm.java From Smack with Apache License 2.0 | 5 votes |
public FilledForm(DataForm dataForm) { this.dataForm = Objects.requireNonNull(dataForm); String formType = dataForm.getFormType(); if (StringUtils.isNullOrEmpty(formType)) { throw new IllegalArgumentException("The provided data form has no hidden FROM_TYPE field."); } if (dataForm.getType() == Type.cancel) { throw new IllegalArgumentException("Forms of type 'cancel' are not filled nor fillable"); } formTypeFormField = dataForm.getHiddenFormTypeField(); }
Example #20
Source File: FilledForm.java From Smack with Apache License 2.0 | 5 votes |
protected static void ensureFormType(DataForm dataForm, String formType) { String dataFormType = dataForm.getFormType(); if (!formType.equals(dataFormType)) { throw new IllegalArgumentException("The provided data form must be of type '" + formType + "', this one was of type '" + dataFormType + '\''); } }
Example #21
Source File: Form.java From Smack with Apache License 2.0 | 5 votes |
public static Form from(StanzaView stanzaView) { DataForm dataForm = DataForm.from(stanzaView); if (dataForm == null || dataForm.getType() != Type.form) { return null; } return new Form(dataForm); }
Example #22
Source File: MamManager.java From Smack with Apache License 2.0 | 5 votes |
private MamPrefsResult queryMamPrefs(MamPrefsIQ mamPrefsIQ) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException, NotLoggedInException { final XMPPConnection connection = getAuthenticatedConnectionOrThrow(); MamPrefsIQ mamPrefsResultIQ = connection.createStanzaCollectorAndSend(mamPrefsIQ).nextResultOrThrow(); return new MamPrefsResult(mamPrefsResultIQ, DataForm.from(mamPrefsIQ)); }
Example #23
Source File: DataLayoutTest.java From Smack with Apache License 2.0 | 5 votes |
@Test public void testLayoutFromFile() throws Exception { DataFormProvider pr = new DataFormProvider(); InputStreamReader inputStreamReader = new InputStreamReader(this.getClass().getResourceAsStream(TEST_INPUT_1), "UTF-8"); XmlPullParser parser = PacketParserUtils.getParserFor(inputStreamReader); DataForm form = pr.parse(parser); assertNotNull(form); assertEquals(1 , form.getExtensionElements().size()); DataLayout layout = (DataLayout) form.getExtensionElements().get(0); assertEquals(5 , layout.getPageLayout().size()); assertEquals("Label - & \u00E9 \u00E1 ", layout.getLabel()); Section section = (Section) layout.getPageLayout().get(1); assertEquals("section Label - & \u00E9 \u00E1 ", section.getLabel()); Text text = (Text) layout.getPageLayout().get(2); assertEquals("PageText - & \u00E9 \u00E1 ", text.getText()); section = (Section) layout.getPageLayout().get(3); assertEquals("<html>Number of Persons by<br/> Nationality and Status</html>", section.getLabel()); text = (Text) layout.getPageLayout().get(4); assertEquals("<html><font color='red'><em>DO NOT DELAY</em></font><br/>supply further information</html>", text.getText()); assertNotNull(layout.toXML()); String output = layout.toXML().toString(); assertEquals(TEST_OUTPUT_SPECIAL, output); }
Example #24
Source File: FileTransferNegotiator.java From Smack with Apache License 2.0 | 5 votes |
private static DataForm createDefaultInitiationForm() { DataForm.Builder form = DataForm.builder() .setType(DataForm.Type.form); ListSingleFormField.Builder fieldBuilder = FormField.listSingleBuilder(STREAM_DATA_FIELD_NAME); if (!IBB_ONLY) { fieldBuilder.addOption(Bytestream.NAMESPACE); } fieldBuilder.addOption(DataPacketExtension.NAMESPACE); form.addField(fieldBuilder.build()); return form.build(); }
Example #25
Source File: DataValidationTest.java From Smack with Apache License 2.0 | 5 votes |
@ParameterizedTest @EnumSource(SmackTestUtil.XmlPullParserKind.class) public void testNamespacePrefix(SmackTestUtil.XmlPullParserKind parserKind) throws Exception { String formFieldUsingNamespacePrefix = "<x xmlns='jabber:x:data'" + " xmlns:xdv='http://jabber.org/protocol/xdata-validate'" + " type='form'>" + " <title>Sample Form</title>" + " <instructions>" + " Please provide information for the following fields..." + " </instructions>" + " <field type='text-single' var='name' label='Event Name'/>" + " <field type='text-single' var='date/start' label='Starting Date'>" + " <xdv:validate datatype='xs:date'>" + " <basic/>" + " </xdv:validate>" + " </field>" + " <field type='text-single' var='date/end' label='Ending Date'>" + " <xdv:validate datatype='xs:date'>" + " <basic/>" + " </xdv:validate>" + " </field>" + "</x>"; DataForm dataForm = SmackTestUtil.parse(formFieldUsingNamespacePrefix, DataFormProvider.class, parserKind); assertEquals("Sample Form", dataForm.getTitle()); FormField nameField = dataForm.getField("name"); assertEquals("Event Name", nameField.getLabel()); FormField dataStartField = dataForm.getField("date/start"); ValidateElement dataStartValidateElement = ValidateElement.from(dataStartField); assertEquals("xs:date", dataStartValidateElement.getDatatype()); assertTrue(dataStartValidateElement instanceof BasicValidateElement); }
Example #26
Source File: ReportedData.java From Smack with Apache License 2.0 | 5 votes |
/** * Returns a new ReportedData if the stanza is used for reporting data and includes an * extension that matches the elementName and namespace "x","jabber:x:data". * * @param packet the stanza used for reporting data. * @return ReportedData from the packet if present, otherwise null. */ public static ReportedData getReportedDataFrom(Stanza packet) { // Check if the packet includes the DataForm extension DataForm dataForm = DataForm.from(packet); if (dataForm != null) { if (dataForm.getReportedData() != null) return new ReportedData(dataForm); } // Otherwise return null return null; }
Example #27
Source File: ServiceDiscoveryManager.java From Smack with Apache License 2.0 | 5 votes |
/** * Remove the extended discovery information of the given form type. * * @param formType the type of the data form with the extended discovery information to remove. * @since 4.4.0 */ public synchronized void removeExtendedInfo(String formType) { DataForm removedForm = DataForm.remove(extendedInfos, formType); if (removedForm != null) { renewEntityCapsVersion(); } }
Example #28
Source File: SoftwareInfoManager.java From Smack with Apache License 2.0 | 5 votes |
/** * Get Software Information from the provided XMPP address. Returns <code>null</code> in case the queried entity does not announce that information. * * @param jid jid to get software information from * @return {@link SoftwareInfoForm} Form containing software information or <code>null</code>. * @throws NoResponseException if there was no response from the remote entity * @throws XMPPErrorException if there was an XMPP error returned * @throws NotConnectedException if the XMPP connection is not connected * @throws InterruptedException if the calling thread was interrupted */ public SoftwareInfoForm fromJid(Jid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { DiscoverInfo discoverInfo = serviceDiscoveryManager.discoverInfo(jid); DataForm dataForm = DataForm.from(discoverInfo, SoftwareInfoForm.FORM_TYPE); if (dataForm == null) { return null; } return SoftwareInfoForm.getBuilder() .setDataForm(dataForm) .build(); }
Example #29
Source File: EntityCapsManagerTest.java From Smack with Apache License 2.0 | 5 votes |
private static DiscoverInfo createMalformedDiscoverInfo() throws XmppStringprepException { DiscoverInfoBuilder di = DiscoverInfo.builder("disco1"); di.from("[email protected]/230193"); di.to(")[email protected]/chamber"); di.ofType(IQ.Type.result); Collection<DiscoverInfo.Identity> identities = new LinkedList<DiscoverInfo.Identity>(); DiscoverInfo.Identity i = new DiscoverInfo.Identity("client", "pc", "Psi 0.11", "en"); identities.add(i); i = new DiscoverInfo.Identity("client", "pc", "Ψ 0.11", "el"); identities.add(i); di.addIdentities(identities); // Failure 1: Duplicate identities i = new DiscoverInfo.Identity("client", "pc", "Ψ 0.11", "el"); identities.add(i); di.addIdentities(identities); di.addFeature("http://jabber.org/protocol/disco#items"); di.addFeature(EntityCapsManager.NAMESPACE); di.addFeature("http://jabber.org/protocol/muc"); di.addFeature("http://jabber.org/protocol/disco#info"); // Failure 2: Duplicate features di.addFeature("http://jabber.org/protocol/disco#info"); DataForm softwareInfoDataForm = createSampleSoftwareInfoDataForm(); di.addExtension(softwareInfoDataForm); DiscoverInfo discoverInfo = di.buildWithoutValidiation(); return discoverInfo; }
Example #30
Source File: FormNode.java From Smack with Apache License 2.0 | 5 votes |
/** * Create a {@link FormNode} which contains the specified form. * * @param formType The type of form being sent * @param submitForm The form */ public FormNode(FormNodeType formType, DataForm submitForm) { super(formType.getNodeElement()); if (submitForm == null) throw new IllegalArgumentException("Submit form cannot be null"); configForm = submitForm; }